Refactored machines

This commit is contained in:
Julien Malka 2021-12-20 19:04:15 +01:00
parent 1c6b3c4a33
commit f7b980f413
6 changed files with 15 additions and 38 deletions

40
flake.lock generated
View file

@ -31,21 +31,6 @@
"type": "github"
}
},
"hardware": {
"locked": {
"lastModified": 1639986101,
"narHash": "sha256-Ow0+pkY7qMw6lMAvR1mEdUT9svJnrkbaRoqp4bkMTpg=",
"owner": "NixOS",
"repo": "nixos-hardware",
"rev": "3f92db38374b2977aea8daf4c4fe2fa0eddbd60c",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixos-hardware",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
@ -125,11 +110,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1639876010,
"narHash": "sha256-naGsoUfsY92NaIGiFI8XFXBnesw8BQGe694xcfaLMDI=",
"lastModified": 1639966735,
"narHash": "sha256-FmVGFiyqE+pjQUTCTY0H75hqrnBnbEf3VVRB4dsd4KI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "395879c28386e1abf20c7ecacd45880759548391",
"rev": "d87b72206aadebe6722944f541f55d33fd7046fb",
"type": "github"
},
"original": {
@ -157,11 +142,11 @@
},
"nixpkgs_3": {
"locked": {
"lastModified": 1639891440,
"narHash": "sha256-FJxa6ObwOQKZy3VhwN5bJRzX+MV/Yq9WLHK/4jlPKrs=",
"lastModified": 1639989170,
"narHash": "sha256-REf0rqdJs6XIPo/zc/FhJMecggjEXi45QyiV207y30Y=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "e6377ff35544226392b49fa2cf05590f9f0c4b43",
"rev": "86453059bf8312f0f5bf1fe8a2f52da2be664489",
"type": "github"
},
"original": {
@ -173,11 +158,11 @@
},
"nur": {
"locked": {
"lastModified": 1639990555,
"narHash": "sha256-O8BvwcDT+htaYP4ujsNjx+hX5mxPwtfNJii5OYLOoHY=",
"lastModified": 1640022719,
"narHash": "sha256-QgqV98KfELeuO76jWwmgL5s3vcmfVq5YtiPC7bQuWwQ=",
"owner": "nix-community",
"repo": "NUR",
"rev": "7dd4caa60877e32dcdb5f24cf212133c98e7f163",
"rev": "9f9a80de1be8ab246b5eafd00de948a05a55b798",
"type": "github"
},
"original": {
@ -187,7 +172,6 @@
},
"root": {
"inputs": {
"hardware": "hardware",
"home-manager": "home-manager",
"homepage": "homepage",
"neovim-nightly-overlay": "neovim-nightly-overlay",
@ -198,11 +182,11 @@
},
"unstable": {
"locked": {
"lastModified": 1639876010,
"narHash": "sha256-naGsoUfsY92NaIGiFI8XFXBnesw8BQGe694xcfaLMDI=",
"lastModified": 1639966735,
"narHash": "sha256-FmVGFiyqE+pjQUTCTY0H75hqrnBnbEf3VVRB4dsd4KI=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "395879c28386e1abf20c7ecacd45880759548391",
"rev": "d87b72206aadebe6722944f541f55d33fd7046fb",
"type": "github"
},
"original": {

View file

@ -16,10 +16,6 @@
flake = false;
};
hardware = {
url = "github:NixOS/nixos-hardware";
};
unstable = {
url = "github:NixOS/nixpkgs/nixos-unstable";
};
@ -40,7 +36,7 @@
})
(builtins.attrNames (builtins.readDir ./modules)));
nixosConfigurations = builtins.mapAttrs (name: value: (mkMachine name value self.nixosModules)) (importConfig ./machines);
nixosConfigurations = builtins.mapAttrs (name: value: (mkMachine name value self.nixosModules)) (importConfig ./machines);
hydraJobs = (nixpkgs.lib.mapAttrs' (name: config:
nixpkgs.lib.nameValuePair "nixos-${name}"
config.config.system.build.toplevel) self.nixosConfigurations);

View file

@ -1,8 +1,7 @@
{ nixpkgs, home-manager, nixpkgs-unstable, inputs }:
with builtins;
let mapAttrNames = f: set:
listToAttrs (map (attr: { name = f attr; value = set.${attr}; }) (attrNames set));
let
overlay-unstable = final: prev: {
unstable = nixpkgs-unstable.legacyPackages.x86_64-linux;
};
@ -48,8 +47,6 @@ in
];
};
importConfig = path: (mapAttrNames (name: nixpkgs.lib.removeSuffix ".nix" name)) ((builtins.mapAttrs (name: value: import (path + "/${name}")) (builtins.readDir path)));
importConfig = with builtins; path: (mapAttrs (name: value: import (path + "/${name}/default.nix")) (readDir path));
}