65 lines
1.3 KiB
Nix
65 lines
1.3 KiB
Nix
|
{ lib, config, inputs, username, ... }:
|
||
|
with lib;
|
||
|
let
|
||
|
cfg = config.imp;
|
||
|
in {
|
||
|
imports = [
|
||
|
inputs.impermanence.nixosModules.impermanence
|
||
|
(mkAliasOptionModule [ "imp" "dirs" ] [
|
||
|
"environment"
|
||
|
"persistence"
|
||
|
"/nix/persist"
|
||
|
"directories"
|
||
|
])
|
||
|
];
|
||
|
|
||
|
options.imp.home = {
|
||
|
files = mkOption {
|
||
|
type = with types; listOf str;
|
||
|
default = [];
|
||
|
};
|
||
|
dirs = mkOption {
|
||
|
type = with types; listOf str;
|
||
|
default = [];
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = {
|
||
|
environment.persistence."/nix/persist" = {
|
||
|
enable = true;
|
||
|
directories = [
|
||
|
"/var/lib/systemd/coredump"
|
||
|
"/var/lib/nixos"
|
||
|
];
|
||
|
files = [
|
||
|
"/etc/machine-id"
|
||
|
];
|
||
|
};
|
||
|
|
||
|
environment.persistence."/nix/persist".users."${username}" = {
|
||
|
# environment.persistence."/nix/persist".users."user" = {
|
||
|
directories = builtins.map (x: { directory = x; mode = "0700"; })
|
||
|
[
|
||
|
"Audiobooks"
|
||
|
"Books"
|
||
|
"Desktop"
|
||
|
"Documents"
|
||
|
# "Downloads"
|
||
|
"Extensions"
|
||
|
"Forks"
|
||
|
"Games"
|
||
|
"IdeaProjects"
|
||
|
"Keybase"
|
||
|
"Library"
|
||
|
"Monero"
|
||
|
"Music"
|
||
|
"Phone"
|
||
|
"Pictures"
|
||
|
"Projects"
|
||
|
"Videos"
|
||
|
] ++ cfg.home.dirs;
|
||
|
files = builtins.map (x: { file = x; parentDirectory = { mode = "0700"; }; }) cfg.home.files;
|
||
|
};
|
||
|
};
|
||
|
}
|