flake: move system builders to lib/builders.nix

main
Zynh Ludwig 2024-07-21 13:23:33 -07:00
parent 93f438a5d1
commit cb99b5cea8
2 changed files with 31 additions and 25 deletions

View File

@ -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";

27
lib/builders.nix Normal file
View File

@ -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;
}