refactor(nixos): use new persistDirs option and remove environment.persistence where possible
This commit is contained in:
parent
16b7f375bd
commit
77d8ed7a13
9 changed files with 98 additions and 36 deletions
46
modules/nixos/default.nix
Normal file
46
modules/nixos/default.nix
Normal file
|
@ -0,0 +1,46 @@
|
|||
{ lib, config, ... }:
|
||||
let
|
||||
inherit (lib) mkOption;
|
||||
inherit (lib.types)
|
||||
listOf
|
||||
str
|
||||
coercedTo
|
||||
submodule
|
||||
;
|
||||
rootDir = submodule {
|
||||
options = {
|
||||
directory = mkOption { type = str; };
|
||||
user = mkOption {
|
||||
type = str;
|
||||
default = "root";
|
||||
};
|
||||
group = mkOption {
|
||||
type = str;
|
||||
default = "root";
|
||||
};
|
||||
mode = mkOption {
|
||||
type = str;
|
||||
default = "0755";
|
||||
};
|
||||
};
|
||||
};
|
||||
in
|
||||
{
|
||||
options = {
|
||||
persistDirs = mkOption {
|
||||
type = listOf (coercedTo str (d: { directory = d; }) rootDir);
|
||||
default = [ ];
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
# Helper options
|
||||
environment.persistence."/persist".directories = config.persistDirs;
|
||||
|
||||
# Global options
|
||||
persistDirs = [
|
||||
"/var/lib/systemd"
|
||||
"/var/lib/nixos"
|
||||
];
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue