Added impermenence module and set Incarceron to be imperm so we can test

this
This commit is contained in:
TheWanderingCrow 2025-10-22 15:00:19 -04:00
parent 0f565bed7d
commit 0fbc69679e
5 changed files with 69 additions and 0 deletions

16
flake.lock generated
View file

@ -211,6 +211,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"
}
},
"mnw": {
"locked": {
"lastModified": 1756659871,
@ -644,6 +659,7 @@
"disko": "disko",
"hardware": "hardware",
"home-manager": "home-manager",
"impermanence": "impermanence",
"niri-flake": "niri-flake",
"nix-darwin": "nix-darwin",
"nix-secrets": "nix-secrets",

View file

@ -96,6 +96,7 @@
url = "github:nix-community/home-manager/release-25.05";
inputs.nixpkgs.follows = "nixpkgs";
};
impermanence.url = "github:nix-community/impermanence";
# 3rd party inputs
disko = {

View file

@ -18,6 +18,7 @@ in {
imports = lib.flatten [
inputs.home-manager.${platformModules}.home-manager
inputs.sops-nix.${platformModules}.sops
inputs.impermanence.${platformModules}.impermanence
(map lib.custom.relativeToRoot [
"hosts/common/core/${platform}.nix"

View file

@ -0,0 +1,50 @@
{
lib,
config,
...
}:
lib.mkIf config.hostSpec.isImpermanent {
environment.persistence.${config.hostSpec.persistFolder} = {
enable = true;
directories = [
"/var/log"
"/var/lib/bluetooth"
"/var/lib/nixos"
"/var/lib/systemd/coredump"
"/etc/NetworkManager/system-connections"
];
files = [
"/etc/machine-id"
];
users.${config.hostSpec.username} = {
directories = [
"Downloads"
"Music"
"Pictures"
"Documents"
"Videos"
"VirtualBox VMs"
{
directory = ".gnupg";
mode = "0700";
}
{
directory = ".ssh";
mode = "0700";
}
{
directory = ".nixops";
mode = "0700";
}
{
directory = ".local/share/keyrings";
mode = "0700";
}
".local/share/direnv"
];
files = [
".screenrc"
];
};
};
}

View file

@ -48,6 +48,7 @@
hostSpec = {
hostName = "Incarceron";
isImpermanent = true;
persistFolder = "/persist";
};