From cb99b5cea81d7043e239416109c33d8d11af7b3b Mon Sep 17 00:00:00 2001 From: Zynh Ludwig Date: Sun, 21 Jul 2024 13:23:33 -0700 Subject: [PATCH] flake: move system builders to lib/builders.nix --- flake.nix | 29 ++++------------------------- lib/builders.nix | 27 +++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 25 deletions(-) create mode 100644 lib/builders.nix diff --git a/flake.nix b/flake.nix index 6d739e4..f7bfb03 100644 --- a/flake.nix +++ b/flake.nix @@ -37,33 +37,12 @@ outputs = { self, nixpkgs, ... }@inputs: + let + builders = import ./lib/builders.nix inputs; + in { nixosConfigurations = - let - lib = import ./lib nixpkgs.lib; - - toPartialNixosConfig = - { hostname, system }: - { - name = hostname; - value = nixpkgs.lib.nixosSystem { - inherit system; - specialArgs = { inherit inputs; }; - modules = [ - ./hosts/${hostname}/hardware-configuration.nix - ./hosts/${hostname}/configuration.nix - inputs.home-manager.nixosModules.default - ]; - }; - }; - compileSystems = - systems: - lib.right - builtins.listToAttrs - (map toPartialNixosConfig) - systems; - in - compileSystems + builders.compileSystems [ { hostname = "snowhawk"; diff --git a/lib/builders.nix b/lib/builders.nix new file mode 100644 index 0000000..a2c11a9 --- /dev/null +++ b/lib/builders.nix @@ -0,0 +1,27 @@ +{ nixpkgs, ... }@inputs: + +let + lib = import ../lib nixpkgs; +in +rec { + toPartialNixosConfig = + { hostname, system }: + { + name = hostname; + value = nixpkgs.lib.nixosSystem { + inherit system; + specialArgs = { inherit inputs; }; + modules = [ + ../hosts/${hostname}/hardware-configuration.nix + ../hosts/${hostname}/configuration.nix + inputs.home-manager.nixosModules.default + ]; + }; + }; + compileSystems = + systems: + lib.right + builtins.listToAttrs + (map toPartialNixosConfig) + systems; +}