Open qknight opened 7 years ago
You can have your derivation produce valid Nix code representing the result of the nginx check and import
the result of it, but that has some awkward properties that makes it less than ideal. For local NixOS configuration it's probably fine, but some folks might not like it going into nixpkgs like that.
I marked this as stale due to inactivity. → More info
motivation
in nix one can use the
apply -> x: if (x > 5) then x else abort "argument must be > 5"
function to validate values assigned to a typed option. this is great for types which can be easilty validate inside the nix language already but in the scenario below i want to use an external programnginx
to validate it.here is my
mkOption
:i put together a test using a
mkDerivation
, in which i basically execute:nginx -t -c nginx.conf
. however, this can't use this for theapply
function asmkDerivation
returns a string/path like/nix/store/02f0af0af-foo/
andapply
requiresx
itself!in theory i could use
builtins.exec
but it is disabled by default. so what can i do about that?