1
0
Fork 0
mirror of https://cgit.krebsco.de/krops synced 2024-11-01 00:39:48 +01:00

populate: add derivation type

This commit is contained in:
lassulus 2018-12-01 04:20:50 +01:00
parent eb68146cc4
commit 140bdfdf6c
2 changed files with 19 additions and 0 deletions

View file

@ -11,6 +11,14 @@
else throw "cannot determine type"; else throw "cannot determine type";
type = lib.types.enum known-types; type = lib.types.enum known-types;
}; };
derivation = lib.mkOption {
apply = x:
if lib.types.str.check x
then { text = x; }
else x;
default = null;
type = lib.types.nullOr (lib.types.either lib.types.str source-types.derivation);
};
file = lib.mkOption { file = lib.mkOption {
apply = x: apply = x:
if lib.types.absolute-pathname.check x if lib.types.absolute-pathname.check x
@ -47,6 +55,13 @@
}); });
source-types = { source-types = {
derivation = lib.types.submodule {
options = {
text = lib.mkOption {
type = lib.types.str;
};
};
};
file = lib.types.submodule { file = lib.types.submodule {
options = { options = {
path = lib.mkOption { path = lib.mkOption {

View file

@ -20,6 +20,10 @@ let
fi fi
''; '';
pop.derivation = target: source: shell' target /* sh */ ''
nix-build -E ${quote source.text} -o ${quote target.path}
'';
pop.file = target: source: let pop.file = target: source: let
configAttrs = ["useChecksum"]; configAttrs = ["useChecksum"];
config = filterAttrs (name: _: elem name configAttrs) source; config = filterAttrs (name: _: elem name configAttrs) source;