From 55c77539b662cf2e1745b1c3d8e458f3cbf73731 Mon Sep 17 00:00:00 2001 From: Caroline Larimore Date: Fri, 7 Feb 2025 21:11:17 -0800 Subject: migration: home impermanence --- snowfall/modules/home/impermanence/default.nix | 50 ++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 snowfall/modules/home/impermanence/default.nix (limited to 'snowfall/modules/home/impermanence/default.nix') diff --git a/snowfall/modules/home/impermanence/default.nix b/snowfall/modules/home/impermanence/default.nix new file mode 100644 index 0000000..1b92bca --- /dev/null +++ b/snowfall/modules/home/impermanence/default.nix @@ -0,0 +1,50 @@ +{ options, config, lib, namespace, inputs, host, ... }: + +with lib; with lib.${namespace}; let + cfg = config.${namespace}.impermanence; + hosts = [ "c-pc" ]; +in { + imports = [ + inputs.impermanence.nixosModules.home-manager.impermanence + ]; + + options.${namespace}.impermanence = with types; { + skeleton = mkOption { + type = bool; + default = true; + }; + + location = mkOption { + type = str; + default = "/persist/home"; + }; + + secure = { + location = mkOption { + type = str; + default = "/persist/secure/home"; + }; + }; + }; + + config = { + home.persistence.${cfg.location} = { + enable = builtins.elem host hosts; + allowOther = true; + + directories = mkIf cfg.skeleton [ + "Downloads" + "Documents" + "Pictures" + "Videos" + "Music" + "Games" + "Persist" + ]; + }; + + home.persistence.${cfg.secure.location} = { + enable = builtins.elem host hosts; + }; + }; +} -- cgit v1.2.3