Commit Graph

122 Commits

Author SHA1 Message Date
Archit Gupta
cf3a2e5496 Remove re-application check in propagationModule
Home-manager does not actually use it's pkgs argument for packages, so
the overlays will not be applied twice.
2024-01-14 00:34:35 -08:00
Archit Gupta
1b51df0be3 Add propogationModule feature
The `propagationModule` config option provides a module that can be used
to propagate flakelight configuration into other module systems such as
NixOS or home-manager.
2024-01-13 18:04:31 -08:00
Archit Gupta
333a383ff0 Simplify mock builders that get name from attrs 2024-01-12 01:52:55 -08:00
Archit Gupta
6263b349c3 Fix text wrapping for import in core.nix 2024-01-12 01:26:49 -08:00
Archit Gupta
817f6775b6 Fix option type for formatter
Since formatters are system dependent, the formatter option must be a
function.
2024-01-12 01:26:03 -08:00
Archit Gupta
9099db6c84 Avoid evaluating packages twice
Previously, the packages outputs would be evalutated using callPackage
on the package set, but the package set already contains the package. If
another package depends on it, the dependency would be the version from
the package set. By grabbing the packages from the package set, each
package only needs to be evaluated once.
2024-01-12 00:45:22 -08:00
Archit Gupta
99d8fc8a85 Use mocked builders to get default pkg name faster
Since evaluating pkgs is expensive, this speeds up evaluation of flakes
with `packages.default` by attempting to get the name using a pkgs set
containing only mocked builders that just return the name.
2024-01-12 00:36:36 -08:00
Archit Gupta
4b9d78f35f Speed up extracting default package pname
In order to speed up evalutation of flakes setting `packages.default`,
this trys to compute the pname in multiple ways, ordered by speed. The
pname can be set manually, which is fastest. To avoid computing a new
nixpkgs and flakelight overlays, the second option just uses callPackage
from stock nixpkgs. If that fails, the prior, most accurate, method is
used which creates a new nixpkgs with all the overlays available.
2024-01-11 17:35:01 -08:00
Archit Gupta
82f9fe67c3 Improve performance of per-system attributes
Using `perSystem` to implement per-system attributes ties all the
per-system attributes together; all the `perSystem` functions must run
to determine output attrs. By generating them separately, the generation
can be done lazily.
2024-01-11 17:35:01 -08:00
Archit Gupta
bcaa85757e Add pkgsFor module arg
This enables modules to access packages given some system, outside of
per-system attributes.
2024-01-11 17:35:01 -08:00
Archit Gupta
a7e2fe5468 Set default value for flakelight input 2024-01-11 17:35:01 -08:00
Archit Gupta
0760edb005 Refactor autoloadArgs to moduleArgs
The set of args passed to modules is useful for more than just
autoloading. This renames it appropriately and makes it available
through pkgs arguments as well.
2024-01-11 17:35:01 -08:00
github-actions[bot]
afe17be81a flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/cfc3698c31b1fb9cdcf10f36c9643460264d0ca8' (2023-12-27)
  → 'github:NixOS/nixpkgs/46ae0210ce163b3cba6c7da08840c1d63de9c701' (2024-01-06)
2024-01-08 12:32:25 +00:00
github-actions[bot]
221ee8fca1 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/5f64a12a728902226210bf01d25ec6cbb9d9265b' (2023-12-24)
  → 'github:NixOS/nixpkgs/cfc3698c31b1fb9cdcf10f36c9643460264d0ca8' (2023-12-27)
2024-01-01 12:30:43 +00:00
github-actions[bot]
82d1b751d2 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/a9bf124c46ef298113270b1f84a164865987a91c' (2023-12-11)
  → 'github:NixOS/nixpkgs/5f64a12a728902226210bf01d25ec6cbb9d9265b' (2023-12-24)
2023-12-28 08:24:49 +00:00
Archit Gupta
2d82ec80e7 Update repository location 2023-12-18 21:46:35 -08:00
github-actions[bot]
60614ae7eb flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/666fc80e7b2afb570462423cb0e1cf1a3a34fedd' (2023-12-09)
  → 'github:NixOS/nixpkgs/a9bf124c46ef298113270b1f84a164865987a91c' (2023-12-11)
2023-12-18 12:33:00 +00:00
github-actions[bot]
1e98f6c798 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/91050ea1e57e50388fa87a3302ba12d188ef723a' (2023-12-01)
  → 'github:NixOS/nixpkgs/666fc80e7b2afb570462423cb0e1cf1a3a34fedd' (2023-12-09)
2023-12-11 12:33:28 +00:00
Archit Gupta
88607687cf Add fileset option type 2023-12-06 22:46:56 -08:00
Archit Gupta
ec68d50b4a Clean up README 2023-12-06 10:42:07 -08:00
Archit Gupta
68a0941bbd Make default formatter not depend on devShell.packages 2023-12-05 22:54:01 -08:00
Archit Gupta
81371a8bf4 Add test for overridden devShell without other options 2023-12-05 22:31:36 -08:00
Archit Gupta
17463db5c0 Add Github workflow for PR checks 2023-12-05 22:24:26 -08:00
Archit Gupta
dcb12b6a22 Add Github workflow for automatic flake updates 2023-12-05 22:10:20 -08:00
Archit Gupta
8f3bfc39aa Allow devShell to be set to a package definition 2023-12-05 19:44:12 -08:00
Archit Gupta
b094ced95d Apply default formatter for .yaml file extension 2023-12-05 18:59:31 -08:00
Archit Gupta
3b8c95b637 Add note about flake description to API guide 2023-12-05 18:58:54 -08:00
Archit Gupta
6e832568f0 flake.lock: Update
Flake lock file updates:

• Updated input 'nixpkgs':
    'github:NixOS/nixpkgs/d680ded26da5cf104dd2735a51e88d2d8f487b4d' (2023-08-19)
  → 'github:NixOS/nixpkgs/91050ea1e57e50388fa87a3302ba12d188ef723a' (2023-12-01)
2023-12-05 02:10:34 -08:00
Archit Gupta
27f9ac981c Fix formatter when devShell is null
The formatter uses `devShell.packages` for its path which is not
available when devShell is null. A default value of empty list should be
used when devShell is null.
2023-12-05 02:06:23 -08:00
Archit Gupta
dccabae216 Clean up devShell options
Using a submodule for devShell removes the need to make every option
nullable and the need to check all of them. By using nullOr submodule,
we can tell if the value has been set and have default values for
options.

This also enables enabling a devShell with no options set.
2023-12-05 01:29:42 -08:00
Archit Gupta
a4e4a341f2 Allow configuring the stdenv for devShell 2023-12-05 01:00:35 -08:00
Archit Gupta
366733be87 Wrap NixOS build checks
NixOS build checks significantly slowed down `nix flake show` as it
prints out the derivation names, which for NixOS derivations requires a
large amount of evaluation. By wrapping the derivations, we now give
them trivial names. The NixOS configurations are still built when
running checks as they are a dependency of the wrappers.
2023-12-05 00:38:45 -08:00
Archit Gupta
395ac91da0 Minor refactor in (nixos|home)Configurations 2023-12-05 00:12:04 -08:00
Archit Gupta
03ee8b84b9 Use flake description as default description value 2023-12-05 00:02:39 -08:00
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