summaryrefslogtreecommitdiff
path: root/modules/nixos/incus.nix
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2024-02-20 00:53:48 +0300
committerAzat Bahawi <azat@bahawi.net>2024-02-20 00:53:48 +0300
commitd907b7b8f0aecee0f9eba12b09b929d720d07a8d (patch)
tree4f6bbbe605ebf96e1aefbc657dc975208b2436d1 /modules/nixos/incus.nix
parentf1dc3ecad357ceb8be34eca91fafca4d2a4f924e (diff)
2024-02-20
Diffstat (limited to 'modules/nixos/incus.nix')
-rw-r--r--modules/nixos/incus.nix62
1 files changed, 62 insertions, 0 deletions
diff --git a/modules/nixos/incus.nix b/modules/nixos/incus.nix
new file mode 100644
index 0000000..ada113f
--- /dev/null
+++ b/modules/nixos/incus.nix
@@ -0,0 +1,62 @@
+{
+ config,
+ lib,
+ ...
+}:
+with lib; let
+ cfg = config.nixfiles.modules.incus;
+in {
+ options.nixfiles.modules.incus.enable = mkEnableOption "Incus";
+
+ config = mkIf cfg.enable {
+ ark.directories = ["/var/lib/incus"];
+
+ virtualisation.incus = {
+ enable = true;
+
+ preseed = mkDefault {
+ networks = [
+ {
+ name = "incusbr0";
+ type = "bridge";
+ config = {
+ "ipv4.address" = "10.0.30.1/24";
+ "ipv4.nat" = true;
+ "ipv6.address" = "fc30::1/64";
+ "ipv6.nat" = true;
+ };
+ }
+ ];
+ storage_pools = [
+ {
+ name = "default";
+ driver = "dir";
+ config.source = "/var/lib/incus/storage-pools/default";
+ }
+ ];
+ profiles = [
+ {
+ name = "default";
+ devices = {
+ eth0 = {
+ type = "nic";
+ name = "eth0";
+ network = "incusbr0";
+ };
+ root = {
+ type = "disk";
+ pool = "default";
+ size = "15GiB";
+ path = "/";
+ };
+ };
+ }
+ ];
+ };
+ };
+
+ networking.firewall.trustedInterfaces = ["incusbr0"];
+
+ my.extraGroups = ["incus-admin"];
+ };
+}