diff --git a/modules/home-environment.nix b/modules/home-environment.nix index 1ea698813..da0cc68e9 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -248,6 +248,12 @@ in activationBinPaths = lib.makeBinPath [ pkgs.bash pkgs.coreutils + pkgs.diffutils # For `cmp` and `diff`. + pkgs.findutils + pkgs.gnugrep + pkgs.gnused + pkgs.ncurses # For `tput`. + pkgs.nix ]; sf = pkgs.writeText "activation-script" '' diff --git a/modules/misc/news.nix b/modules/misc/news.nix index 0c899ad60..f14248ecb 100644 --- a/modules/misc/news.nix +++ b/modules/misc/news.nix @@ -351,6 +351,25 @@ in before that date. ''; } + + { + time = "2017-10-20T12:15:27+00:00"; + condition = with config.systemd.user; + services != {} || sockets != {} || targets != {} || timers != {}; + message = '' + Home Manager's interaction with systemd is now done using + 'systemctl' from Nixpkgs, not the 'systemctl' in '$PATH'. + + If you are using a distribution whose systemd is + incompatible with the version in Nixpkgs then you can + override this behavior by adding + + systemd.user.systemctlPath = "/usr/bin/systemctl" + + to your configuration. Home Manager will then use your + chosen version. + ''; + } ]; }; } diff --git a/modules/programs/info.nix b/modules/programs/info.nix index c3b4b5942..5f75ec927 100644 --- a/modules/programs/info.nix +++ b/modules/programs/info.nix @@ -64,6 +64,8 @@ in "${cfg.homeInfoDirLocation}\${INFOPATH:+:}\${INFOPATH}"; home.activation.createHomeInfoDir = dagEntryAfter ["installPackages"] '' + oPATH=$PATH + export PATH="${lib.makeBinPath [ pkgs.gzip ]}''${PATH:+:}$PATH" $DRY_RUN_CMD mkdir -p "${cfg.homeInfoDirLocation}" $DRY_RUN_CMD rm -f "${cfg.homeInfoDirLocation}/dir" if [[ -d "${homeInfoPath}" ]]; then @@ -71,6 +73,8 @@ in -exec $DRY_RUN_CMD ${infoPkg}/bin/install-info '{}' \ "${cfg.homeInfoDirLocation}/dir" \; fi + export PATH="$oPATH" + unset oPATH ''; home.packages = [ infoPkg ]; diff --git a/modules/services/polybar.nix b/modules/services/polybar.nix index 351626f8b..8e92b4aff 100644 --- a/modules/services/polybar.nix +++ b/modules/services/polybar.nix @@ -142,7 +142,7 @@ in home.activation.applyPolybar = dagEntryAfter [ "reloadSystemD" ] '' if [[ -v polybarChanged && -v DISPLAY ]]; then echo "Restarting polybar" - systemctl --user restart polybar.service + ${config.systemd.user.systemctlPath} --user restart polybar.service fi ''; }; diff --git a/modules/systemd.nix b/modules/systemd.nix index d77c0076a..066304773 100644 --- a/modules/systemd.nix +++ b/modules/systemd.nix @@ -49,6 +49,17 @@ in options = { systemd.user = { + systemctlPath = mkOption { + default = "${pkgs.systemd}/bin/systemctl"; + defaultText = "\${pkgs.systemd}/bin/systemctl"; + type = types.str; + description = '' + Absolute path to the systemctl tool. This + option may need to be set if running Home Manager on a + non-NixOS distribution. + ''; + }; + services = mkOption { default = {}; type = types.attrs; @@ -157,7 +168,7 @@ in local -a toRestart=( ) for f in ''${maybeRestart[@]} ; do - if systemctl --quiet --user is-active "$f" \ + if ${cfg.systemctlPath} --quiet --user is-active "$f" \ && ! cmp --quiet \ "$oldUserServicePath/$f" \ "$newUserServicePath/$f" ; then @@ -187,7 +198,7 @@ in fi } - $DRY_RUN_CMD systemctl --user daemon-reload + $DRY_RUN_CMD ${cfg.systemctlPath} --user daemon-reload systemdPostReload ''; })