From df05618f2a075c2c727bdcb6d44741d5d5c2ef16 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Wed, 5 Sep 2018 22:48:47 +0200 Subject: [PATCH] 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 --- nixos/modules/system/activation/switch-to-configuration.pl | 2 +- nixos/modules/system/activation/top-level.nix | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) 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;