37 lines
871 B
Nix
37 lines
871 B
Nix
|
{ config, lib, pkgs, ... }:
|
||
|
with lib;
|
||
|
let
|
||
|
cfg = config.dbzfs;
|
||
|
in {
|
||
|
options.dbzfs = {
|
||
|
enable = mkEnableOption "dbzfs" // {
|
||
|
default = true;
|
||
|
};
|
||
|
package = mkPackageOption pkgs "zfs" {};
|
||
|
managedRoot = mkOption {
|
||
|
default = null;
|
||
|
example = literalExpression "\"rpool/data\"";
|
||
|
description = mdDoc "Root dataset which is managed by dbzfs.";
|
||
|
type = types.str;
|
||
|
};
|
||
|
|
||
|
datasets = mkOption {
|
||
|
default = [];
|
||
|
example = literalExpression "TODO";
|
||
|
description = mdDoc "List of datasets to set up with dbzfs";
|
||
|
type = types.listOf types.anything; # todo
|
||
|
};
|
||
|
};
|
||
|
|
||
|
config = mkIf cfg.enable {
|
||
|
assertions = [{
|
||
|
assertion = cfg.managedRoot != null;
|
||
|
message = "dbzfs is enabled but dbzfs.managedRoot is not defined!";
|
||
|
}];
|
||
|
|
||
|
system.activationScripts.dbzfs = ''
|
||
|
echo meow
|
||
|
'';
|
||
|
};
|
||
|
}
|