Compare commits
4 commits
37f5e65bd6
...
ac0f1ce2e6
| Author | SHA1 | Date | |
|---|---|---|---|
| ac0f1ce2e6 | |||
| 8aa984a389 | |||
| 61eef3067e | |||
| d06c25f33f |
42 changed files with 134 additions and 157 deletions
|
|
@ -12,7 +12,7 @@
|
||||||
];
|
];
|
||||||
|
|
||||||
config = {
|
config = {
|
||||||
impermanence.enable = osConfig.host.impermanence.enable;
|
impermanence.enable = osConfig.storage.impermanence.enable;
|
||||||
|
|
||||||
# Home Manager needs a bit of information about you and the paths it should
|
# Home Manager needs a bit of information about you and the paths it should
|
||||||
# manage.
|
# manage.
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
config = lib.mkIf (config.impermanence.enable) {
|
config = lib.mkIf (config.impermanence.enable) {
|
||||||
home.persistence."/persist/home/leyla" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"desktop"
|
"desktop"
|
||||||
"downloads"
|
"downloads"
|
||||||
|
|
@ -14,7 +14,6 @@
|
||||||
".bash_history" # keep shell history around
|
".bash_history" # keep shell history around
|
||||||
"${config.xdg.dataHome}/recently-used.xbel" # gnome recently viewed files
|
"${config.xdg.dataHome}/recently-used.xbel" # gnome recently viewed files
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
19
flake.lock
generated
19
flake.lock
generated
|
|
@ -147,16 +147,25 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"impermanence": {
|
"impermanence": {
|
||||||
|
"inputs": {
|
||||||
|
"home-manager": [
|
||||||
|
"home-manager"
|
||||||
|
],
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1737831083,
|
"lastModified": 1762761176,
|
||||||
"narHash": "sha256-LJggUHbpyeDvNagTUrdhe/pRVp4pnS6wVKALS782gRI=",
|
"narHash": "sha256-i3gM8fUozQrgZIbwVNlTuhLqPSl56zxAYpsQpQ9Lhro=",
|
||||||
"owner": "nix-community",
|
"owner": "jan-leila",
|
||||||
"repo": "impermanence",
|
"repo": "impermanence",
|
||||||
"rev": "4b3e914cdf97a5b536a889e939fb2fd2b043a170",
|
"rev": "ffbe1ca47cf4b3008c3aa5c49cdae294d8c8058a",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "nix-community",
|
"owner": "jan-leila",
|
||||||
|
"ref": "home-manager-v2",
|
||||||
"repo": "impermanence",
|
"repo": "impermanence",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,9 @@
|
||||||
|
|
||||||
# delete your darlings
|
# delete your darlings
|
||||||
impermanence = {
|
impermanence = {
|
||||||
url = "github:nix-community/impermanence";
|
url = "github:jan-leila/impermanence/home-manager-v2";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.home-manager.follows = "home-manager";
|
||||||
};
|
};
|
||||||
|
|
||||||
nix-darwin = {
|
nix-darwin = {
|
||||||
|
|
|
||||||
|
|
@ -18,17 +18,16 @@ in {
|
||||||
(lib.mkIf config.impermanence.enable {
|
(lib.mkIf config.impermanence.enable {
|
||||||
assertions = [
|
assertions = [
|
||||||
{
|
{
|
||||||
assertion = osConfig.host.impermanence.enable;
|
assertion = osConfig.storage.impermanence.enable;
|
||||||
message = "impermanence can not be enabled for a user when it is not enabled for the system";
|
message = "impermanence can not be enabled for a user when it is not enabled for the system";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
})
|
})
|
||||||
# If impermanence is not enabled for this user but system impermanence is enabled,
|
# If impermanence is not enabled for this user but system impermanence is enabled,
|
||||||
# persist the entire home directory as fallback
|
# persist the entire home directory as fallback
|
||||||
(lib.mkIf (osConfig.host.impermanence.enable && !cfg.enable && cfg.fallbackPersistence.enable) {
|
(lib.mkIf (osConfig.storage.impermanence.enable && !cfg.enable && cfg.fallbackPersistence.enable) {
|
||||||
home.persistence."/persist/home/${config.home.username}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = ["."];
|
directories = ["."];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -96,7 +96,7 @@
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
(lib.mkIf config.impermanence.enable {
|
(lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
files = lib.lists.flatten (
|
files = lib.lists.flatten (
|
||||||
builtins.map (hostKey: [".ssh/${hostKey.path}" ".ssh/${hostKey.path}.pub"]) config.programs.openssh.hostKeys
|
builtins.map (hostKey: [".ssh/${hostKey.path}" ".ssh/${hostKey.path}.pub"]) config.programs.openssh.hostKeys
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,13 @@
|
||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
config,
|
config,
|
||||||
osConfig,
|
|
||||||
...
|
...
|
||||||
}: {
|
}: {
|
||||||
config = lib.mkIf (config.programs.anki.enable && osConfig.host.impermanence.enable) {
|
config = lib.mkIf (config.programs.anki.enable && config.impermanence.enable) {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.dataHome}/Anki2/"
|
".local/share/Anki2"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/Bitwarden"
|
"${config.xdg.configHome}/Bitwarden"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/bruno/"
|
"${config.xdg.configHome}/bruno/"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/calibre"
|
"${config.xdg.configHome}/calibre"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,11 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.dataHome}/DaVinciResolve"
|
"${config.xdg.dataHome}/DaVinciResolve"
|
||||||
"${config.xdg.configHome}/blackmagic"
|
"${config.xdg.configHome}/blackmagic"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.dataHome}/DBeaverData/"
|
"${config.xdg.dataHome}/DBeaverData/"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/discord/"
|
"${config.xdg.configHome}/discord/"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -22,11 +22,10 @@
|
||||||
# Extension configuration
|
# Extension configuration
|
||||||
".mozilla/firefox/${profile}/extension-settings.json"
|
".mozilla/firefox/${profile}/extension-settings.json"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf (config.programs.firefox.enable && config.impermanence.enable) {
|
config = lib.mkIf (config.programs.firefox.enable && config.impermanence.enable) {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = lib.mkMerge (
|
home.persistence."/persist/home" = lib.mkMerge (
|
||||||
(
|
(
|
||||||
lib.attrsets.mapAttrsToList
|
lib.attrsets.mapAttrsToList
|
||||||
(profile: _: buildProfilePersistence profile)
|
(profile: _: buildProfilePersistence profile)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/FreeCAD"
|
"${config.xdg.configHome}/FreeCAD"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/GIMP"
|
"${config.xdg.configHome}/GIMP"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
# configuration
|
# configuration
|
||||||
"${config.xdg.configHome}/JetBrains/"
|
"${config.xdg.configHome}/JetBrains/"
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/inkscape"
|
"${config.xdg.configHome}/inkscape"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,11 @@ in {
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/kdenliverc"
|
"${config.xdg.configHome}/kdenliverc"
|
||||||
"${config.xdg.dataHome}/kdenlive"
|
"${config.xdg.dataHome}/kdenlive"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,11 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/kritarc"
|
"${config.xdg.configHome}/kritarc"
|
||||||
"${config.xdg.dataHome}/krita"
|
"${config.xdg.dataHome}/krita"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/libreoffice"
|
"${config.xdg.configHome}/libreoffice"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
".MakeMKV"
|
".MakeMKV"
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -17,12 +17,11 @@ in {
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
mkIf config.impermanence.enable {
|
mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/mapillary-uploader"
|
"${config.xdg.configHome}/mapillary-uploader"
|
||||||
"${config.xdg.dataHome}/mapillary-uploader"
|
"${config.xdg.dataHome}/mapillary-uploader"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -6,11 +6,10 @@
|
||||||
config = lib.mkIf config.programs.obs-studio.enable (lib.mkMerge [
|
config = lib.mkIf config.programs.obs-studio.enable (lib.mkMerge [
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/obs-studio"
|
"${config.xdg.configHome}/obs-studio"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@
|
||||||
config = lib.mkIf config.programs.obsidian.enable (lib.mkMerge [
|
config = lib.mkIf config.programs.obsidian.enable (lib.mkMerge [
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/obsidian"
|
"${config.xdg.configHome}/obsidian"
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -23,12 +23,11 @@ in {
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/olympus"
|
"${config.xdg.configHome}/olympus"
|
||||||
"${config.xdg.dataHome}/olympus"
|
"${config.xdg.dataHome}/olympus"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/OpenRGB"
|
"${config.xdg.configHome}/OpenRGB"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/MusicBrainz"
|
"${config.xdg.configHome}/MusicBrainz"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/ProStudioMasters"
|
"${config.xdg.configHome}/ProStudioMasters"
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/protonvpn"
|
"${config.xdg.configHome}/protonvpn"
|
||||||
"${config.xdg.configHome}/Proton"
|
"${config.xdg.configHome}/Proton"
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/qBittorrent"
|
"${config.xdg.configHome}/qBittorrent"
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/qFlipper"
|
"${config.xdg.configHome}/qFlipper"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/Signal"
|
"${config.xdg.configHome}/Signal"
|
||||||
];
|
];
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,13 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
{
|
{
|
||||||
directory = "${config.xdg.dataHome}/Steam";
|
directory = "${config.xdg.dataHome}/Steam";
|
||||||
method = "symlink";
|
method = "symlink";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.dataHome}/torbrowser"
|
"${config.xdg.dataHome}/torbrowser"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,10 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/chromium"
|
"${config.xdg.configHome}/chromium"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,11 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
"${config.xdg.configHome}/via"
|
"${config.xdg.configHome}/via"
|
||||||
"${config.xdg.dataHome}/via"
|
"${config.xdg.dataHome}/via"
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
}
|
}
|
||||||
(
|
(
|
||||||
lib.mkIf config.impermanence.enable {
|
lib.mkIf config.impermanence.enable {
|
||||||
home.persistence."/persist${config.home.homeDirectory}" = {
|
home.persistence."/persist/home" = {
|
||||||
directories = [
|
directories = [
|
||||||
{
|
{
|
||||||
directory = ".vmware";
|
directory = ".vmware";
|
||||||
|
|
@ -28,7 +28,6 @@
|
||||||
method = "symlink";
|
method = "symlink";
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
allowOther = true;
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,15 @@ in {
|
||||||
|
|
||||||
programs.fuse.userAllowOther = true;
|
programs.fuse.userAllowOther = true;
|
||||||
|
|
||||||
|
fileSystems =
|
||||||
|
lib.mapAttrs' (
|
||||||
|
datasetName: dataset:
|
||||||
|
lib.nameValuePair "/${datasetName}" {
|
||||||
|
neededForBoot = true;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
config.storage.impermanence.datasets;
|
||||||
|
|
||||||
environment.persistence =
|
environment.persistence =
|
||||||
lib.mapAttrs (datasetName: dataset: {
|
lib.mapAttrs (datasetName: dataset: {
|
||||||
enable = true;
|
enable = true;
|
||||||
|
|
@ -101,7 +110,6 @@ in {
|
||||||
}) (lib.filterAttrs (_: fileConfig: fileConfig.enable) dataset.files);
|
}) (lib.filterAttrs (_: fileConfig: fileConfig.enable) dataset.files);
|
||||||
})
|
})
|
||||||
config.storage.impermanence.datasets;
|
config.storage.impermanence.datasets;
|
||||||
# TODO: need for boot on filesystems
|
|
||||||
}
|
}
|
||||||
(lib.mkIf config.storage.zfs.enable {
|
(lib.mkIf config.storage.zfs.enable {
|
||||||
storage.zfs.datasets =
|
storage.zfs.datasets =
|
||||||
|
|
|
||||||
|
|
@ -35,17 +35,19 @@
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
(lib.mkIf (!config.storage.impermanence.enable) {
|
(lib.mkIf (!config.storage.impermanence.enable) {
|
||||||
# TODO: create datasets for systemd.services.<name>.storage.impermanence.datasets
|
storage.zfs.rootDataset = {
|
||||||
storage.zfs.datasets = {
|
type = "zfs_fs";
|
||||||
"persist/system/root" = {
|
mount = {
|
||||||
type = "zfs_fs";
|
enable = true;
|
||||||
mount = {
|
mountPoint = "/";
|
||||||
enable = false;
|
};
|
||||||
mountPoint = "/";
|
compression = "lz4";
|
||||||
};
|
acltype = "posixacl";
|
||||||
snapshot = {
|
relatime = "on";
|
||||||
autoSnapshot = true;
|
xattr = "sa";
|
||||||
};
|
snapshot = {
|
||||||
|
autoSnapshot = true;
|
||||||
|
blankSnapshot = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
@ -70,8 +72,8 @@
|
||||||
storage.impermanence.datasets = {
|
storage.impermanence.datasets = {
|
||||||
"persist/system/root" = {
|
"persist/system/root" = {
|
||||||
mount = {
|
mount = {
|
||||||
enable = false;
|
enable = true;
|
||||||
mountPoint = "/";
|
mountPoint = "/persist/system/root";
|
||||||
};
|
};
|
||||||
directories = {
|
directories = {
|
||||||
"/var/lib/nixos".enable = true;
|
"/var/lib/nixos".enable = true;
|
||||||
|
|
@ -81,6 +83,12 @@
|
||||||
"/etc/machine-id".enable = true;
|
"/etc/machine-id".enable = true;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
"persist/home" = {
|
||||||
|
mount = {
|
||||||
|
enable = true;
|
||||||
|
mountPoint = "/persist/home";
|
||||||
|
};
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# TODO: home-manager.users.<user>.storage.impermanence.enable
|
# TODO: home-manager.users.<user>.storage.impermanence.enable
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,14 @@ args @ {lib, ...}: {name, ...}: let
|
||||||
owner = {
|
owner = {
|
||||||
name = lib.mkOption {
|
name = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "nouser";
|
default = "root";
|
||||||
};
|
};
|
||||||
permissions = pathPermissions;
|
permissions = pathPermissions;
|
||||||
};
|
};
|
||||||
group = {
|
group = {
|
||||||
name = lib.mkOption {
|
name = lib.mkOption {
|
||||||
type = lib.types.str;
|
type = lib.types.str;
|
||||||
default = "nogroup";
|
default = "root";
|
||||||
};
|
};
|
||||||
permissions = pathPermissions;
|
permissions = pathPermissions;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -400,74 +400,52 @@ in {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
(lib.mkIf config.storage.impermanence.enable (lib.mkMerge [
|
(lib.mkIf config.storage.impermanence.enable (lib.mkMerge [
|
||||||
(lib.mkIf config.storage.zfs.enable {
|
(lib.mkIf config.storage.zfs.enable (lib.mkMerge [
|
||||||
storage.zfs.datasets."persist/system/sops" = {
|
{
|
||||||
type = "zfs_fs";
|
# sops age key needs to be available to pre persist for user generation
|
||||||
mount = {
|
storage.zfs.datasets = lib.mkMerge [
|
||||||
enable = true;
|
{
|
||||||
mountPoint = SOPS_AGE_KEY_DIRECTORY;
|
"local/system/sops" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mount = {
|
||||||
|
enable = true;
|
||||||
|
mountPoint = SOPS_AGE_KEY_DIRECTORY;
|
||||||
|
};
|
||||||
|
atime = "off";
|
||||||
|
relatime = "off";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
(lib.mkMerge (
|
||||||
|
builtins.map (user: {
|
||||||
|
"local/home/${user.name}" = {
|
||||||
|
type = "zfs_fs";
|
||||||
|
mount = {
|
||||||
|
enable = true;
|
||||||
|
mountPoint = "/home/${user.name}";
|
||||||
|
};
|
||||||
|
snapshot.blankSnapshot = true;
|
||||||
|
};
|
||||||
|
})
|
||||||
|
normalUsers
|
||||||
|
))
|
||||||
|
];
|
||||||
|
|
||||||
|
# Post resume commands to rollback user home datasets to blank snapshots
|
||||||
|
boot.initrd.postResumeCommands = lib.mkAfter (
|
||||||
|
lib.strings.concatLines (builtins.map (user: "zfs rollback -r rpool/local/home/${user.name}@blank")
|
||||||
|
normalUsers)
|
||||||
|
);
|
||||||
|
|
||||||
|
# Create persist home directories with proper permissions
|
||||||
|
systemd = {
|
||||||
|
tmpfiles.rules =
|
||||||
|
builtins.map (
|
||||||
|
user: "d /persist/home/${user.name} 700 ${user.name} ${user.name} -"
|
||||||
|
)
|
||||||
|
normalUsers;
|
||||||
};
|
};
|
||||||
atime = "off";
|
}
|
||||||
relatime = "off";
|
]))
|
||||||
};
|
|
||||||
})
|
|
||||||
]))
|
]))
|
||||||
# (lib.mkIf config.host.impermanence.enable {
|
|
||||||
# boot.initrd.postResumeCommands = lib.mkAfter (
|
|
||||||
# lib.strings.concatLines (builtins.map (user: "zfs rollback -r rpool/local/home/${user.name}@blank")
|
|
||||||
# normalUsers)
|
|
||||||
# );
|
|
||||||
|
|
||||||
# systemd = {
|
|
||||||
# tmpfiles.rules =
|
|
||||||
# builtins.map (
|
|
||||||
# user: "d /persist/home/${user.name} 700 ${user.name} ${user.name} -"
|
|
||||||
# )
|
|
||||||
# normalUsers;
|
|
||||||
# };
|
|
||||||
|
|
||||||
# fileSystems = lib.mkMerge [
|
|
||||||
# (
|
|
||||||
# builtins.listToAttrs (
|
|
||||||
# builtins.map (user:
|
|
||||||
# lib.attrsets.nameValuePair "/persist/home/${user.name}" {
|
|
||||||
# neededForBoot = true;
|
|
||||||
# })
|
|
||||||
# normalUsers
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
# (
|
|
||||||
# builtins.listToAttrs (
|
|
||||||
# builtins.map (user:
|
|
||||||
# lib.attrsets.nameValuePair "/home/${user.name}" {
|
|
||||||
# neededForBoot = true;
|
|
||||||
# })
|
|
||||||
# normalUsers
|
|
||||||
# )
|
|
||||||
# )
|
|
||||||
# ];
|
|
||||||
|
|
||||||
# host.storage.pool.extraDatasets = lib.mkMerge (
|
|
||||||
# (
|
|
||||||
# builtins.map (user: {
|
|
||||||
# "local/home/${user.name}" = {
|
|
||||||
# type = "zfs_fs";
|
|
||||||
# mountpoint = "/home/${user.name}";
|
|
||||||
# options = {
|
|
||||||
# canmount = "on";
|
|
||||||
# };
|
|
||||||
# postCreateHook = ''
|
|
||||||
# zfs snapshot rpool/local/home/${user.name}@blank
|
|
||||||
# '';
|
|
||||||
# };
|
|
||||||
# "persist/home/${user.name}" = {
|
|
||||||
# type = "zfs_fs";
|
|
||||||
# mountpoint = "/persist/home/${user.name}";
|
|
||||||
# };
|
|
||||||
# })
|
|
||||||
# normalUsers
|
|
||||||
# )
|
|
||||||
# );
|
|
||||||
# })
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue