Switch to impermanence

This commit is contained in:
Vili Sinervä 2025-06-29 15:25:07 +03:00
parent 44af0493db
commit 7e05e5ddc0
Signed by: Vili Sinervä
SSH key fingerprint: SHA256:FladqYjaE4scJY3Hi+gnShZ6ygnTJgixy0I6BAoHyos
5 changed files with 37 additions and 46 deletions

32
flake.lock generated
View file

@ -59,6 +59,21 @@
"type": "github"
}
},
"impermanence": {
"locked": {
"lastModified": 1737831083,
"narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=",
"owner": "nix-community",
"repo": "impermanence",
"rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "impermanence",
"type": "github"
}
},
"ixx": {
"inputs": {
"flake-utils": [
@ -149,27 +164,12 @@
"type": "github"
}
},
"preservation": {
"locked": {
"lastModified": 1738541138,
"narHash": "sha256-isT+jR8P8UFh5PJDzGHYXqVEHEZa0D5WvT5kfMf14AM=",
"owner": "nix-community",
"repo": "preservation",
"rev": "2f16754f9f6b766c1429375ab7417dc81cc90a63",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "preservation",
"type": "github"
}
},
"root": {
"inputs": {
"disko": "disko",
"impermanence": "impermanence",
"nixpkgs": "nixpkgs",
"nixvim": "nixvim",
"preservation": "preservation",
"sops-nix": "sops-nix"
}
},

View file

@ -11,7 +11,7 @@
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
preservation.url = "github:nix-community/preservation";
impermanence.url = "github:nix-community/impermanence";
sops-nix = {
url = "github:Mic92/sops-nix";
inputs.nixpkgs.follows = "nixpkgs";
@ -24,7 +24,7 @@
nixpkgs,
nixvim,
disko,
preservation,
impermanence,
sops-nix,
...
}:
@ -53,7 +53,7 @@
./hosts/${host}/state.nix
disko.nixosModules.disko
preservation.nixosModules.preservation
impermanence.nixosModules.impermanence
sops-nix.nixosModules.sops
];
}

View file

@ -1,6 +1,6 @@
{ lib, ... }:
{
preservation.enable = true;
environment.persistence."/persist".enable = true;
swapDevices = lib.mkForce [ ];
imports = [
../../shared/base.nix

View file

@ -34,34 +34,23 @@
ssss
];
######################################## Preservation ###########################################
preservation = {
######################################## Impermanence ###########################################
environment.persistence."/persist" = {
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"
];
};
hideMounts = true;
files = [
"/etc/machine-id"
"/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_ed25519_key"
];
directories = [
"/var/lib/systemd/timers"
"/var/lib/nixos"
"/var/log"
];
};
systemd.suppressedSystemUnits = [ "systemd-machine-id-commit.service" ];
######################################## ZSH configuration ######################################
users.defaultUserShell = pkgs.zsh;

View file

@ -1,5 +1,7 @@
{ lib, ... }:
{
fileSystems."/persist".neededForBoot = true;
services.zfs = {
autoScrub.enable = true;
autoSnapshot = {