Update nixpkgs and home-manager

This commit is contained in:
Jack O'Sullivan 2022-07-10 14:15:12 +01:00
parent c68a48eb34
commit 3d49672740
3 changed files with 42 additions and 82 deletions

87
flake.lock generated
View File

@ -79,22 +79,6 @@
"type": "github"
}
},
"flake-compat_2": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-utils": {
"locked": {
"lastModified": 1642700792,
@ -132,11 +116,11 @@
]
},
"locked": {
"lastModified": 1654113405,
"narHash": "sha256-VpK+0QaWG2JRgB00lw77N9TjkE3ec0iMYIX1TzGpxa4=",
"lastModified": 1656169755,
"narHash": "sha256-Nlnm4jeQWEGjYrE6hxi/7HYHjBSZ/E0RtjCYifnNsWk=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "ac2287df5a2d6f0a44bbcbd11701dbbf6ec43675",
"rev": "4a3d01fb53f52ac83194081272795aa4612c2381",
"type": "github"
},
"original": {
@ -147,20 +131,17 @@
},
"home-manager-unstable": {
"inputs": {
"flake-compat": "flake-compat_2",
"nixpkgs": [
"nixpkgs-unstable"
],
"nmd": "nmd",
"nmt": "nmt",
"utils": "utils_2"
},
"locked": {
"lastModified": 1655381586,
"narHash": "sha256-2IrSYYjxoT+iOihSiH0Elo9wzjbHjDSH+qPvI5BklCs=",
"lastModified": 1657396086,
"narHash": "sha256-4cQ6hEuewWoFkTBlu211JGxPQQ1Zyli8oEq1cu7cVeA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "1de492f6f8e9937c822333739c5d5b20d93bf49f",
"rev": "c645cc9f82c7753450d1fa4d1bc73b64960a9d7a",
"type": "github"
},
"original": {
@ -186,11 +167,11 @@
},
"nixpkgs-mine": {
"locked": {
"lastModified": 1655405439,
"narHash": "sha256-ijVfodPEpcBwOqQcirEMqmDHn5B4nSGP7E7JMjt5dD8=",
"lastModified": 1657454943,
"narHash": "sha256-QVLg+HI/frwiz5KQkK9ZCcPV3qi3AZc1PLgKdjcwiSg=",
"owner": "devplayer0",
"repo": "nixpkgs",
"rev": "6c8d1a23aec7d56ec3b1cb3186499b9b5e112466",
"rev": "7c2a9351cd70040550a67766e3be83e029edf521",
"type": "github"
},
"original": {
@ -202,11 +183,11 @@
},
"nixpkgs-mine-stable": {
"locked": {
"lastModified": 1655405424,
"narHash": "sha256-vSA7qvLOfhNCl6BGEaU4sdhWznvScaHVl4X6nI7dDds=",
"lastModified": 1657454980,
"narHash": "sha256-sZ3VGlnbv/VSZOCQ6POK71PM6Af3lkYAW2ep0W1OYF0=",
"owner": "devplayer0",
"repo": "nixpkgs",
"rev": "15bfe94e7299b480148676778ac2f19714c45799",
"rev": "0c9ac96ae3e8fa14eaedb9d12111a6c37ef34349",
"type": "github"
},
"original": {
@ -218,11 +199,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1655278232,
"narHash": "sha256-H6s7tnHYiDKFCcLADS4sl1sUq0dDJuRQXCieguk/6SA=",
"lastModified": 1657296039,
"narHash": "sha256-Ghh39+aS+pw5sTP/ZO8VIKE6sBhMadDaQZtf+3yu4Vc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8b538fcb329a7bc3d153962f17c509ee49166973",
"rev": "71d7a4c037dc4f3e98d5c4a81b941933cf5bf675",
"type": "github"
},
"original": {
@ -233,11 +214,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1655306633,
"narHash": "sha256-nv4FfWWV/dEelByjXJtJkoDPOHIsKfLq50RN3Hqq5Yk=",
"lastModified": 1657265485,
"narHash": "sha256-PUQ9C7mfi0/BnaAUX2R/PIkoNCb/Jtx9EpnhMBNrO/o=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "b1957596ff1c7aa8c55c4512b7ad1c9672502e8e",
"rev": "b39924fc7764c08ae3b51beef9a3518c414cdb7d",
"type": "github"
},
"original": {
@ -246,38 +227,6 @@
"type": "indirect"
}
},
"nmd": {
"flake": false,
"locked": {
"lastModified": 1653339422,
"narHash": "sha256-8nc7lcYOgih3YEmRMlBwZaLLJYpLPYKBlewqHqx8ieg=",
"owner": "rycee",
"repo": "nmd",
"rev": "9e7a20e6ee3f6751f699f79c0b299390f81f7bcd",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmd",
"type": "gitlab"
}
},
"nmt": {
"flake": false,
"locked": {
"lastModified": 1648075362,
"narHash": "sha256-u36WgzoA84dMVsGXzml4wZ5ckGgfnvS0ryzo/3zn/Pc=",
"owner": "rycee",
"repo": "nmt",
"rev": "d83601002c99b78c89ea80e5e6ba21addcfe12ae",
"type": "gitlab"
},
"original": {
"owner": "rycee",
"repo": "nmt",
"type": "gitlab"
}
},
"root": {
"inputs": {
"agenix": "agenix",

View File

@ -1,8 +1,8 @@
{ lib, hmFlakes, inputs, pkgs', config, ... }:
let
inherit (builtins) head tail mapAttrs attrValues;
inherit (lib) flatten optional mkOption mkDefault mkOptionType;
inherit (lib.my) homeStateVersion mkOpt' commonOpts inlineModule' applyAssertions;
inherit (lib) flatten optional optionalAttrs mkOption mkDefault mkOptionType mkIf;
inherit (lib.my) homeStateVersion' homeStateVersion mkOpt' commonOpts inlineModule' applyAssertions;
cfg = config.home-manager;
@ -10,12 +10,14 @@ 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 {
inherit (config') system homeDirectory username;
# Pull the first def as `configuration` and add any others to `extraModules` (they should end up in the same list
# of modules to evaluate anyway)
configuration = head defs;
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
@ -23,7 +25,7 @@ let
# TODO: Check if this is fixed in future.
pkgs = pkgs'.${config'.nixpkgs}.${config'.system} // { config = { }; };
extraSpecialArgs = { inherit inputs; };
extraModules = (attrValues cfg.modules) ++ [
"${modArg}" = (attrValues cfg.modules) ++ [
{
warnings = flatten [
(optional (config'.nixpkgs != config'.home-manager)
@ -35,10 +37,20 @@ let
_module.args = {
pkgs' = mapAttrs (_: p: p.${config'.system}) pkgs';
};
home = mkIf newCfgFn {
inherit (config') homeDirectory username;
};
}
(homeStateVersion config'.home-manager)
] ++ (tail defs);
};
] ++ (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;
}));
homeOpts = with lib.types; { ... }@args:
let

View File

@ -88,11 +88,10 @@ rec {
then throw "\nFailed assertions:\n${concatStringsSep "\n" (map (x: "- ${x}") failedAssertions)}"
else showWarnings config.warnings res;
homeStateVersion' = hmBranch: (if (hmBranch == "stable" || hmBranch == "mine-stable") then "22.05" else "22.11");
homeStateVersion = hmBranch: {
# The flake passes a default setting, but we don't care about that
# Currently don't need any logic here, but we might need to use a newer version later
#home.stateVersion = mkForce (if (hmBranch == "stable" || hmBranch == "mine-stable") then "22.05" else "22.11");
home.stateVersion = mkForce "22.05";
home.stateVersion = mkForce (homeStateVersion' hmBranch);
};
commonOpts = with types; {