From 8d3d3521f3d934b06f61f6709e73545ec1049ada Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Thu, 18 Feb 2021 20:19:11 +0000 Subject: [PATCH] flake: refactor host configuration --- flake.nix | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/flake.nix b/flake.nix index f38849b..3659816 100644 --- a/flake.nix +++ b/flake.nix @@ -5,11 +5,11 @@ nur.url = "github:nix-community/NUR"; }; - outputs = { self, nixpkgs, nur }: { - nixosConfigurations.porthos = nixpkgs.lib.nixosSystem { - system = "x86_64-linux"; - modules = - [ + outputs = { self, nixpkgs, nur }: + let + buildHost = name: system: nixpkgs.lib.nixosSystem { + inherit system; + modules = [ ({ pkgs, ... }: { # Let 'nixos-version --json' know about the Git revision # of this flake. @@ -19,8 +19,13 @@ else throw "Refusing to build from a dirty Git tree!"; }) { nixpkgs.overlays = [ nur.overlay ]; } - ./porthos.nix + (./. + "/${name}.nix") ]; + }; + in + { + nixosConfigurations = nixpkgs.lib.mapAttrs buildHost { + porthos = "x86_64-linux"; + }; }; - }; }