From 80ecdcc4f95c97eebcbbfc6d28f7a5b36fd6cb97 Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 23 Feb 2024 04:16:17 +0000 Subject: [PATCH] persist: plaintext: consider "/mnt/persist/plaintext" as the logical root, and abstract away "/nix/persist" --- modules/persist/stores/crypt.nix | 2 +- modules/persist/stores/plaintext.nix | 16 ++++++++++------ modules/persist/stores/private.nix | 3 ++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/modules/persist/stores/crypt.nix b/modules/persist/stores/crypt.nix index b8670db1..2d36dad9 100644 --- a/modules/persist/stores/crypt.nix +++ b/modules/persist/stores/crypt.nix @@ -1,7 +1,7 @@ { config, lib, pkgs, sane-lib, utils, ... }: let - persist-base = config.sane.persist.stores."plaintext".origin; + persist-base = "/nix/persist"; device = config.sane.persist.stores."cryptClearOnBoot".origin; key = "${device}.key"; underlying = sane-lib.path.concat [ persist-base "crypt/clearedonboot" ]; diff --git a/modules/persist/stores/plaintext.nix b/modules/persist/stores/plaintext.nix index de511b88..34bdeb61 100644 --- a/modules/persist/stores/plaintext.nix +++ b/modules/persist/stores/plaintext.nix @@ -1,11 +1,15 @@ { config, lib, ... }: let - cfg = config.sane.persist; -in lib.mkIf cfg.enable { - sane.persist.stores."plaintext" = lib.mkDefault { - origin = "/nix/persist"; + # TODO: parameterize! + persist-base = "/nix/persist"; + plaintext-dir = config.sane.persist.stores."plaintext".origin; + plaintext-backing-dir = persist-base; #< TODO: scope this! +in lib.mkIf config.sane.persist.enable { + sane.persist.stores."plaintext" = { + origin = lib.mkDefault "/mnt/persist/plaintext"; }; - # TODO: needed? - # sane.fs."/nix".mount = {}; + + # TODO: scope this! + sane.fs."${plaintext-dir}".mount.bind = plaintext-backing-dir; } diff --git a/modules/persist/stores/private.nix b/modules/persist/stores/private.nix index 640fb7ac..dd49825a 100644 --- a/modules/persist/stores/private.nix +++ b/modules/persist/stores/private.nix @@ -1,7 +1,8 @@ { config, lib, pkgs, sane-lib, utils, ... }: let - persist-base = config.sane.persist.stores."plaintext".origin; + # TODO: parameterize! + persist-base = "/nix/persist"; private-dir = config.sane.persist.stores."private".origin; private-backing-dir = sane-lib.path.concat [ persist-base private-dir ]; in