diff --git a/common.nix b/common.nix index 6862963..61d0fff 100644 --- a/common.nix +++ b/common.nix @@ -8,6 +8,10 @@ users.users.root.hashedPasswordFile = "/secrets/user/root-pw"; nix.settings.experimental-features = [ "nix-command" "flakes" ]; environment.systemPackages = with pkgs; [ jq _7zz sbctl openssl python314 speedtest-go ]; + console = { + font = "cyr-sun16"; + keyMap = "ruwin_alt_sh-UTF-8"; + }; fileSystems = { "/".options = [ "noatime" ]; "/boot".options = [ "noatime" ]; diff --git a/desktop/configuration.nix b/desktop/configuration.nix index 0d6e955..4b40894 100644 --- a/desktop/configuration.nix +++ b/desktop/configuration.nix @@ -8,16 +8,19 @@ niri.enable = true; virt-manager.enable = true; }; - virtualisation.libvirtd = { - enable = true; - qemu.swtpm.enable = true; - }; users.users.bogale = { uid = 1551; isNormalUser = true; hashedPasswordFile = "/secrets/user/bogale-pw"; extraGroups = [ "wheel" "libvirtd" "networkmanager" ]; }; + virtualisation.libvirtd = { + enable = true; + qemu = { + swtpm.enable = true; + vhostUserPackages = [ pkgs.virtiofsd ]; + }; + }; networking = { hostName = "nixos-desktop"; firewall.allowedTCPPorts = [ 8000 ]; diff --git a/install.sh b/install.sh index f826f8d..aadf487 100644 --- a/install.sh +++ b/install.sh @@ -5,11 +5,11 @@ cryptsetup open $ROOTPART root mkfs.ext4 /dev/mapper/root mount /dev/mapper/root /mnt mount $ESPPART --mkdir -o umask=077 /mnt/boot -mkdir /mnt/var +mkdir -p /mnt/var/lib mkswap -F -s $SWAPSIZE /mnt/var/swapfile swapon /mnt/var/swapfile -nixos-generate-config --root /mnt --kernel latest --flake -#copy backup -nixos-install --no-root-passwd --no-channel-copy --flake "/mnt/etc/nixos#nixos" +# restore backup +nixos-generate-config --root /mnt --show-hardware-config > /mnt/etc/nixos/$HOSTNAME/hardware.nix +nixos-install --no-root-passwd --no-channel-copy --flake "/mnt/etc/nixos#nixos-$HOSTNAME" sbctl enroll-keys --yolo systemd-cryptenroll --tpm2-device=auto --tpm2-pcrs=0+2+7 $ROOTPART diff --git a/server/configuration.nix b/server/configuration.nix index ce847c3..6329ebc 100644 --- a/server/configuration.nix +++ b/server/configuration.nix @@ -12,7 +12,6 @@ "L /root/backup/server/acme - - - - /var/lib/acme" "L /root/backup/server/mail - - - - /var/spool/mail" "L /root/backup/server/forgejo - - - - /var/lib/forgejo" - "L /root/backup/server/vaultwarden - - - - /var/lib/vaultwarden" "L /root/backup/server/postgresql - - - - /var/backup/postgresql" ]; security.acme = { diff --git a/server/mods/mail.nix b/server/mods/mail.nix index 6bc8a4f..162dc62 100644 --- a/server/mods/mail.nix +++ b/server/mods/mail.nix @@ -60,8 +60,8 @@ in { mail_driver = "maildir"; auth_mechanisms = [ "plain" ]; protocols = [ "imap" "lmtp" ]; - #dovecot_config_version = "2.4.5"; - #dovecot_storage_version = "2.4.5"; + dovecot_config_version = "2.4.5"; + dovecot_storage_version = "2.4.5"; mail_path = "/var/spool/mail/vmail"; ssl_server_key_file = "${sslCertDir}/key.pem"; ssl_server_cert_file = "${sslCertDir}/fullchain.pem"; diff --git a/server/mods/system.nix b/server/mods/system.nix index 5a620ed..c624060 100644 --- a/server/mods/system.nix +++ b/server/mods/system.nix @@ -13,6 +13,11 @@ enable = true; settings = { security.secret_key = "$__file{/secrets/grafana-key}"; + database = { + user = "grafana"; + type = "postgres"; + host = "/run/postgresql"; + }; server = { enable_gzip = true; protocol = "socket"; diff --git a/server/mods/web.nix b/server/mods/web.nix index c67b784..219b330 100644 --- a/server/mods/web.nix +++ b/server/mods/web.nix @@ -6,16 +6,8 @@ postgresqlBackup = { enable = true; startAt = "16:00"; - compression = "zstd"; - databases = [ "php" "vaultwarden" ]; - }; - postgresql = { - enable = true; - ensureDatabases = [ "php" ]; - ensureUsers = [ { - name = "php"; - ensureDBOwnership = true; - } ]; + compression = "none"; + databases = [ "php" "forgejo" "grafana" "vaultwarden" ]; }; phpfpm.pools.php = { user = "php"; @@ -27,6 +19,16 @@ "listen.owner" = "nginx"; }; }; + postgresql = { + enable = true; + ensureDatabases = [ "php" "grafana" ]; + ensureUsers = let + user = name: { + inherit name; + ensureDBOwnership = true; + }; + in map user [ "php" "grafana" ]; + }; vaultwarden = { enable = true; configurePostgres = true;