diff --git a/pkgs/development/libraries/consolekit/commands.patch b/pkgs/development/libraries/consolekit/commands.patch new file mode 100644 index 00000000000..48b0d5d8cf6 --- /dev/null +++ b/pkgs/development/libraries/consolekit/commands.patch @@ -0,0 +1,33 @@ +This patch adds shutdown commands specific to NixOS, as NixOS does not have +a /sbin or /usr/sbin directory. In order not to have a dependency on the +package that provides "shutdown" when in an environment other than NixOS, +we'll make it depend on /var/run/current-system. + +Note: this patch does not compromise system security. Other systems than +NixOS should have already shutdown in the earlier directories being searched, +and otherwise /var/run is writable only be root. + +--- ConsoleKit-0.4.1/tools/linux/ck-system-restart.org 2012-02-13 11:29:57.352902568 +0100 ++++ ConsoleKit-0.4.1/tools/linux/ck-system-restart 2012-02-13 11:43:27.593317712 +0100 +@@ -7,6 +7,9 @@ + elif [ -x "/usr/sbin/shutdown" ] ; then + /usr/sbin/shutdown -r now + exit $? ++elif [ -x "/var/run/current-system/sw/sbin/shutdown" ] ; then ++ /var/run/current-system/sw/sbin/shutdown -r now ++ exit $? + else + exit 1 + fi +--- ConsoleKit-0.4.1/tools/linux/ck-system-stop.org 2012-02-13 11:30:06.228950934 +0100 ++++ ConsoleKit-0.4.1/tools/linux/ck-system-stop 2012-02-13 11:44:12.664563304 +0100 +@@ -7,6 +7,9 @@ + elif [ -x "/usr/sbin/shutdown" ] ; then + /usr/sbin/shutdown -h now + exit $? ++elif [ -x "/var/run/current-system/sw/sbin/shutdown" ] ; then ++ /var/run/current-system/sw/sbin/shutdown -h now ++ exit $? + else + exit 1 + fi diff --git a/pkgs/development/libraries/consolekit/default.nix b/pkgs/development/libraries/consolekit/default.nix index 5cebc5874bd..e9cedf18857 100644 --- a/pkgs/development/libraries/consolekit/default.nix +++ b/pkgs/development/libraries/consolekit/default.nix @@ -11,7 +11,9 @@ stdenv.mkDerivation rec { buildInputs = [ pkgconfig dbus_glib zlib pam glib libX11 polkit expat ]; patches = [ ./0001-Don-t-daemonize-when-activated.patch - ./0002-Don-t-take-bus-name-until-ready.patch ]; + ./0002-Don-t-take-bus-name-until-ready.patch + ./commands.patch # adds shutdown commands for NixOS to the list of shutdown commands + ]; # For console-kit to get the rpath to libgcc_s, needed for pthread_cancel to work NIX_LDFLAGS = "-lgcc_s";