diff options
| author | Caroline Larimore <caroline@larimo.re> | 2025-02-08 14:09:56 -0800 |
|---|---|---|
| committer | Caroline Larimore <caroline@larimo.re> | 2025-04-14 18:58:50 -0700 |
| commit | d4b81d128f5e9525bd29b4771ac566e00cc831d4 (patch) | |
| tree | 5ea81e7d700e83d591a88386c993bc246352645b | |
| parent | 4b2050f8762b2880277c0762efc925991a034892 (diff) | |
migration: configure home impermanence from system
| -rw-r--r-- | snowfall/modules/home/impermanence/default.nix | 29 | ||||
| -rw-r--r-- | snowfall/modules/nixos/system/impermanence/default.nix | 22 | ||||
| -rw-r--r-- | snowfall/systems/x86_64-linux/c-pc/default.nix | 1 |
3 files changed, 35 insertions, 17 deletions
diff --git a/snowfall/modules/home/impermanence/default.nix b/snowfall/modules/home/impermanence/default.nix index c1d1a2d..f132a6a 100644 --- a/snowfall/modules/home/impermanence/default.nix +++ b/snowfall/modules/home/impermanence/default.nix @@ -1,8 +1,9 @@ -{ options, config, lib, namespace, inputs, host, ... }: +{ options, config, osConfig, lib, namespace, inputs, host, ... }: with lib; with lib.${namespace}; let - cfg = config.${namespace}.impermanence; - hosts = [ "c-pc" ]; + cfg = config.${namespace}.impermanence // { + inherit (osConfig.${namespace}.system.impermanence.home) enable location secure; + }; in { imports = [ inputs.impermanence.nixosModules.home-manager.impermanence @@ -14,22 +15,18 @@ in { default = true; }; - location = mkOption { - type = str; - default = "/persist/home"; - }; - - secure = { - location = mkOption { - type = str; - default = "/persist/secure/home"; - }; - }; + enable = mkOption { type = uniq bool; }; + location = mkOption { type = uniq str; }; + secure.location = mkOption { type = uniq str; }; }; config = { + ${namespace}.impermanence = { + inherit (cfg) enable location secure; + }; + home.persistence.${cfg.location} = { - enable = builtins.elem host hosts; + enable = cfg.enable; allowOther = true; directories = mkIf cfg.skeleton [ @@ -44,7 +41,7 @@ in { }; home.persistence.${cfg.secure.location} = { - enable = builtins.elem host hosts; + enable = cfg.enable; allowOther = false; }; }; diff --git a/snowfall/modules/nixos/system/impermanence/default.nix b/snowfall/modules/nixos/system/impermanence/default.nix index c7c86d8..b82579b 100644 --- a/snowfall/modules/nixos/system/impermanence/default.nix +++ b/snowfall/modules/nixos/system/impermanence/default.nix @@ -5,12 +5,32 @@ with lib; with lib.${namespace}; let in { options.${namespace}.system.impermanence = with types; { enable = mkEnableOption "root impermanence"; + + location = mkOption { + type = str; + default = "/persist/system"; + }; + + #TODO: multi-user support + home = { + enable = mkEnableOption "home impermanence"; + + location = mkOption { + type = str; + default = "/persist/home"; + }; + + secure.location = mkOption { + type = str; + default = "/persist/secure/home"; + }; + }; }; config = mkIf cfg.enable { programs.fuse.userAllowOther = true; - environment.persistence."/persist/system" = { + environment.persistence.${cfg.location} = { hideMounts = true; directories = [ diff --git a/snowfall/systems/x86_64-linux/c-pc/default.nix b/snowfall/systems/x86_64-linux/c-pc/default.nix index 5b98fc1..012b661 100644 --- a/snowfall/systems/x86_64-linux/c-pc/default.nix +++ b/snowfall/systems/x86_64-linux/c-pc/default.nix @@ -12,6 +12,7 @@ with lib; with lib.${namespace}; { id = "23ce94ff"; impermanence.enable = true; + impermanence.home.enable = true; fonts.nerdfonts = true; fonts.extra = with pkgs; [ |