X-Git-Url: http://git.scottworley.com/auto-upgrade-with-pinch/blobdiff_plain/6a301e7274267c1c8ac096944b8e7ccb8859340a..8baa5ec5de960253e6ecff6f7bcb13bb25609261:/modules/auto-upgrade.nix?ds=sidebyside diff --git a/modules/auto-upgrade.nix b/modules/auto-upgrade.nix index 5f5fe3a..918b4a9 100644 --- a/modules/auto-upgrade.nix +++ b/modules/auto-upgrade.nix @@ -200,12 +200,16 @@ let hydrate ${config.system.build.nixos-rebuild}/bin/nixos-rebuild ${cfg.operation} sync while read user;do - remove_arg=-r - if [[ "$(userenv_query "$user" .otherPackagesAction)" == keep ]];then - remove_arg= - fi + configured_action=$(userenv_query "$user" .otherPackagesAction) + action= + case "$configured_action" in + keep) action=-i;; + remove) action=-ir;; + set-remove) action=--set;; + *) die "Unexpected otherPackagesAction $configured_action for user $user" + esac hydrate /run/wrappers/bin/sudo -u "$user" \ - ${pkgs.nix}/bin/nix-env -f '' $remove_arg -iA "$(userenv_query "$user" .package)" + ${pkgs.nix}/bin/nix-env -f '' "$action" -A "$(userenv_query "$user" .package)" sync done < <( config_query '.userEnvironments | keys []' ) ''}