about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2018-09-05 22:48:47 +0200
committerxeji <36407913+xeji@users.noreply.github.com>2018-09-05 22:48:47 +0200
commitdf05618f2a075c2c727bdcb6d44741d5d5c2ef16 (patch)
tree12d416e208eb76b804c9b96827b9adbdf70407c1
parentf70dc57ad3b63211cdc348bb3346139519aefced (diff)
downloadnixlib-df05618f2a075c2c727bdcb6d44741d5d5c2ef16.tar
nixlib-df05618f2a075c2c727bdcb6d44741d5d5c2ef16.tar.gz
nixlib-df05618f2a075c2c727bdcb6d44741d5d5c2ef16.tar.bz2
nixlib-df05618f2a075c2c727bdcb6d44741d5d5c2ef16.tar.lz
nixlib-df05618f2a075c2c727bdcb6d44741d5d5c2ef16.tar.xz
nixlib-df05618f2a075c2c727bdcb6d44741d5d5c2ef16.tar.zst
nixlib-df05618f2a075c2c727bdcb6d44741d5d5c2ef16.zip
nixos/activation: fix activation script for non-POSIX shells (#46042)
This fixes an issue with shells like fish that are not fully POSIX
compliant. The syntax `ENV=val cmd' doesn't work properly in there.

This issue has been addressed in #45932 and #45945, however it has been
recommended to use a single shell (`stdenv.shell' which is either
`bash' or `sh') to significantly reduce the maintenance overload in the
future.

See https://github.com/NixOS/nixpkgs/issues/45897#issuecomment-417923464

Fixes #45897

/cc @FRidh @xaverdh @etu
-rw-r--r--nixos/modules/system/activation/switch-to-configuration.pl2
-rw-r--r--nixos/modules/system/activation/top-level.nix1
2 files changed, 2 insertions, 1 deletions
diff --git a/nixos/modules/system/activation/switch-to-configuration.pl b/nixos/modules/system/activation/switch-to-configuration.pl
index b3fe6caf62dc..c3e469e4b8a1 100644
--- a/nixos/modules/system/activation/switch-to-configuration.pl
+++ b/nixos/modules/system/activation/switch-to-configuration.pl
@@ -419,7 +419,7 @@ while (my $f = <$listActiveUsers>) {
     my ($uid, $name) = ($+{uid}, $+{user});
     print STDERR "reloading user units for $name...\n";
 
-    system("su", "-l", $name, "-c", "XDG_RUNTIME_DIR=/run/user/$uid @systemd@/bin/systemctl --user daemon-reload");
+    system("su", "-s", "@shell@", "-l", $name, "-c", "XDG_RUNTIME_DIR=/run/user/$uid @systemd@/bin/systemctl --user daemon-reload");
 }
 
 close $listActiveUsers;
diff --git a/nixos/modules/system/activation/top-level.nix b/nixos/modules/system/activation/top-level.nix
index fff88e2c2bf3..9797ef641e4f 100644
--- a/nixos/modules/system/activation/top-level.nix
+++ b/nixos/modules/system/activation/top-level.nix
@@ -115,6 +115,7 @@ let
 
       inherit (pkgs) utillinux coreutils;
       systemd = config.systemd.package;
+      inherit (pkgs.stdenv) shell;
 
       inherit children;
       kernelParams = config.boot.kernelParams;