improve the handling of the different nixpkgs version in flake.nix
This commit is contained in:
parent
0060b2e6b1
commit
24e8170453
1 changed files with 22 additions and 20 deletions
36
flake.nix
36
flake.nix
|
@ -12,28 +12,30 @@
|
||||||
outputs = { self, nixpkgs-25-05, nixpkgs-unstable, deploy-rs, agenix }: let
|
outputs = { self, nixpkgs-25-05, nixpkgs-unstable, deploy-rs, agenix }: let
|
||||||
system = "x86_64-linux";
|
system = "x86_64-linux";
|
||||||
|
|
||||||
|
# Mapping version identifiers to nixpkgs
|
||||||
|
nixpkgsMap = {
|
||||||
|
"25.05" = nixpkgs-25-05;
|
||||||
|
"unstable" = nixpkgs-unstable;
|
||||||
|
};
|
||||||
|
|
||||||
|
importPkgs = version: overlays: import nixpkgsMap.${version} {
|
||||||
|
inherit system;
|
||||||
|
overlays = if overlays == null then [] else overlays;
|
||||||
|
};
|
||||||
|
|
||||||
# Unmodified nixpkgs
|
# Unmodified nixpkgs
|
||||||
pkgs-25-05 = import nixpkgs-25-05 { inherit system; };
|
getNixpkgs = version: importPkgs version [];
|
||||||
pkgs-unstable = import nixpkgs-unstable { inherit system; };
|
|
||||||
|
|
||||||
# nixpkgs with deploy-rs overlay but force the nixpkgs package
|
# nixpkgs with deploy-rs overlay but force the nixpkgs package
|
||||||
deployPkgs-25-05 = import nixpkgs-25-05 {
|
getDeployPkgs = version: importPkgs version [
|
||||||
inherit system;
|
|
||||||
overlays = [
|
|
||||||
deploy-rs.overlays.default
|
deploy-rs.overlays.default
|
||||||
(self: super: { deploy-rs = { inherit (pkgs-25-05) deploy-rs; lib = super.deploy-rs.lib; }; })
|
(self: super: {
|
||||||
];
|
deploy-rs = {
|
||||||
|
inherit (getNixpkgs version) deploy-rs;
|
||||||
|
lib = super.deploy-rs.lib;
|
||||||
};
|
};
|
||||||
deployPkgs-unstable = import nixpkgs-unstable {
|
})
|
||||||
inherit system;
|
|
||||||
overlays = [
|
|
||||||
deploy-rs.overlays.default
|
|
||||||
(self: super: { deploy-rs = { inherit (pkgs-unstable) deploy-rs; lib = super.deploy-rs.lib; }; })
|
|
||||||
];
|
];
|
||||||
};
|
|
||||||
|
|
||||||
getDeployPkgs = ver: if ver == "25.05" then deployPkgs-25-05 else deployPkgs-unstable;
|
|
||||||
getNixpkgs = ver: if ver == "25.05" then nixpkgs-25-05 else nixpkgs-unstable;
|
|
||||||
|
|
||||||
nodes = import ./nodes.nix;
|
nodes = import ./nodes.nix;
|
||||||
mapping = import ./mapping.nix;
|
mapping = import ./mapping.nix;
|
||||||
|
@ -57,7 +59,7 @@
|
||||||
|
|
||||||
in {
|
in {
|
||||||
nixosConfigurations = builtins.mapAttrs (name: config:
|
nixosConfigurations = builtins.mapAttrs (name: config:
|
||||||
(getNixpkgs config.ver).lib.nixosSystem {
|
nixpkgsMap.${config.ver}.lib.nixosSystem {
|
||||||
system = config.system;
|
system = config.system;
|
||||||
modules = getModulesForHost "${name}" ++ defaultModules ++ [{ hostName = "${name}"; }];
|
modules = getModulesForHost "${name}" ++ defaultModules ++ [{ hostName = "${name}"; }];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue