Refactoring of the machines

This commit is contained in:
Julien Malka 2022-02-19 22:05:59 +01:00
parent 4841bdf10f
commit b9f3d8f46c
No known key found for this signature in database
GPG key ID: 3C68E13964FEA07F
5 changed files with 97 additions and 11 deletions

View file

@ -52,5 +52,7 @@ in
};
};
luj = import ./luj.nix final;
}

43
lib/luj.nix Normal file
View file

@ -0,0 +1,43 @@
lib: with lib; let
modules = [
{
options.machines = mkOption {
description = "My machines";
type = with types; attrsOf (submodule ({ name, ... }: {
freeformType = attrs;
options = {
hostname = mkOption {
description = "The machine's hostname";
type = str;
default = name;
readOnly = true;
};
};
}));
default = {};
};
config = {
_module.freeformType = with types; attrs;
domain = "julienmalka.me";
machines = {
lisa = {
arch = "x86_64-linux";
};
newton = {
arch = "x86_64-linux";
};
macintosh = {
arch = "x86_64-linux";
};
lambda = {
arch = "aarch64-linux";
};
};
};
}
];
in (evalModules { inherit modules; }).config