Commit Graph

88 Commits

Author SHA1 Message Date
Archit Gupta
8bfdd263ed Add tests 2023-12-04 23:48:31 -08:00
Archit Gupta
64557b89d5 Capitalize API guide filename for discoverability 2023-12-04 23:46:21 -08:00
Archit Gupta
df7e569958 Fix documentation issues 2023-12-04 23:44:54 -08:00
Archit Gupta
cca0b23070 Allow overriding formatter entirely
Setting the `formatter` option now allows for setting the formatter
directly instead of using the provided formatting functionality with
`formatters`.
2023-11-23 16:40:06 -08:00
Archit Gupta
50982daa63 Fix flakelight.builtinFormatters option
The flakelight.builtinFormatters option was not being checked when
setting the built-in formatters.
2023-11-22 20:55:01 -08:00
Archit Gupta
87ba2051d3 Fix bundlers default value
The incorrect default value of bundlers was causing the attributes to be
exported in flakes not using bundlers.
2023-11-21 22:15:52 -08:00
Archit Gupta
ff24d5d433 Allow bundlers to be functions that take pkgs
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.
2023-11-06 23:13:47 -08:00
Archit Gupta
d7c7f4634a Add support for bundlers 2023-11-05 15:14:26 -08:00
Archit Gupta
6d00e0f544 Allow functions for NixOS or home-manager configurations
This allows a configuration to be set as a function that will be passed
autoloadArgs. This is useful when each configuration is in its own file
when autoloading.
2023-10-23 20:25:38 -07:00
Archit Gupta
e401f68030 Allow overriding of default devShell
This sets the default devShell using mkDefault, letting user set default
shells override it. Previously, to set a different default shell, one
would have to not set any of the devShell.* options and then define
devShells.default, or use mkForce.
2023-10-18 20:04:16 -07:00
Archit Gupta
fad306c589 Fix merge function for custom option types
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.
2023-10-18 20:02:24 -07:00
Archit Gupta
b0fd6a391c Fix typo in API guide 2023-09-20 20:53:50 -07:00
Archit Gupta
592cb247bf Clarify use of formatter option
The fact it uses bash is an implementation detail. Update the
documentation to state that the input is a file name glob rather than a
bash case match. Updates the default formatters to not rely on being a
bash case statement.
2023-09-16 20:59:54 -07:00
Archit Gupta
1bc31924ee Add docs and autoloads for the lib option 2023-09-14 01:36:43 -07:00
Archit Gupta
d75f8fea8b Update Rust example in README 2023-09-13 23:43:08 -07:00
Archit Gupta
a463960781 Add module for use in module flakes 2023-09-13 23:17:17 -07:00
Archit Gupta
712a66158c Add lib option 2023-09-13 23:17:17 -07:00
Archit Gupta
53f35dc91c Make mkFlake extensible with additional modules
This is intended to allow flakes implementing a flakelight module to
export a mkFlake that automatically includes its module.
2023-09-13 22:39:20 -07:00
Archit Gupta
62083df539 Add functor option for flake's __functor attribute
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.
2023-09-13 21:02:39 -07:00
Archit Gupta
46ade23b8c Add description to flakelight flake 2023-09-05 20:04:14 -07:00
Archit Gupta
b72983b29a Add statix check to flakelight flake 2023-09-04 16:59:59 -07:00
Archit Gupta
3f595f5f2c Move shorter API guide sections before module options 2023-08-30 16:58:40 -07:00
Archit Gupta
e5db2dcd86 Have formatters for each file run in parallel 2023-08-28 19:57:26 -07:00
Archit Gupta
84162f4098 Remove extra binding in example 2023-08-27 23:52:33 -07:00
Archit Gupta
39aa44f41e Add API guide 2023-08-27 23:35:32 -07:00
Archit Gupta
0e76ac9b3c Allow autoloading flakelightModules options 2023-08-27 23:35:15 -07:00
Archit Gupta
f4edb1589b Remove nixpkgs overrides from some examples 2023-08-27 18:36:21 -07:00
Archit Gupta
f684fd8b03 Shorten list of items in goals 2023-08-27 18:19:08 -07:00
Archit Gupta
1b3cb5dd5d Add nixDir example to README 2023-08-27 18:17:56 -07:00
Archit Gupta
38b798fe1c Update README 2023-08-27 18:06:30 -07:00
Archit Gupta
b27680288c Add basic flake template 2023-08-27 17:57:30 -07:00
Archit Gupta
ba7f68e4e2 Fix inf recursions in computing default package's name 2023-08-27 13:57:16 -07:00
Archit Gupta
62b7dba619 Fix args passed to autoloaded files 2023-08-27 01:19:40 -07:00
Archit Gupta
838e383c50 Export autoImportArgs to modules 2023-08-27 00:01:48 -07:00
Archit Gupta
9672921de0 Add option for extending default overlay 2023-08-26 23:46:37 -07:00
Archit Gupta
981351cfe2 Add options for flakelight modules 2023-08-26 22:57:59 -07:00
Archit Gupta
b8d9538c58 Rename project from flakelite to flakelight 2023-08-26 22:48:57 -07:00
Archit Gupta
f6c4424f6e Reimplement framework using the module system 2023-08-26 22:39:28 -07:00
Archit Gupta
4df2ca87b5 Add readme note regarding project status 2023-07-04 08:09:26 -07:00
Archit Gupta
50c4ad5cff Fix devShell attributes added at wrong level 2023-07-02 11:42:23 -07:00
Archit Gupta
412add2d01 Remove automatic use of ./. as nixDir
Using ./. as nixDir can cause confusion on repos with unrelated
directories that get picked up inadvertently.
2023-06-29 22:05:23 -07:00
Archit Gupta
af3e7f7a6f Add nixpkgsConfig to allow configuring nixpkgs 2023-05-13 20:05:21 -07:00
Archit Gupta
d871fd7cbf Use src as default nixDir if ./nix does not exist 2023-04-22 13:34:03 -07:00
Archit Gupta
f4f7a8cd37 Add aliases for autoloading root module attrs 2023-04-22 13:33:19 -07:00
Archit Gupta
f9967894bb Add support for home-manager outputs 2023-04-22 11:13:33 -07:00
Archit Gupta
7940d0c53f Add inputs and inputs' to top level of pkgs overlay 2023-04-22 10:13:01 -07:00
Archit Gupta
2c6954f018 Fix default nixDir path 2023-04-22 10:12:41 -07:00
Archit Gupta
bd68bc5c44 Make flakelite a functor as a shortcut for mkFlake 2023-04-20 19:29:56 -07:00
Archit Gupta
59ccd592a3 Allow outputs to be a functor
Previously, if outputs was a functor, it would mistakenly get called by
recUpdateSets.
2023-04-20 18:45:31 -07:00
Archit Gupta
76eb12e51b Allow root module to be a function 2023-04-20 18:26:39 -07:00