From 9f593876ab0e67643ba4f1e9eb1c497612aa0b0b Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 30 Jun 2024 12:25:44 +0100 Subject: [PATCH] switch to incus --- hosts/common/optional/lxd/default.nix | 13 ++++-------- hosts/common/optional/lxd/lxd-networking.nix | 21 ------------------- hosts/common/optional/lxd/lxd-preseed.nix | 8 ++++++- .../common/optional/lxd/profiles/default.nix | 5 +++-- 4 files changed, 14 insertions(+), 33 deletions(-) delete mode 100644 hosts/common/optional/lxd/lxd-networking.nix diff --git a/hosts/common/optional/lxd/default.nix b/hosts/common/optional/lxd/default.nix index 6a42ca5..5fcc0d0 100644 --- a/hosts/common/optional/lxd/default.nix +++ b/hosts/common/optional/lxd/default.nix @@ -1,18 +1,13 @@ +{ pkgs, ... }: { imports = [ ./lxd-preseed.nix - ./lxd-networking.nix ]; - + networking.nftables.enable = true; virtualisation = { - lxd = { + incus = { + package = pkgs.incus; enable = true; - - recommendedSysctlSettings = true; - }; - - lxc = { - lxcfs.enable = true; }; }; } diff --git a/hosts/common/optional/lxd/lxd-networking.nix b/hosts/common/optional/lxd/lxd-networking.nix deleted file mode 100644 index 23aa2e4..0000000 --- a/hosts/common/optional/lxd/lxd-networking.nix +++ /dev/null @@ -1,21 +0,0 @@ -{ ... }: -let - lxd_profiles = { - "default" = (import ./profiles/default.nix); - }; -in -{ - boot = { - kernelModules = [ "nf_nat_ftp" ]; - - kernel.sysctl = { - "net.ipv4.conf.all.forwarding" = true; - "net.ipv4.conf.default.forwarding" = true; - }; - }; - - # allow static ipv4 for containers - networking.firewall.extraCommands = '' - iptables -A INPUT -i ${lxd_profiles.default.network.name} -m comment --comment "lxd rule for ${lxd_profiles.default.network.name}" -j ACCEPT - ''; -} diff --git a/hosts/common/optional/lxd/lxd-preseed.nix b/hosts/common/optional/lxd/lxd-preseed.nix index 756ee70..4ba186c 100644 --- a/hosts/common/optional/lxd/lxd-preseed.nix +++ b/hosts/common/optional/lxd/lxd-preseed.nix @@ -7,8 +7,14 @@ let in { virtualisation = { - lxd = { + incus = { preseed = { + + config = { + "core.https_address" = ":8443"; + "images.auto_update_interval" = 9; + }; + networks = [ lxd_profiles.default.network ]; diff --git a/hosts/common/optional/lxd/profiles/default.nix b/hosts/common/optional/lxd/profiles/default.nix index fccbef5..2038649 100644 --- a/hosts/common/optional/lxd/profiles/default.nix +++ b/hosts/common/optional/lxd/profiles/default.nix @@ -6,6 +6,7 @@ config = { "ipv4.address" = "10.100.1.1/8"; "ipv4.nat" = "true"; + "ipv4.firewall" = "false"; }; }; @@ -13,12 +14,12 @@ { name = "postgres"; driver = "btrfs"; - config.source = "/dev/zd0"; + config.source = "/dev/zvol/zspeed/postgres"; } { name = "test"; driver = "btrfs"; - config.source = "/dev/zd16"; + config.source = "/dev/zvol/zspeed/test"; } ];