mirror of
https://github.com/nix-community/nix-on-droid.git
synced 2025-11-08 19:46:07 +01:00
home-manager: remove support for 19.09 releases
This commit is contained in:
parent
1ad8c7ac48
commit
43fafe1736
1 changed files with 28 additions and 55 deletions
|
|
@ -7,11 +7,6 @@ with lib;
|
|||
let
|
||||
cfg = config.home-manager;
|
||||
|
||||
tryEval = builtins.tryEval (home-manager.path + "/modules/modules.nix");
|
||||
assertionNixpkgs = types ? submoduleWith;
|
||||
assertionHomeManager = tryEval.success && builtins.functionArgs (import tryEval.value) ? useNixpkgsModule;
|
||||
assertion = assertionNixpkgs && assertionHomeManager;
|
||||
|
||||
extendedLib = import (home-manager.path + "/modules/lib/stdlib-extended.nix") pkgs.lib;
|
||||
|
||||
hmModule = types.submoduleWith {
|
||||
|
|
@ -54,10 +49,7 @@ in
|
|||
};
|
||||
|
||||
config = mkOption {
|
||||
type =
|
||||
if assertion
|
||||
then types.nullOr hmModule
|
||||
else types.unspecified;
|
||||
type = types.nullOr hmModule;
|
||||
default = null;
|
||||
description = "Home Manager configuration.";
|
||||
};
|
||||
|
|
@ -81,56 +73,37 @@ in
|
|||
|
||||
###### implementation
|
||||
|
||||
config = mkIf (cfg.config != null) (mkMerge [
|
||||
config = mkIf (cfg.config != null) {
|
||||
|
||||
{
|
||||
assertions = [
|
||||
{
|
||||
assertion = assertionNixpkgs;
|
||||
message = "You are currently using release-19.09 branch or older of nixpkgs, you need "
|
||||
+ "to update to the release-20.03 channel or newer.";
|
||||
}
|
||||
{
|
||||
assertion = assertionHomeManager;
|
||||
message = "You are currently using release-19.09 branch or older of home-manager, you need "
|
||||
+ "to update to the release-20.03 channel or newer.";
|
||||
}
|
||||
];
|
||||
}
|
||||
inherit (cfg.config) assertions warnings;
|
||||
|
||||
# hack to determine if cfg.config is a valid home-manager config
|
||||
(mkIf (cfg.config ? home && cfg.config.home ? activationPackage) {
|
||||
|
||||
inherit (cfg.config) assertions warnings;
|
||||
|
||||
build = {
|
||||
activationBefore = mkIf cfg.useUserPackages {
|
||||
setPriorityHomeManagerPath = ''
|
||||
if nix-env -q | grep '^home-manager-path$'; then
|
||||
$DRY_RUN_CMD nix-env $VERBOSE_ARG --set-flag priority 120 home-manager-path
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
activationAfter.homeManager = concatStringsSep " " (
|
||||
optional
|
||||
(cfg.backupFileExtension != null)
|
||||
"HOME_MANAGER_BACKUP_EXT='${cfg.backupFileExtension}'"
|
||||
++ [ "${cfg.config.home.activationPackage}/activate" ]
|
||||
);
|
||||
build = {
|
||||
activationBefore = mkIf cfg.useUserPackages {
|
||||
setPriorityHomeManagerPath = ''
|
||||
if nix-env -q | grep '^home-manager-path$'; then
|
||||
$DRY_RUN_CMD nix-env $VERBOSE_ARG --set-flag priority 120 home-manager-path
|
||||
fi
|
||||
'';
|
||||
};
|
||||
|
||||
environment.packages = mkIf cfg.useUserPackages cfg.config.home.packages;
|
||||
activationAfter.homeManager = concatStringsSep " " (
|
||||
optional
|
||||
(cfg.backupFileExtension != null)
|
||||
"HOME_MANAGER_BACKUP_EXT='${cfg.backupFileExtension}'"
|
||||
++ [ "${cfg.config.home.activationPackage}/activate" ]
|
||||
);
|
||||
};
|
||||
|
||||
# home-manager has a quirk redefining the profile location
|
||||
# to "/etc/profiles/per-user/${cfg.username}" if useUserPackages is on.
|
||||
# https://github.com/nix-community/home-manager/blob/0006da1381b87844c944fe8b925ec864ccf19348/modules/home-environment.nix#L414
|
||||
# Fortunately, it's not that hard to us to workaround with just a symlink.
|
||||
environment.etc = mkIf cfg.useUserPackages {
|
||||
"profiles/per-user/${config.user.userName}".source =
|
||||
builtins.toPath "${config.user.home}/.nix-profile";
|
||||
};
|
||||
})
|
||||
environment.packages = mkIf cfg.useUserPackages cfg.config.home.packages;
|
||||
|
||||
]);
|
||||
# home-manager has a quirk redefining the profile location
|
||||
# to "/etc/profiles/per-user/${cfg.username}" if useUserPackages is on.
|
||||
# https://github.com/nix-community/home-manager/blob/0006da1381b87844c944fe8b925ec864ccf19348/modules/home-environment.nix#L414
|
||||
# Fortunately, it's not that hard to us to workaround with just a symlink.
|
||||
environment.etc = mkIf cfg.useUserPackages {
|
||||
"profiles/per-user/${config.user.userName}".source =
|
||||
builtins.toPath "${config.user.home}/.nix-profile";
|
||||
};
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue