2022-05-28 23:05:30 +01:00
|
|
|
{
|
|
|
|
imports = [
|
|
|
|
./estuary
|
2022-05-29 03:30:40 +01:00
|
|
|
./shill
|
2022-05-28 23:05:30 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
nixos.systems.colony.configuration = { lib, pkgs, config, systems, ... }:
|
|
|
|
let
|
2022-05-29 15:22:49 +01:00
|
|
|
inherit (builtins) listToAttrs;
|
|
|
|
inherit (lib) mkIf mkMerge optionals;
|
2022-05-29 03:30:40 +01:00
|
|
|
|
2022-05-28 23:05:30 +01:00
|
|
|
wanBDF =
|
|
|
|
if config.my.build.isDevVM then "00:02.0" else "01:00.0";
|
2022-05-29 03:30:40 +01:00
|
|
|
|
|
|
|
vmLVM = vm: lv: {
|
|
|
|
"${lv}" = {
|
|
|
|
backend = {
|
|
|
|
driver = "host_device";
|
|
|
|
filename = "/dev/ssds/vm-${vm}-${lv}";
|
|
|
|
# It appears this needs to be set on the backend _and_ the format
|
|
|
|
discard = "unmap";
|
|
|
|
};
|
|
|
|
format = {
|
|
|
|
driver = "raw";
|
|
|
|
discard = "unmap";
|
|
|
|
};
|
|
|
|
frontend = "virtio-blk";
|
|
|
|
};
|
|
|
|
};
|
2022-05-28 23:05:30 +01:00
|
|
|
in
|
|
|
|
{
|
|
|
|
my = {
|
|
|
|
vms = {
|
2022-05-29 03:30:40 +01:00
|
|
|
instances = {
|
|
|
|
estuary = {
|
|
|
|
uuid = "59f51efb-7e6d-477b-a263-ed9620dbc87b";
|
2022-05-29 15:22:49 +01:00
|
|
|
networks.base = {
|
|
|
|
waitOnline = "no-carrier";
|
|
|
|
mac = "52:54:00:ab:f1:52";
|
|
|
|
};
|
2022-06-06 15:53:57 +01:00
|
|
|
drives = mkMerge ([ ] ++ (optionals (!config.my.build.isDevVM) [
|
|
|
|
(vmLVM "estuary" "esp")
|
|
|
|
(vmLVM "estuary" "nix")
|
|
|
|
(vmLVM "estuary" "persist")
|
|
|
|
{ esp.frontendOpts.bootindex = 0; }
|
|
|
|
]));
|
2022-05-29 03:30:40 +01:00
|
|
|
hostDevices."${wanBDF}" = { };
|
|
|
|
};
|
2022-06-11 16:42:00 +01:00
|
|
|
|
2022-05-29 03:30:40 +01:00
|
|
|
shill = {
|
|
|
|
uuid = "e34569ec-d24e-446b-aca8-a3b27abc1f9b";
|
2022-06-11 16:42:00 +01:00
|
|
|
smp = {
|
|
|
|
cpus = 4;
|
|
|
|
threads = 2;
|
|
|
|
};
|
|
|
|
memory = 8192;
|
2022-05-29 03:30:40 +01:00
|
|
|
networks.vms.mac = "52:54:00:85:b3:b1";
|
2022-06-11 16:42:00 +01:00
|
|
|
cleanShutdown.timeout = 120;
|
2022-05-29 15:22:49 +01:00
|
|
|
drives = mkMerge ([
|
2022-05-29 03:30:40 +01:00
|
|
|
{
|
|
|
|
installer = {
|
|
|
|
backend = {
|
|
|
|
driver = "file";
|
|
|
|
filename = "${systems.installer.configuration.config.my.buildAs.iso}/iso/nixos.iso";
|
|
|
|
read-only = "on";
|
|
|
|
};
|
|
|
|
format.driver = "raw";
|
|
|
|
frontend = "ide-cd";
|
|
|
|
frontendOpts = {
|
|
|
|
bootindex = 1;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
2022-05-29 15:22:49 +01:00
|
|
|
] ++ (optionals (!config.my.build.isDevVM) [
|
|
|
|
(vmLVM "shill" "esp")
|
|
|
|
(vmLVM "shill" "nix")
|
|
|
|
(vmLVM "shill" "persist")
|
|
|
|
{ esp.frontendOpts.bootindex = 0; }
|
|
|
|
]));
|
2022-05-28 23:05:30 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|