mirror of
https://github.com/acaloiaro/sfos
synced 2026-07-21 10:12:24 +00:00
67 lines
1.5 KiB
Nix
67 lines
1.5 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}:
|
|
with lib; let
|
|
cfg = config.sfos.incus;
|
|
in {
|
|
options.sfos.incus.enable = mkEnableOption "enable incus";
|
|
options.sfos.incus.admin-users = mkOption {
|
|
type = with types; listOf str;
|
|
description = "A list of system users who are incus admins";
|
|
default = [];
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
virtualisation = {
|
|
incus = {
|
|
enable = true;
|
|
|
|
# Setup the incus cluster
|
|
preseed = {
|
|
networks = [
|
|
{
|
|
config = {
|
|
"ipv4.address" = "10.0.100.1/24";
|
|
"ipv4.nat" = "true";
|
|
};
|
|
name = "incusbr0";
|
|
type = "bridge";
|
|
}
|
|
];
|
|
profiles = [
|
|
{
|
|
devices = {
|
|
eth0 = {
|
|
name = "eth0";
|
|
network = "incusbr0";
|
|
type = "nic";
|
|
};
|
|
root = {
|
|
path = "/";
|
|
pool = "default";
|
|
size = "10GiB";
|
|
type = "disk";
|
|
};
|
|
};
|
|
name = "default";
|
|
}
|
|
];
|
|
storage_pools = [
|
|
{
|
|
config = {
|
|
source = "/var/lib/incus/storage-pools/default";
|
|
};
|
|
driver = "dir";
|
|
name = "default";
|
|
}
|
|
];
|
|
};
|
|
};
|
|
};
|
|
|
|
# Add users as incus admins
|
|
users.groups."incus-admin" = mkIf (cfg.admin-users != []) {members = cfg.admin-users;};
|
|
};
|
|
}
|