In addition to a regular bundler of the form `x: x`, this allows setting
bundler options to a function of the form `pkgs: x: x` which is passed
the package set for the system (for example: `{ hello, ... }: x: hello`
to always return hello). This allows, in particular, an autoloaded
bundler in its own file to access the package set.
This is non-trivial as we must tell `x: x` and `pkgs: x: x` apart.
Fortunately, given some derivation `drv`, `pkgs // drv` is a valid
derivation and a set with attr names matching pkgs. When applying this
to the function, if it returns a derivation, it was of the `x: x` form,
and if it returns a function, it was of the `pkgs: x: x` form.
In order to prevent IFD when evaluating the flake if the bundler is of
form `x: x` and uses IFD, we determine the form and apply pkgs when
applying the bundler instead of during flake evaluation. This is done by
wrapping the bundler.
Of note, we cannot rely on `builtins.functionArgs`, since
`pkgs: { hello, ... }: (x: hello) pkgs` is the same as the inner
function but with args hidden.
If merge is not set for an option type, it will use the default merge
function; this was not what was intended. Updated the merge values for
options that did not set one to mergeOneOption or mergeEqualOption.
This allows for conveniently making flakes callable.
Setting this is expected to be uncommon in general, but having the
option is useful as flakelight module flakes can use this to reduce the
boilerplate in using them.
This allows having a dir for which loadNixDir generates a "default" attr
without making the dir importable, by naming the file `+default.nix`
instead of `default.nix`.
Using lib.getExe makes mkApp not work for derivations that are files.
Thus, this makes it so that the derivation is used as is. If an
executable in the derivation's directory is needed, a string path can be
used.
This allows attrs that previously did not take args to receive args
including the flakelite lib attrs and module parameters.
`withOverlay` and `withPackage` are excluded as it would be ambiguous
since those are already functions. They are also short forms; if args
are needed, the regular plural attr can be used.
These args are also added to the flakelite pkgs attr for per-system
attrs to take advantage of.