diff options
author | sinanmohd <sinan@sinanmohd.com> | 2023-12-03 16:40:46 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2023-12-03 17:33:41 +0530 |
commit | cf27440717b48a9a65bc11c1277b8af806023327 (patch) | |
tree | 815a8358b1a8f077bf597cc55aa1ff1a08df093f | |
parent | 53c634233aa21c04c461af69cd819e05c3050eff (diff) |
flake: refactor
-rw-r--r-- | flake.nix | 41 |
1 files changed, 17 insertions, 24 deletions
@@ -1,5 +1,5 @@ { - description = "reproducible nixos configuration with flakes"; + description = "sinan's reproducible nixos systems"; inputs = { nixpkgs.url = "github:NixOs/nixpkgs/nixos-unstable"; @@ -9,29 +9,22 @@ }; }; - outputs = { self, nixpkgs, sops-nix }: { - nixosConfigurations = { - cez = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./hosts/cez/configuration.nix - sops-nix.nixosModules.sops - ]; - }; - kay = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./hosts/kay/configuration.nix - sops-nix.nixosModules.sops - ]; - }; - mox = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = [ - ./hosts/mox/configuration.nix - sops-nix.nixosModules.sops - ]; - }; + outputs = { self, nixpkgs, sops-nix }: let + lib = nixpkgs.lib; + + makeHost = host: system: nixpkgs.lib.nixosSystem { + inherit system; + modules = [ + ./hosts/${host}/configuration.nix + sops-nix.nixosModules.sops + ]; }; + + makeX86 = hosts: lib.genAttrs hosts ( + host: makeHost host "x86_64-linux" + ); + in + { + nixosConfigurations = makeX86 [ "cez" "kay" "mox" ]; }; } |