refactor(modules): clean up folder structure
This commit is contained in:
parent
d8aa7f62b4
commit
03fca8b28b
12 changed files with 32 additions and 38 deletions
|
@ -1,63 +0,0 @@
|
|||
{
|
||||
lib,
|
||||
inputs,
|
||||
config,
|
||||
...
|
||||
}:
|
||||
let
|
||||
inherit (lib.options) mkOption;
|
||||
inherit (config.flake.lib.options) mkStrOption;
|
||||
inherit (lib.types)
|
||||
listOf
|
||||
str
|
||||
coercedTo
|
||||
submodule
|
||||
;
|
||||
permOpts = {
|
||||
user = mkStrOption "root";
|
||||
group = mkStrOption "root";
|
||||
mode = mkStrOption "0755";
|
||||
};
|
||||
mkOpts =
|
||||
type: opts:
|
||||
mkOption {
|
||||
default = [ ];
|
||||
type = listOf (
|
||||
coercedTo str (d: { ${type} = d; }) (submodule {
|
||||
options = {
|
||||
${type} = mkStrOption "";
|
||||
} // opts;
|
||||
})
|
||||
);
|
||||
};
|
||||
in
|
||||
{
|
||||
flake.modules.nixos.default =
|
||||
{ config, ... }:
|
||||
{
|
||||
imports = [ inputs.impermanence.nixosModules.impermanence ];
|
||||
options.persistDirs = mkOpts "directory" permOpts;
|
||||
options.persistFiles = mkOpts "file" { parentDirectory = permOpts; };
|
||||
config = {
|
||||
programs.fuse.userAllowOther = true;
|
||||
fileSystems."/persist".neededForBoot = true;
|
||||
environment.persistence."/persist" = {
|
||||
hideMounts = true;
|
||||
directories = config.persistDirs;
|
||||
files = config.persistFiles;
|
||||
};
|
||||
};
|
||||
};
|
||||
flake.modules.homeManager.default =
|
||||
{ config, ... }:
|
||||
{
|
||||
imports = [ inputs.impermanence.homeManagerModules.impermanence ];
|
||||
options.persistDirs = mkOpts "directory" { };
|
||||
options.persistFiles = mkOpts "file" { };
|
||||
config.home.persistence."/persist${config.home.homeDirectory}" = {
|
||||
allowOther = true;
|
||||
directories = config.persistDirs;
|
||||
files = config.persistFiles;
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue