Refactor: Initial step
- Added library for common functions - Moved machines/ to hosts/ - Automise adding new hosts to the flake
This commit is contained in:
parent
95b9318585
commit
1ea937f884
7 changed files with 54 additions and 5 deletions
26
lib/hosts.nix
Normal file
26
lib/hosts.nix
Normal file
|
@ -0,0 +1,26 @@
|
|||
{ lib }:
|
||||
|
||||
{
|
||||
mkHosts = {
|
||||
modules,
|
||||
nixpkgs,
|
||||
inputs,
|
||||
path ? (builtins.toString ../hosts),
|
||||
}: let
|
||||
hosts = lib.getDirsInDir path;
|
||||
common = {
|
||||
system = "x86_64-linux";
|
||||
modules = modules;
|
||||
};
|
||||
in
|
||||
builtins.trace "Hosts found: ${builtins.toString hosts}"
|
||||
builtins.trace "Path being used: ${path}"
|
||||
builtins.listToAttrs (builtins.map (host: {
|
||||
name = host;
|
||||
value = nixpkgs.lib.nixosSystem {
|
||||
system = common.system;
|
||||
modules = common.modules ++ [ ../hosts/${host} ];
|
||||
specialArgs = { inherit inputs; };
|
||||
};
|
||||
}) hosts);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue