forked from fediversity/fediversity
factor out evaluating options
Signed-off-by: Kiara Grouwstra <kiara@procolix.eu>
This commit is contained in:
parent
0cf646abfa
commit
60ddfaa0ad
2 changed files with 22 additions and 24 deletions
|
|
@ -6,6 +6,7 @@
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (pkgs) system;
|
inherit (pkgs) system;
|
||||||
|
inherit (pkgs.callPackage ../../utils.nix { }) evalOption;
|
||||||
backendPort = builtins.toString 8080;
|
backendPort = builtins.toString 8080;
|
||||||
tfBackend = fragment: {
|
tfBackend = fragment: {
|
||||||
address = "http://localhost:${backendPort}/state/${fragment}";
|
address = "http://localhost:${backendPort}/state/${fragment}";
|
||||||
|
|
@ -17,30 +18,14 @@ let
|
||||||
tf-netbox-store-ips
|
tf-netbox-store-ips
|
||||||
tf-netbox-get-ip
|
tf-netbox-get-ip
|
||||||
;
|
;
|
||||||
netbox-store-ips =
|
netbox-store-ips = evalOption "tf-netbox-store-ips" tf-netbox-store-ips {
|
||||||
(lib.evalModules {
|
|
||||||
modules = [
|
|
||||||
{
|
|
||||||
options = { inherit tf-netbox-store-ips; };
|
|
||||||
config.tf-netbox-store-ips = {
|
|
||||||
httpBackend = tfBackend "proxmox-test/store-ips";
|
httpBackend = tfBackend "proxmox-test/store-ips";
|
||||||
startAddress = "192.168.10.236/24";
|
startAddress = "192.168.10.236/24";
|
||||||
endAddress = "192.168.10.240/24";
|
endAddress = "192.168.10.240/24";
|
||||||
};
|
};
|
||||||
}
|
netbox-get-ip = evalOption "tf-netbox-get-ip" tf-netbox-get-ip {
|
||||||
];
|
|
||||||
}).config.tf-netbox-store-ips;
|
|
||||||
netbox-get-ip =
|
|
||||||
(lib.evalModules {
|
|
||||||
modules = [
|
|
||||||
{
|
|
||||||
options = { inherit tf-netbox-get-ip; };
|
|
||||||
config.tf-netbox-get-ip = {
|
|
||||||
httpBackend = tfBackend "proxmox-test/get-ip";
|
httpBackend = tfBackend "proxmox-test/get-ip";
|
||||||
};
|
};
|
||||||
}
|
|
||||||
];
|
|
||||||
}).config.tf-netbox-get-ip;
|
|
||||||
netboxUser = "netbox";
|
netboxUser = "netbox";
|
||||||
netboxPassword = "netbox";
|
netboxPassword = "netbox";
|
||||||
changePassword = pkgs.writeText "change-password.py" ''
|
changePassword = pkgs.writeText "change-password.py" ''
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,19 @@ rec {
|
||||||
];
|
];
|
||||||
}).config;
|
}).config;
|
||||||
|
|
||||||
|
evalOption =
|
||||||
|
name: opts: conf:
|
||||||
|
(lib.evalModules {
|
||||||
|
modules = [
|
||||||
|
{
|
||||||
|
options = {
|
||||||
|
"${name}" = opts;
|
||||||
|
};
|
||||||
|
config."${name}" = conf;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}).config."${name}";
|
||||||
|
|
||||||
toBash =
|
toBash =
|
||||||
v:
|
v:
|
||||||
lib.replaceStrings [ "\"" ] [ "\\\"" ] (
|
lib.replaceStrings [ "\"" ] [ "\\\"" ] (
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue