mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-12-29 01:14:09 +03:00
70 lines
1.5 KiB
Nix
70 lines
1.5 KiB
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}: let
|
|
l = lib // builtins;
|
|
t = l.types;
|
|
in {
|
|
options.eval-cache = {
|
|
# GLOBAL OPTIONS
|
|
repoRoot = l.mkOption {
|
|
type = t.path;
|
|
description = "The root of the current repo. Eg. 'self' in a flake";
|
|
example = lib.literalExpression ''
|
|
self
|
|
'';
|
|
};
|
|
|
|
cacheFileRel = l.mkOption {
|
|
type = t.str;
|
|
description = "Location of the cache file relative to the repoRoot";
|
|
example = lib.literalExpression ''
|
|
/rel/path/to/my/package/cache.json
|
|
'';
|
|
};
|
|
|
|
# LOCAL OPTIONS
|
|
enable = l.mkEnableOption "the evaluation cache for this derivation";
|
|
|
|
content = l.mkOption {
|
|
type = t.submodule {
|
|
freeformType = t.anything;
|
|
};
|
|
};
|
|
|
|
invalidationFields = l.mkOption rec {
|
|
type = t.attrsOf (t.oneOf [t.bool type]);
|
|
description = "Fields, when changed, require refreshing the cache";
|
|
default = {};
|
|
example = {
|
|
src = true;
|
|
};
|
|
};
|
|
|
|
fields = l.mkOption rec {
|
|
type = t.attrsOf (t.oneOf [t.bool type]);
|
|
description = "Fields for which to cache evaluation";
|
|
default = {};
|
|
example = {
|
|
pname = true;
|
|
version = true;
|
|
};
|
|
};
|
|
|
|
# INTERNAL OPTIONS
|
|
newFile = l.mkOption {
|
|
type = t.path;
|
|
description = "Cache file generated from the current inputs";
|
|
internal = true;
|
|
readOnly = true;
|
|
};
|
|
|
|
refresh = l.mkOption {
|
|
type = t.path;
|
|
description = "Script to refresh the cache file of this package";
|
|
readOnly = true;
|
|
};
|
|
};
|
|
}
|