From 567c22812fe1fbe525f1732661d253b3902710a9 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 22 Aug 2024 14:48:24 +0200 Subject: ... --- hosts/sif/default.nix | 9 ++++----- hosts/sif/libvirt/default.nix | 38 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 5 deletions(-) create mode 100644 hosts/sif/libvirt/default.nix (limited to 'hosts/sif') diff --git a/hosts/sif/default.nix b/hosts/sif/default.nix index e3becb4b..d2902f95 100644 --- a/hosts/sif/default.nix +++ b/hosts/sif/default.nix @@ -12,11 +12,12 @@ let in { imports = with flake.nixosModules.systemProfiles; [ ./hw.nix - ./mail + ./mail ./libvirt tmpfs-root bcachefs initrd-all-crypto-modules default-locale openssh rebuild-machines networkmanager flakeInputs.nixos-hardware.nixosModules.lenovo-thinkpad-p1 flakeInputs.impermanence.nixosModules.impermanence + flakeInputs.nixVirt.nixosModules.default ]; config = { @@ -627,10 +628,6 @@ in { dconf.enable = true; }; - virtualisation.libvirtd = { - enable = true; - }; - zramSwap = { enable = true; algorithm = "zstd"; @@ -704,6 +701,8 @@ in { security.pam.services.gtklock = {}; + home-manager.sharedModules = [ flakeInputs.nixVirt.homeModules.default ]; + system.stateVersion = "24.11"; }; } diff --git a/hosts/sif/libvirt/default.nix b/hosts/sif/libvirt/default.nix new file mode 100644 index 00000000..b5d95996 --- /dev/null +++ b/hosts/sif/libvirt/default.nix @@ -0,0 +1,38 @@ +{ flakeInputs, ... }: + +with flakeInputs.nixVirt.lib; + +{ + config = { + virtualisation.libvirtd.qemu.swtpm.enable = true; + virtualisation.libvirt = { + enable = true; + swtpm.enable = true; + connections."qemu:///system" = { + networks = [ + { active = null; + definition = network.writeXML { + name = "default"; + uuid = "012bfad7-4408-4345-8747-041853ef84c6"; + forward.mode = "nat"; + bridge = { + name = "virbr0"; + stp = true; + delay = 0; + }; + mac.address = "52:54:00:ad:34:af"; + ip = { + address = "192.168.122.1"; + netmask = "255.255.255.0"; + dhcp.range = { + start = "192.168.122.2"; + end = "192.168.122.254"; + }; + }; + }; + } + ]; + }; + }; + }; +} -- cgit v1.2.3