try to fix attrset generation
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
parent
9985fc8778
commit
1c596593ca
@ -1,34 +1,28 @@
|
|||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
rec {
|
rec {
|
||||||
genK3SFromList =
|
genK3SVM =
|
||||||
server-config: agent-config:
|
server-config: agent-config: vms:
|
||||||
{
|
|
||||||
host,
|
|
||||||
ipv4,
|
|
||||||
server ? false,
|
|
||||||
}@args:
|
|
||||||
lib.mapAttrs (
|
lib.mapAttrs (
|
||||||
args:
|
host: {ipv4,server ? false}:
|
||||||
lib.rad-dev.microvms.genMicroVM args.host args.ipv4 "x86_64-linux" (
|
genMicroVM host ipv4 "x86_64-linux" (
|
||||||
if server then import server-config else import agent-config
|
if server then (import server-config) else (import agent-config)
|
||||||
)
|
)
|
||||||
) args;
|
) vms;
|
||||||
|
|
||||||
genMicroVM =
|
genMicroVM =
|
||||||
hostName: ipv4: system: vm-config:
|
hostName: ipv4: system: vm-config:
|
||||||
# microvm refers to microvm.nixosModules
|
# microvm refers to microvm.nixosModules
|
||||||
|
|
||||||
|
# {
|
||||||
|
# config,
|
||||||
|
# pkgs,
|
||||||
|
# lib,
|
||||||
|
# ...
|
||||||
|
# }:
|
||||||
{
|
{
|
||||||
config,
|
|
||||||
pkgs,
|
|
||||||
lib,
|
|
||||||
...
|
|
||||||
}:
|
|
||||||
{
|
|
||||||
${hostName} = {
|
|
||||||
# The package set to use for the microvm. This also determines the microvm's architecture.
|
# The package set to use for the microvm. This also determines the microvm's architecture.
|
||||||
# Defaults to the host system's package set if not given.
|
# Defaults to the host system's package set if not given.
|
||||||
pkgs = import pkgs { inherit system; };
|
# pkgs = import pkgs { inherit system; };
|
||||||
|
|
||||||
# (Optional) A set of special arguments to be passed to the MicroVM's NixOS modules.
|
# (Optional) A set of special arguments to be passed to the MicroVM's NixOS modules.
|
||||||
#specialArgs = {};
|
#specialArgs = {};
|
||||||
@ -51,13 +45,12 @@ rec {
|
|||||||
inherit hostName;
|
inherit hostName;
|
||||||
interfaces.ether.ipv4.addreses = {
|
interfaces.ether.ipv4.addreses = {
|
||||||
address = ipv4;
|
address = ipv4;
|
||||||
prefixLength = 24;
|
prefixLength = 32;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Any other configuration for your MicroVM
|
# Any other configuration for your MicroVM
|
||||||
# [...]
|
# [...]
|
||||||
} // vm-config;
|
} // vm-config;
|
||||||
};
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -6,22 +6,20 @@
|
|||||||
...
|
...
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
inherit (lib.rad-dev.microvm) genK3SFromList;
|
inherit (lib.rad-dev.microvm) genK3SVM;
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
# rad-dev.microvm-host.enable = true;
|
# rad-dev.microvm-host.enable = true;
|
||||||
rad-dev.microvm-host.vms =
|
rad-dev.microvm-host.vms =
|
||||||
genK3SFromList (src + "/modules/opt/k3s-server.nix") (src + "/modules/opt/k3s-agent.nix")
|
genK3SVM (src + "/modules/opt/k3s-server.nix") (src + "/modules/opt/k3s-agent.nix")
|
||||||
[
|
{
|
||||||
{
|
"ph-server-1" = {
|
||||||
host = "ph-server-1";
|
|
||||||
ipv4 = "192.168.69.10";
|
ipv4 = "192.168.69.10";
|
||||||
server = true;
|
server = true;
|
||||||
}
|
};
|
||||||
{
|
# "ph-agent-1" = {
|
||||||
host = "ph-agent-1";
|
# ipv4 = "192.168.69.30";
|
||||||
ipv4 = "192.168.69.30";
|
# };
|
||||||
}
|
};
|
||||||
];
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user