diff --git a/modules/files.nix b/modules/files.nix index 8489fe265..f2e380ea3 100644 --- a/modules/files.nix +++ b/modules/files.nix @@ -1,4 +1,4 @@ -{ pkgs, config, lib, ... }: +{ pkgs, activationPkgs, config, lib, ... }: with lib; @@ -79,7 +79,7 @@ in (mapAttrsToList (n: v: v.target) (filterAttrs (n: v: v.force) cfg)); - check = config.home.activationPackageSet.writeText "check" '' + check = activationPkgs.writeText "check" '' ${config.lib.bash.initHomeManagerLib} # A symbolic link whose target path matches this pattern will be @@ -168,7 +168,7 @@ in # source and target generation. home.activation.linkGeneration = hm.dag.entryAfter ["writeBoundary"] ( let - link = config.home.activationPackageSet.writeShellScript "link" '' + link = activationPkgs.writeShellScript "link" '' ${config.lib.bash.initHomeManagerLib} newGenFiles="$1" diff --git a/modules/home-environment.nix b/modules/home-environment.nix index 6f704b33e..687ba933b 100644 --- a/modules/home-environment.nix +++ b/modules/home-environment.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, activationPkgs, ... }: with lib; @@ -425,11 +425,6 @@ in description = "The package containing the complete activation script."; }; - home.activationPackageSet = mkOption { - type = with types; lazyAttrsOf anything; - description = "The package set to be used to in the complete activation script."; - }; - home.extraActivationPath = mkOption { internal = true; type = types.listOf types.package; @@ -654,7 +649,6 @@ in source ${../lib/bash/home-manager.sh} ''; - home.activationPackageSet = lib.mkDefault pkgs; home.activationPackage = let mkCmd = res: '' @@ -672,7 +666,7 @@ in # Programs that always should be available on the activation # script's PATH. activationBinPaths = lib.makeBinPath ( - with cfg.activationPackageSet; [ + with activationPkgs; [ bash coreutils diffutils # For `cmp` and `diff`. @@ -691,11 +685,11 @@ in if config.nix.enable && config.nix.package != null then ":${config.nix.package}/bin" else - ":$(${cfg.activationPackageSet.coreutils}/bin/dirname $(${cfg.activationPackageSet.coreutils}/bin/readlink -m $(type -p nix-env)))" + ":$(${activationPkgs.coreutils}/bin/dirname $(${activationPkgs.coreutils}/bin/readlink -m $(type -p nix-env)))" ) + optionalString (!cfg.emptyActivationPath) "\${PATH:+:}$PATH"; - activationScript = cfg.activationPackageSet.writeShellScript "activation-script" '' + activationScript = activationPkgs.writeShellScript "activation-script" '' set -eu set -o pipefail diff --git a/modules/misc/dconf.nix b/modules/misc/dconf.nix index 9e86d2fa9..923c60c57 100644 --- a/modules/misc/dconf.nix +++ b/modules/misc/dconf.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, activationPkgs, ... }: with lib; @@ -85,43 +85,39 @@ in { ''; home.activation.dconfSettings = hm.dag.entryAfter [ "installPackages" ] (let - iniFile = config.home.activationPackageSet.writeText "hm-dconf.ini" - (toDconfIni cfg.settings); + iniFile = + activationPkgs.writeText "hm-dconf.ini" (toDconfIni cfg.settings); statePath = "state/${stateDconfKeys.name}"; - cleanup = - config.home.activationPackageSet.writeShellScript "dconf-cleanup" '' - set -euo pipefail + cleanup = activationPkgs.writeShellScript "dconf-cleanup" '' + set -euo pipefail - ${config.lib.bash.initHomeManagerLib} + ${config.lib.bash.initHomeManagerLib} - PATH=${ - makeBinPath [ - config.home.activationPackageSet.dconf - config.home.activationPackageSet.jq - ] - }''${PATH:+:}$PATH + PATH=${ + makeBinPath [ activationPkgs.dconf activationPkgs.jq ] + }''${PATH:+:}$PATH - oldState="$1" - newState="$2" + oldState="$1" + newState="$2" - # Can't do cleanup if we don't know the old state. - if [[ ! -f $oldState ]]; then - exit 0 - fi + # Can't do cleanup if we don't know the old state. + if [[ ! -f $oldState ]]; then + exit 0 + fi - # Reset all keys that are present in the old generation but not the new - # one. - jq -r -n \ - --slurpfile old "$oldState" \ - --slurpfile new "$newState" \ - '($old[] - $new[])[]' \ - | while read -r key; do - verboseEcho "Resetting dconf key \"$key\"" - run $DCONF_DBUS_RUN_SESSION dconf reset "$key" - done - ''; + # Reset all keys that are present in the old generation but not the new + # one. + jq -r -n \ + --slurpfile old "$oldState" \ + --slurpfile new "$newState" \ + '($old[] - $new[])[]' \ + | while read -r key; do + verboseEcho "Resetting dconf key \"$key\"" + run $DCONF_DBUS_RUN_SESSION dconf reset "$key" + done + ''; in '' if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then export DCONF_DBUS_RUN_SESSION="" diff --git a/modules/misc/xfconf.nix b/modules/misc/xfconf.nix index 9210eda4a..08dc09280 100644 --- a/modules/misc/xfconf.nix +++ b/modules/misc/xfconf.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, activationPkgs, ... }: with lib; @@ -106,7 +106,7 @@ in { home.activation.xfconfSettings = hm.dag.entryAfter [ "installPackages" ] (let mkCommand = channel: property: value: '' - run ${cfg.activationPackageSet.xfce.xfconf}/bin/xfconf-query \ + run ${activationPkgs.xfce.xfconf}/bin/xfconf-query \ ${ escapeShellArgs ([ "-c" channel "-p" "/${property}" ] ++ (if value == null then @@ -120,13 +120,13 @@ in { (channel: properties: mapAttrsToList (mkCommand channel) properties) cfg.settings; - load = cfg.activationPackageSet.writeShellScript "load-xfconf" + load = activationPkgs.writeShellScript "load-xfconf" (concatMapStrings concatStrings commands); in '' if [[ -v DBUS_SESSION_BUS_ADDRESS ]]; then export DBUS_RUN_SESSION_CMD="" else - export DBUS_RUN_SESSION_CMD="${cfg.activationPackageSet.dbus}/bin/dbus-run-session --dbus-daemon=${pkgs.dbus}/bin/dbus-daemon" + export DBUS_RUN_SESSION_CMD="${activationPkgs.dbus}/bin/dbus-run-session --dbus-daemon=${pkgs.dbus}/bin/dbus-daemon" fi run $DBUS_RUN_SESSION_CMD ${load} diff --git a/modules/modules.nix b/modules/modules.nix index d557dc1b3..86896dc45 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -395,6 +395,7 @@ let else ); _module.args.pkgs = lib.mkDefault pkgs; + _module.args.activationPkgs = lib.mkDefault pkgs; _module.check = check; lib = lib.hm; } // optionalAttrs useNixpkgsModule { diff --git a/modules/systemd.nix b/modules/systemd.nix index 0fa75c807..c47d7b324 100644 --- a/modules/systemd.nix +++ b/modules/systemd.nix @@ -1,4 +1,4 @@ -{ config, lib, pkgs, ... }: +{ config, lib, pkgs, activationPkgs, ... }: let @@ -314,7 +314,7 @@ in { ''; legacy = '' PATH=${dirOf cfg.systemctlPath}:$PATH \ - ${cfg.activationPackageSet.ruby}/bin/ruby ${./systemd-activate.rb} \ + ${activationPkgs.ruby}/bin/ruby ${./systemd-activate.rb} \ "''${oldGenPath=}" "$newGenPath" "${servicesStartTimeoutMs}" ''; sd-switch = let