52 lines
1.2 KiB
Nix
52 lines
1.2 KiB
Nix
args @ {lib, ...}: {name, ...}: let
|
|
datasetSubmodule = (import ./dataset.nix) args;
|
|
pathPermissions = {
|
|
read = lib.mkEnableOption "should the path have read permissions";
|
|
write = lib.mkEnableOption "should the path have read permissions";
|
|
execute = lib.mkEnableOption "should the path have read permissions";
|
|
};
|
|
pathTypeSubmodule = {name, ...}: {
|
|
options = {
|
|
enable = lib.mkOption {
|
|
type = lib.types.bool;
|
|
default = true;
|
|
};
|
|
owner = {
|
|
name = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "root";
|
|
};
|
|
permissions = pathPermissions;
|
|
};
|
|
group = {
|
|
name = lib.mkOption {
|
|
type = lib.types.str;
|
|
default = "root";
|
|
};
|
|
permissions = pathPermissions;
|
|
};
|
|
other = {
|
|
permissions = pathPermissions;
|
|
};
|
|
};
|
|
};
|
|
in {
|
|
imports = [
|
|
datasetSubmodule
|
|
];
|
|
|
|
options = {
|
|
files = lib.mkOption {
|
|
type = lib.types.attrsOf (lib.types.submodule pathTypeSubmodule);
|
|
default = {};
|
|
};
|
|
directories = lib.mkOption {
|
|
type = lib.types.attrsOf (lib.types.submodule pathTypeSubmodule);
|
|
default = {};
|
|
};
|
|
};
|
|
|
|
config = {
|
|
mount = lib.mkDefault "/${name}";
|
|
};
|
|
}
|