flake: move system builders to lib/builders.nix
This commit is contained in:
parent
93f438a5d1
commit
cb99b5cea8
2 changed files with 31 additions and 25 deletions
29
flake.nix
29
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";
|
||||
|
|
27
lib/builders.nix
Normal file
27
lib/builders.nix
Normal 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;
|
||||
}
|
Loading…
Reference in a new issue