Upgrade NixOS stable to 22.11 and upgrade packages
This commit is contained in:
@@ -10,14 +10,8 @@ let
|
||||
config',
|
||||
defs,
|
||||
}:
|
||||
let
|
||||
# TODO: Remove this backwards compatibility when 22.11 becomes stable
|
||||
# https://github.com/nix-community/home-manager/blob/master/docs/release-notes/rl-2211.adoc
|
||||
newCfgFn = (homeStateVersion' config'.home-manager) == "22.11";
|
||||
modArg = if newCfgFn then "modules" else "extraModules";
|
||||
in
|
||||
# homeManagerConfiguration doesn't allow us to set lib directly (inherits from passed pkgs)
|
||||
hmFlakes.${config'.home-manager}.lib.homeManagerConfiguration ({
|
||||
hmFlakes.${config'.home-manager}.lib.homeManagerConfiguration {
|
||||
# Passing pkgs here doesn't set the global pkgs, just where it'll be imported from (and where the global lib is
|
||||
# derived from). We want home-manager to import pkgs itself so it'll apply config and overlays modularly. Any config
|
||||
# and overlays previously applied will be passed on by `homeManagerConfiguration` though. In fact, because of weird
|
||||
@@ -25,7 +19,7 @@ let
|
||||
# TODO: Check if this is fixed in future.
|
||||
pkgs = pkgs'.${config'.nixpkgs}.${config'.system} // { config = { }; };
|
||||
extraSpecialArgs = { inherit inputs pkgsFlakes; pkgsFlake = pkgsFlakes.${config'.nixpkgs}; };
|
||||
"${modArg}" = (attrValues cfg.modules) ++ [
|
||||
modules = (attrValues cfg.modules) ++ [
|
||||
{
|
||||
warnings = flatten [
|
||||
(optional (config'.nixpkgs != config'.home-manager)
|
||||
@@ -38,19 +32,13 @@ let
|
||||
pkgs' = mapAttrs (_: p: p.${config'.system}) pkgs';
|
||||
};
|
||||
|
||||
home = mkIf newCfgFn {
|
||||
home = {
|
||||
inherit (config') homeDirectory username;
|
||||
};
|
||||
}
|
||||
(homeStateVersion config'.home-manager)
|
||||
] ++ (if newCfgFn then defs else tail defs);
|
||||
} // (optionalAttrs (!newCfgFn) {
|
||||
inherit (config') system homeDirectory username;
|
||||
|
||||
# Pull the first def as `configuration` and add any others to `extraModules` for the old style config (they should
|
||||
# end up in the same list of modules to evaluate anyway)
|
||||
configuration = head defs;
|
||||
}));
|
||||
] ++ defs;
|
||||
};
|
||||
|
||||
homeOpts = with lib.types; { ... }@args:
|
||||
let
|
||||
|
Reference in New Issue
Block a user