{ config, lib, ... }: with lib; let cfg = config.modules.persistence; in { options.modules.persistence = { enable = mkEnableOption "impermanence persistence"; storagePath = lib.mkOption { type = types.path; description = '' The path to persistent storage where the real files and directories should be stored. ''; }; directories = mkOption { type = types.listOf types.str; default = [ ]; }; }; config = mkIf cfg.enable { fileSystems.${cfg.storagePath}.neededForBoot = true; environment.persistence.${cfg.storagePath}.directories = cfg.directories; services.openssh.hostKeys = [ { path = "${cfg.storagePath}/ssh/ssh_host_ed25519_key"; type = "ed25519"; } { path = "${cfg.storagePath}/ssh/ssh_host_rsa_key"; type = "rsa"; bits = 4096; } ]; }; }