refactor(boot): consolidate impermanence configuration options

This commit is contained in:
tux
2026-05-09 21:46:25 +05:30
parent 9231c5878f
commit dce2cd1322
2 changed files with 69 additions and 4 deletions

View File

@@ -17,8 +17,29 @@
]; ];
tnix = { tnix = {
boot.secure-boot.enable = true; boot = {
boot.impermanence.enable = true; secure-boot.enable = true;
impermanence = {
enable = true;
home = {
directories = [
".config/sops"
".local/share/nvim"
".local/share/opencode"
".local/share/zsh"
".local/share/zoxide"
".local/state/lazygit"
];
files = [
".wakatime.cfg"
];
};
};
};
networking.openssh.enable = true; networking.openssh.enable = true;
services = { services = {

View File

@@ -4,6 +4,7 @@
{ {
config, config,
lib, lib,
userName,
... ...
}: }:
let let
@@ -16,6 +17,28 @@
options.tnix.boot.impermanence = { options.tnix.boot.impermanence = {
enable = lib.mkEnableOption "Enable impermanence"; enable = lib.mkEnableOption "Enable impermanence";
directories = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
files = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
};
options.tnix.boot.impermanence.home = {
directories = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
files = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
};
}; };
config = lib.mkIf cfg.impermanence.enable { config = lib.mkIf cfg.impermanence.enable {
@@ -27,13 +50,34 @@
"/var/log" "/var/log"
"/var/lib" "/var/lib"
"/etc/NetworkManager/system-connections" "/etc/NetworkManager/system-connections"
]; ]
++ cfg.impermanence.directories;
files = [ files = [
"/etc/ssh/ssh_host_ed25519_key" "/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_ed25519_key.pub" "/etc/ssh/ssh_host_ed25519_key.pub"
"/etc/ssh/ssh_host_rsa_key" "/etc/ssh/ssh_host_rsa_key"
"/etc/ssh/ssh_host_rsa_key.pub" "/etc/ssh/ssh_host_rsa_key.pub"
]; ]
++ cfg.impermanence.files;
};
home-manager.users.${userName} = {
home.persistence."/persist" = {
directories = [
"Downloads"
"Music"
"Wallpapers"
"Documents"
"Videos"
"Projects"
"Stuff"
".ssh"
]
++ cfg.impermanence.home.directories;
files = cfg.impermanence.home.files;
};
}; };
boot.initrd.systemd = { boot.initrd.systemd = {