mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 04:19:19 -08:00
refactor: get rid of config folder
This commit is contained in:
parent
2606e1d874
commit
cb3ae5f434
254 changed files with 79 additions and 101 deletions
56
modules/meta/imports.nix
Normal file
56
modules/meta/imports.nix
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
{ config, lib, profiles, root, ... }:
|
||||
|
||||
with lib;
|
||||
|
||||
{
|
||||
options = {
|
||||
lib = mkOption {
|
||||
type = types.attrsOf (types.attrsOf types.unspecified);
|
||||
};
|
||||
network.importing = {
|
||||
nixosImports = mkOption {
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
darwinImports = mkOption {
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
homeImports = mkOption {
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
users = mkOption {
|
||||
type = types.listOf types.str;
|
||||
};
|
||||
};
|
||||
};
|
||||
config = {
|
||||
network.importing = {
|
||||
nixosImports = mkDefault (map (path: toString path) [
|
||||
(root + "/nodes/nixos/HN.nix")
|
||||
(root + "/nodes/nixos/HN/nixos.nix")
|
||||
(root + "/trusted/nodes/nixos/HN/nixos.nix")
|
||||
]);
|
||||
darwinImports = mkDefault (map (path: toString path) [
|
||||
(root + "/nodes/darwin/HN.nix")
|
||||
(root + "/nodes/darwin/HN/darwin.nix")
|
||||
(root + "/trusted/nodes/darwin/HN/darwin.nix")
|
||||
]);
|
||||
homeImports = mkDefault (map (path: toString path) [
|
||||
(root + "/nodes/nixos/HN/home.nix")
|
||||
(root + "/nodes/darwin/HN/home.nix")
|
||||
(root + "/trusted/nodes/HN/home.nix")
|
||||
]);
|
||||
users = mkDefault (singleton "kat");
|
||||
};
|
||||
lib.kw.nixosImport = hostName: lib.nodeImport {
|
||||
inherit (config.network.importing) nixosImports homeImports users;
|
||||
inherit profiles hostName;
|
||||
};
|
||||
lib.kw.darwinImport = hostName: lib.nodeImport {
|
||||
nixosImports = config.network.importing.darwinImports;
|
||||
profiles = profiles // { base = {}; };
|
||||
inherit (config.network.importing) homeImports users;
|
||||
inherit hostName;
|
||||
};
|
||||
_module.args = { inherit (config.lib) kw; };
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue