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" "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": { "ixx": {
"inputs": { "inputs": {
"flake-utils": [ "flake-utils": [
@ -149,27 +164,12 @@
"type": "github" "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": { "root": {
"inputs": { "inputs": {
"disko": "disko", "disko": "disko",
"impermanence": "impermanence",
"nixpkgs": "nixpkgs", "nixpkgs": "nixpkgs",
"nixvim": "nixvim", "nixvim": "nixvim",
"preservation": "preservation",
"sops-nix": "sops-nix" "sops-nix": "sops-nix"
} }
}, },

View file

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

View file

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

View file

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

View file

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