impermanence: abstract the creation of ~/ sub-dirs

This commit is contained in:
2022-07-10 14:42:33 -07:00
parent 89447d9fe9
commit 5c6f616c97

View File

@@ -16,42 +16,45 @@ in
}; };
}; };
config = mkIf cfg.enable { config = let
map-home-dirs = dirs: builtins.map
(d: { user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/${d}"; })
dirs;
in mkIf cfg.enable {
environment.persistence."/nix/persist" = { environment.persistence."/nix/persist" = {
directories = [ directories = (map-home-dirs [
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/archive"; } "archive"
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/dev"; } "dev"
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/records"; } "records"
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/ref"; } "ref"
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/tmp"; } "tmp"
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/use"; } "use"
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/Music"; } "Music"
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/Pictures"; } "Pictures"
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/Videos"; } "Videos"
# actual monero blockchain (not wallet/etc; safe to delete, just slow to regenerate) # actual monero blockchain (not wallet/etc; safe to delete, just slow to regenerate)
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/.bitmonero"; } ".bitmonero"
# cache is probably too big to fit on the tmpfs # cache is probably too big to fit on the tmpfs
# TODO: we could bind-mount it to something which gets cleared per boot, though. # TODO: we could bind-mount it to something which gets cleared per boot, though.
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/.cache"; } ".cache"
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/.cargo"; } ".cargo"
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/.rustup"; } ".rustup"
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/.ssh"; } ".ssh"
# zcash coins. safe to delete, just slow to regenerate (10-60 minutes) # zcash coins. safe to delete, just slow to regenerate (10-60 minutes)
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/.zcash"; } ".zcash"
# intentionally omitted: # intentionally omitted:
# "/home/colin/.config" # managed by home-manager # ".config" # managed by home-manager
# "/home/colin/.local" # nothing useful in here # ".local" # nothing useful in here
# "/home/colin/.mozilla" # managed by home-manager # ".mozilla" # managed by home-manager
# creds. TODO: can i manage this with home-manager? # creds. TODO: can i manage this with home-manager?
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/.config/spotify"; } ".config/spotify"
# creds, but also 200 MB of node modules, etc # creds, but also 200 MB of node modules, etc
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/.config/discord"; } ".config/discord"
# creds/session keys, etc # creds/session keys, etc
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/.config/Element"; } ".config/Element"
# creds, media # creds, media
{ user = "colin"; group = "users"; mode = "0755"; directory = "/home/colin/.config/Signal"; } ".config/Signal"
]) ++ [
{ user = "root"; group = "root"; mode = "0700"; directory = "/etc/NetworkManager/system-connections"; } { user = "root"; group = "root"; mode = "0700"; directory = "/etc/NetworkManager/system-connections"; }
# "/etc/nixos" # "/etc/nixos"
{ user = "root"; group = "root"; mode = "0755"; directory = "/etc/ssh"; } { user = "root"; group = "root"; mode = "0755"; directory = "/etc/ssh"; }