mirror of
https://github.com/nix-community/home-manager
synced 2024-11-24 03:59:46 +01:00
home-manager: remove manually installed home-manager
If the `home-manager` module is enabled then check if the
`home-manager` package is installed using `nix-env -i` and if so then
it is automatically uninstalled before the new package environment,
which includes home-manager, is installed.
(cherry picked from commit 2e257f40e6
)
This commit is contained in:
parent
e9cc225cbb
commit
0ef0be8ffb
1 changed files with 13 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
|
||||
with lib;
|
||||
with import ../lib/dag.nix;
|
||||
|
||||
let
|
||||
|
||||
|
@ -35,5 +36,17 @@ in
|
|||
inherit (cfg) modulesPath;
|
||||
})
|
||||
];
|
||||
|
||||
# Uninstall manually installed home-manager, if such exists.
|
||||
# Without this a file collision error will be printed.
|
||||
home.activation.uninstallHomeManager =
|
||||
dagEntryBetween [ "installPackages" ] [ "writeBoundary" ] ''
|
||||
if nix-env -q | grep -q '^home-manager$' ; then
|
||||
$DRY_RUN_CMD nix-env -e home-manager
|
||||
|
||||
echo "You can now remove the 'home-manager' entry in"
|
||||
echo "'~/.config/nixpkgs/config.nix', if you want."
|
||||
fi
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue