From 44af0493dbab39e64daf3b8fab782952189339e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vili=20Sinerv=C3=A4?= Date: Sun, 29 Jun 2025 15:12:28 +0300 Subject: [PATCH] Enable preservation for SIIT-DC --- hosts/siit-dc/configuration.nix | 5 +++-- hosts/siit-dc/state.nix | 1 + shared/base.nix | 29 +++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 2 deletions(-) diff --git a/hosts/siit-dc/configuration.nix b/hosts/siit-dc/configuration.nix index 9e9c7ef..7bf6696 100644 --- a/hosts/siit-dc/configuration.nix +++ b/hosts/siit-dc/configuration.nix @@ -1,6 +1,7 @@ -{ ... }: +{ lib, ... }: { - networking.hostId = "f1636fe0"; + preservation.enable = true; + swapDevices = lib.mkForce [ ]; imports = [ ../../shared/base.nix diff --git a/hosts/siit-dc/state.nix b/hosts/siit-dc/state.nix index d7c55dd..3654001 100644 --- a/hosts/siit-dc/state.nix +++ b/hosts/siit-dc/state.nix @@ -1,5 +1,6 @@ { lib, modulesPath, ... }: { + networking.hostId = "f1636fe0"; networking.networkmanager.enable = lib.mkForce false; networking.useDHCP = false; systemd.network.enable = true; diff --git a/shared/base.nix b/shared/base.nix index 38d5574..ff352a6 100644 --- a/shared/base.nix +++ b/shared/base.nix @@ -34,6 +34,35 @@ ssss ]; + ######################################## Preservation ########################################### + preservation = { + enable = lib.mkDefault false; + preserveAt."/persist" = { + files = [ + { + file = "/etc/machine-id"; + inInitrd = true; + } + { + file = "/etc/ssh/ssh_host_rsa_key"; + how = "symlink"; + inInitrd = true; # sops-nix + } + { + file = "/etc/ssh/ssh_host_ed25519_key"; + how = "symlink"; + inInitrd = true; # sops-nix + } + ]; + directories = [ + "/var/lib/systemd/timers" + "/var/lib/nixos" + "/var/log" + ]; + }; + }; + systemd.suppressedSystemUnits = [ "systemd-machine-id-commit.service" ]; + ######################################## ZSH configuration ###################################### users.defaultUserShell = pkgs.zsh; environment.shells = with pkgs; [ zsh ];