mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
feat(prox): reisen node config
This commit is contained in:
parent
3053ec927c
commit
bdc353964d
7 changed files with 116 additions and 26 deletions
31
modules/system/extern/files.nix
vendored
31
modules/system/extern/files.nix
vendored
|
|
@ -1,6 +1,9 @@
|
|||
{config, lib, ...}: let
|
||||
inherit (lib.options) mkOption;
|
||||
fileModule = {config, name, ...}: {
|
||||
let
|
||||
fileModule = {config, name, gensokyo-zone, lib, ...}: let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (lib.modules) mkOptionDefault;
|
||||
inherit (lib.strings) hasPrefix removePrefix;
|
||||
in {
|
||||
options = with lib.types; {
|
||||
path = mkOption {
|
||||
type = str;
|
||||
|
|
@ -21,12 +24,32 @@
|
|||
source = mkOption {
|
||||
type = path;
|
||||
};
|
||||
relativeSource = mkOption {
|
||||
type = nullOr str;
|
||||
};
|
||||
};
|
||||
config = {
|
||||
relativeSource = let
|
||||
flakeRoot = toString gensokyo-zone.self + "/";
|
||||
sourcePath = toString config.source;
|
||||
in mkOptionDefault (
|
||||
if hasPrefix flakeRoot sourcePath then removePrefix flakeRoot sourcePath
|
||||
else null
|
||||
);
|
||||
};
|
||||
};
|
||||
in {config, gensokyo-zone, lib, ...}: let
|
||||
inherit (lib.options) mkOption;
|
||||
in {
|
||||
options.extern = with lib.types; {
|
||||
files = mkOption {
|
||||
type = attrsOf (submodule fileModule);
|
||||
type = attrsOf (submoduleWith {
|
||||
modules = [ fileModule ];
|
||||
specialArgs = {
|
||||
inherit gensokyo-zone;
|
||||
system = config;
|
||||
};
|
||||
});
|
||||
default = { };
|
||||
};
|
||||
};
|
||||
|
|
|
|||
13
modules/system/proxmox/node.nix
Normal file
13
modules/system/proxmox/node.nix
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
{config, lib, gensokyo-zone, ...}: let
|
||||
inherit (gensokyo-zone.lib) mkAlmostOptionDefault;
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.modules) mkIf;
|
||||
cfg = config.proxmox.node;
|
||||
in {
|
||||
options.proxmox.node = with lib.types; {
|
||||
enable = mkEnableOption "Proxmox Node";
|
||||
};
|
||||
config.proxmox.node = {
|
||||
name = mkIf cfg.enable (mkAlmostOptionDefault config.access.hostName);
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue