about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/accountsservice
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:36 +0000
committerAlyssa Ross <hi@alyssa.is>2019-01-07 02:18:47 +0000
commit36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2 (patch)
treeb3faaf573407b32aa645237a4d16b82778a39a92 /nixpkgs/pkgs/development/libraries/accountsservice
parent4e31070265257dc67d120c27e0f75c2344fdfa9a (diff)
parentabf060725d7614bd3b9f96764262dfbc2f9c2199 (diff)
downloadnixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.gz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.bz2
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.lz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.xz
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.tar.zst
nixlib-36f56d99fa0a0765c9f1de4a5f17a9b05830c3f2.zip
Add 'nixpkgs/' from commit 'abf060725d7614bd3b9f96764262dfbc2f9c2199'
git-subtree-dir: nixpkgs
git-subtree-mainline: 4e31070265257dc67d120c27e0f75c2344fdfa9a
git-subtree-split: abf060725d7614bd3b9f96764262dfbc2f9c2199
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/accountsservice')
-rw-r--r--nixpkgs/pkgs/development/libraries/accountsservice/Disable-methods-that-change-files-in-etc.patch130
-rw-r--r--nixpkgs/pkgs/development/libraries/accountsservice/default.nix50
-rw-r--r--nixpkgs/pkgs/development/libraries/accountsservice/no-create-dirs.patch15
3 files changed, 195 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/accountsservice/Disable-methods-that-change-files-in-etc.patch b/nixpkgs/pkgs/development/libraries/accountsservice/Disable-methods-that-change-files-in-etc.patch
new file mode 100644
index 000000000000..acaccb8c8485
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/accountsservice/Disable-methods-that-change-files-in-etc.patch
@@ -0,0 +1,130 @@
+From 6f172007452b39bfda5062fc29ea5382671ac16e Mon Sep 17 00:00:00 2001
+From: Alexander Ried <ried@mytum.de>
+Date: Thu, 26 May 2016 19:54:21 +0200
+Subject: [PATCH] Disable methods that change files in /etc
+
+Only if environment variable NIXOS_USERS_PURE is set.
+---
+ src/daemon.c | 10 ++++++++++
+ src/user.c   | 35 +++++++++++++++++++++++++++++++++++
+ 2 files changed, 45 insertions(+)
+
+diff --git a/src/daemon.c b/src/daemon.c
+index e62e124..87459b2 100644
+--- a/src/daemon.c
++++ b/src/daemon.c
+@@ -931,6 +931,11 @@ daemon_create_user (AccountsAccounts      *accounts,
+                     const gchar           *real_name,
+                     gint                   account_type)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         Daemon *daemon = (Daemon*)accounts;
+         CreateUserData *data;
+ 
+@@ -1138,6 +1143,11 @@ daemon_delete_user (AccountsAccounts      *accounts,
+                     gint64                 uid,
+                     gboolean               remove_files)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         Daemon *daemon = (Daemon*)accounts;
+         DeleteUserData *data;
+ 
+diff --git a/src/user.c b/src/user.c
+index 0fb1a17..dbdebaf 100644
+--- a/src/user.c
++++ b/src/user.c
+@@ -904,6 +904,11 @@ user_set_real_name (AccountsUser          *auser,
+                     GDBusMethodInvocation *context,
+                     const gchar           *real_name)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         int uid;
+         const gchar *action_id;
+@@ -981,6 +986,11 @@ user_set_user_name (AccountsUser          *auser,
+                     GDBusMethodInvocation *context,
+                     const gchar           *user_name)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         daemon_local_check_auth (user->daemon,
+                                  user,
+@@ -1263,6 +1273,11 @@ user_set_home_directory (AccountsUser          *auser,
+                          GDBusMethodInvocation *context,
+                          const gchar           *home_dir)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         daemon_local_check_auth (user->daemon,
+                                  user,
+@@ -1322,6 +1337,11 @@ user_set_shell (AccountsUser          *auser,
+                 GDBusMethodInvocation *context,
+                 const gchar           *shell)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         daemon_local_check_auth (user->daemon,
+                                  user,
+@@ -1602,6 +1622,11 @@ user_set_locked (AccountsUser          *auser,
+                  GDBusMethodInvocation *context,
+                  gboolean               locked)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         daemon_local_check_auth (user->daemon,
+                                  user,
+@@ -1814,6 +1839,11 @@ user_set_password_mode (AccountsUser          *auser,
+                         GDBusMethodInvocation *context,
+                         gint                   mode)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         const gchar *action_id;
+ 
+@@ -1905,6 +1935,11 @@ user_set_password (AccountsUser          *auser,
+                    const gchar           *password,
+                    const gchar           *hint)
+ {
++        if (getenv("NIXOS_USERS_PURE")) {
++                throw_error (context, ERROR_NOT_SUPPORTED, "Modifying users not supported without users.mutableUsers");
++                return;
++        }
++
+         User *user = (User*)auser;
+         gchar **data;
+ 
+-- 
+2.9.3
+
diff --git a/nixpkgs/pkgs/development/libraries/accountsservice/default.nix b/nixpkgs/pkgs/development/libraries/accountsservice/default.nix
new file mode 100644
index 000000000000..b42240a26c4e
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/accountsservice/default.nix
@@ -0,0 +1,50 @@
+{ stdenv, fetchurl, pkgconfig, glib, intltool, makeWrapper, shadow
+, gobject-introspection, polkit, systemd, coreutils, meson, dbus
+, ninja, python3 }:
+
+stdenv.mkDerivation rec {
+  name = "accountsservice-${version}";
+  version = "0.6.54";
+
+  src = fetchurl {
+    url = "https://www.freedesktop.org/software/accountsservice/accountsservice-${version}.tar.xz";
+    sha256 = "1b115n0a4yfa06kgxc69qfc1rc0w4frgs3id3029czkrhhn0ds96";
+  };
+
+  nativeBuildInputs = [ pkgconfig makeWrapper meson ninja python3 ];
+
+  buildInputs = [ glib intltool gobject-introspection polkit systemd dbus ];
+
+  mesonFlags = [ "-Dsystemdsystemunitdir=etc/systemd/system"
+                 "-Dlocalstatedir=/var" ];
+  prePatch = ''
+    chmod +x meson_post_install.py
+    patchShebangs meson_post_install.py
+
+    substituteInPlace src/daemon.c --replace '"/usr/sbin/useradd"' '"${shadow}/bin/useradd"' \
+                                   --replace '"/usr/sbin/userdel"' '"${shadow}/bin/userdel"'
+    substituteInPlace src/user.c   --replace '"/usr/sbin/usermod"' '"${shadow}/bin/usermod"' \
+                                   --replace '"/usr/bin/chage"' '"${shadow}/bin/chage"' \
+                                   --replace '"/usr/bin/passwd"' '"${shadow}/bin/passwd"' \
+                                   --replace '"/bin/cat"' '"${coreutils}/bin/cat"'
+  '';
+
+  patches = [
+    ./no-create-dirs.patch
+    ./Disable-methods-that-change-files-in-etc.patch
+  ];
+
+  preFixup = ''
+    wrapProgram "$out/libexec/accounts-daemon" \
+      --run "${coreutils}/bin/mkdir -p /var/lib/AccountsService/users" \
+      --run "${coreutils}/bin/mkdir -p /var/lib/AccountsService/icons"
+  '';
+
+  meta = with stdenv.lib; {
+    description = "D-Bus interface for user account query and manipulation";
+    homepage = https://www.freedesktop.org/wiki/Software/AccountsService;
+    license = licenses.gpl3;
+    maintainers = with maintainers; [ pSub ];
+    platforms = with platforms; linux;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/accountsservice/no-create-dirs.patch b/nixpkgs/pkgs/development/libraries/accountsservice/no-create-dirs.patch
new file mode 100644
index 000000000000..ef1a59b0249f
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/accountsservice/no-create-dirs.patch
@@ -0,0 +1,15 @@
+diff --git a/meson_post_install.py b/meson_post_install.py
+index ba95055..17f7926 100644
+--- a/meson_post_install.py
++++ b/meson_post_install.py
+@@ -9,8 +9,8 @@ localstatedir = os.path.normpath(destdir + os.sep + sys.argv[1])
+ # FIXME: meson will not track the creation of these directories
+ #        https://github.com/mesonbuild/meson/blob/master/mesonbuild/scripts/uninstall.py#L39
+ dst_dirs = [
+-  os.path.join(localstatedir, 'lib', 'AccountsService', 'icons'),
+-  os.path.join(localstatedir, 'lib', 'AccountsService', 'users'),
++  #os.path.join(localstatedir, 'lib', 'AccountsService', 'icons'),
++  #os.path.join(localstatedir, 'lib', 'AccountsService', 'users'),
+ ]
+ 
+ for dst_dir in dst_dirs: