From d14f96d584d116f197b658566c81af9f845db7ac Mon Sep 17 00:00:00 2001 From: Bruno BELANYI Date: Tue, 7 Mar 2023 12:20:14 +0000 Subject: [PATCH] flake: move 'nixosConfigurations' to 'flake/' --- flake.nix | 33 +-------------------------------- flake/nixos.nix | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+), 32 deletions(-) create mode 100644 flake/nixos.nix diff --git a/flake.nix b/flake.nix index fb2c6f4..cf397ba 100644 --- a/flake.nix +++ b/flake.nix @@ -80,34 +80,6 @@ eachMySystem = eachSystem mySystems; - defaultModules = [ - ({ ... }: { - # Let 'nixos-version --json' know about the Git revision - system.configurationRevision = self.rev or "dirty"; - }) - { - nixpkgs.overlays = (lib.attrValues self.overlays) ++ [ - nur.overlay - ]; - } - # Include generic settings - ./modules - # Include bundles of settings - ./profiles - ]; - - buildHost = name: system: lib.nixosSystem { - inherit system; - modules = defaultModules ++ [ - (./. + "/machines/${name}") - ]; - specialArgs = { - # Use my extended lib in NixOS configuration - inherit lib; - # Inject inputs to use them in global registry - inherit inputs; - }; - }; in eachMySystem (system: @@ -164,9 +136,6 @@ overlays = import ./flake/overlays.nix inputs; - nixosConfigurations = lib.mapAttrs buildHost { - aramis = "x86_64-linux"; - porthos = "x86_64-linux"; - }; + nixosConfigurations = import ./flake/nixos.nix inputs; }; } diff --git a/flake/nixos.nix b/flake/nixos.nix new file mode 100644 index 0000000..2b117e1 --- /dev/null +++ b/flake/nixos.nix @@ -0,0 +1,37 @@ +{ self, nixpkgs, nur, ... } @ inputs: +let + inherit (self) lib; + + defaultModules = [ + ({ ... }: { + # Let 'nixos-version --json' know about the Git revision + system.configurationRevision = self.rev or "dirty"; + }) + { + nixpkgs.overlays = (lib.attrValues self.overlays) ++ [ + nur.overlay + ]; + } + # Include generic settings + "${self}/modules" + # Include bundles of settings + "${self}/profiles" + ]; + + buildHost = name: system: lib.nixosSystem { + inherit system; + modules = defaultModules ++ [ + "${self}/machines/${name}" + ]; + specialArgs = { + # Use my extended lib in NixOS configuration + inherit lib; + # Inject inputs to use them in global registry + inherit inputs; + }; + }; +in +lib.mapAttrs buildHost { + aramis = "x86_64-linux"; + porthos = "x86_64-linux"; +}