athyfr
1
I’m making a custom module for myself, and I’ve found it necessary to define an argument (i.e. mkOption) that takes in a function.
I’ve tried using functionTo, but I couldn’t figure out how to get it to work, and documentation on it is lacking.
How do I do this?
As an example that might help, this is how I use it in one of my modules:
build = lib.mkOption {
type = lib.types.functionTo lib.types.package;
default = cfg: import ./disk-image-builder.nix {
inherit lib pkgs;
config = cfg;
};
description = "Function that builds the disk image.";
};
There’s no existing type for this. Only function output type is defined.
You can of course make your own custom type.