From cf9c5917af88c7f47c83ee4639c00134e459134e Mon Sep 17 00:00:00 2001 From: bogale Date: Tue, 13 Oct 2026 17:45:30 +0900 Subject: [PATCH] preparation for qemu server testing --- common.nix | 11 ++++++----- desktop/configuration.nix | 41 +++++++++++++++++++++++++++++++-------- mods/pxeboot.nix | 11 ++++++----- server/configuration.nix | 6 +++--- server/mods/system.nix | 1 - server/mods/web.nix | 10 ---------- 6 files changed, 48 insertions(+), 32 deletions(-) diff --git a/common.nix b/common.nix index 679aea4..6862963 100644 --- a/common.nix +++ b/common.nix @@ -50,10 +50,15 @@ }; networkmanager = { enable = true; + dns = "dnsmasq"; ensureProfiles = { environmentFiles = [ "/secrets/wifi.env" ]; - profiles.wifi = { + profiles.home-wifi = { wifi-security.key-mgmt = "sae"; + connection = { + type = "wifi"; + id = "home-wifi"; + }; ipv6 = { method = "manual"; gateway = "fc01::1"; @@ -62,10 +67,6 @@ method = "manual"; gateway = "10.1.0.1"; }; - connection = { - id = "wifi"; - type = "802-11-wireless"; - }; }; }; }; diff --git a/desktop/configuration.nix b/desktop/configuration.nix index f827d65..0d6e955 100644 --- a/desktop/configuration.nix +++ b/desktop/configuration.nix @@ -1,14 +1,22 @@ { config, lib, pkgs, ... }: { - programs.niri.enable = true; hardware.bluetooth.enable = true; + environment.systemPackages = [ pkgs.qemu ]; imports = [ ../common.nix ./hardware.nix ]; boot.kernelParams = [ "hibernate.compressor=lz4" ]; + programs = { + niri.enable = true; + virt-manager.enable = true; + }; + virtualisation.libvirtd = { + enable = true; + qemu.swtpm.enable = true; + }; users.users.bogale = { uid = 1551; isNormalUser = true; - extraGroups = [ "wheel" ]; hashedPasswordFile = "/secrets/user/bogale-pw"; + extraGroups = [ "wheel" "libvirtd" "networkmanager" ]; }; networking = { hostName = "nixos-desktop"; @@ -17,11 +25,28 @@ configFile = "/secrets/awg/2.conf"; address = [ "10.0.0.3/32" "fc00::3/128" ]; }; - networkmanager.ensureProfiles.profiles.wifi = { - wifi.ssid = "bogale_5"; - ipv6.addresses = "fc01::3/64"; - ipv4.addresses = "10.1.0.3/16"; - wifi-security.psk = "$BOGALE_5_PSK"; + networkmanager.ensureProfiles.profiles = { + dhcp-eth.connection = { + id = "dhcp-eth"; + type = "ethernet"; + }; + home-wifi = { + wifi.ssid = "bogale_5"; + ipv6.addresses = "fc01::3/64"; + ipv4.addresses = "10.1.0.3/16"; + wifi-security.psk = "$BOGALE_5_PSK"; + }; + phone-wifi = { + wifi.ssid = "Hello world"; + connection = { + type = "wifi"; + id = "phone-wifi"; + }; + wifi-security = { + key-mgmt = "sae"; + psk = "$HELLO_WORLD_PSK"; + }; + }; }; }; services = { @@ -40,7 +65,7 @@ enable = true; settings.default_session = { user = "greeter"; - command = "${pkgs.noctalia-greeter}/bin/noctalia-greeter-session -- --session niri --user bogale"; + command = "${pkgs.noctalia-greeter}/bin/noctalia-greeter-session"; }; }; displayManager.noctalia-greeter = { diff --git a/mods/pxeboot.nix b/mods/pxeboot.nix index c1639d7..945f300 100644 --- a/mods/pxeboot.nix +++ b/mods/pxeboot.nix @@ -16,6 +16,7 @@ services = { dnsmasq.settings = { enable-tftp = true; + bind-dynamic = true; interface = "enp1s0"; tftp-root = "/srv/tftp"; dhcp-boot = "grubx64.efi"; @@ -41,7 +42,11 @@ enableIPv6 = true; internalInterfaces = [ "enp1s0" ]; }; - networkmanager.ensureProfiles.profiles.ethernet = { + networkmanager.ensureProfiles.profiles.static-eth = { + connection = { + id = "static-eth"; + type = "ethernet"; + }; ipv6 = { method = "manual"; addresses = "fc02::1/64"; @@ -50,10 +55,6 @@ method = "manual"; addresses = "10.2.0.1/16"; }; - connection = { - id = "ethernet"; - type = "802-3-ethernet"; - }; }; }; systemd = { diff --git a/server/configuration.nix b/server/configuration.nix index 692aa35..ce847c3 100644 --- a/server/configuration.nix +++ b/server/configuration.nix @@ -11,7 +11,7 @@ "L /root/backup/server/http - - - - /srv/http" "L /root/backup/server/acme - - - - /var/lib/acme" "L /root/backup/server/mail - - - - /var/spool/mail" - "L /root/backup/server/forgejo - - - - /var/lib/forgejo/dump" + "L /root/backup/server/forgejo - - - - /var/lib/forgejo" "L /root/backup/server/vaultwarden - - - - /var/lib/vaultwarden" "L /root/backup/server/postgresql - - - - /var/backup/postgresql" ]; @@ -36,7 +36,7 @@ configFile = "/secrets/awg/1.conf"; address = [ "10.0.0.2/32" "fc00::2/128" ]; }; - networkmanager.ensureProfiles.profiles.wifi = { + networkmanager.ensureProfiles.profiles.home-wifi = { wifi.ssid = "bogale_2.4"; ipv6.addresses = "fc01::2/64"; ipv4.addresses = "10.1.0.2/16"; @@ -49,7 +49,7 @@ vmail.gid = 1819; }; users = { - nginx.extraGroups = [ "php" "acme" ]; + nginx.extraGroups = [ "php" "acme" "grafana" ]; root.openssh.authorizedKeys.keys = [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPTb4c1ISQSV34GN27GgaJ08jpiRM3Wul/iSWjQ6emTq" ]; php = { uid = 1568; diff --git a/server/mods/system.nix b/server/mods/system.nix index 0e0ecda..5a620ed 100644 --- a/server/mods/system.nix +++ b/server/mods/system.nix @@ -16,7 +16,6 @@ server = { enable_gzip = true; protocol = "socket"; - socket_mode = "0666"; root_url = "https://bogaledev.ru/grafana"; }; }; diff --git a/server/mods/web.nix b/server/mods/web.nix index f28b9ef..c67b784 100644 --- a/server/mods/web.nix +++ b/server/mods/web.nix @@ -45,11 +45,6 @@ forgejo = { enable = true; database.type = "postgres"; - dump = { - enable = true; - type = "tar.zst"; - interval = "16:00"; - }; settings = { service = { ENABLE_CAPTCHA = true; @@ -104,11 +99,6 @@ "/".extraConfig = phpPool; "/local/".extraConfig = "${phpPool} ${localNetworks}"; "/git/".proxyPass = "http://unix:/run/forgejo/forgejo.sock:/"; - "/local/net/".extraConfig = '' - allow fc01::/64; - allow 10.1.0.0/16; - deny all; - ''; "/vw/" = { proxyWebsockets = true; extraConfig = localNetworks;