Commit Graph

12 Commits

Author SHA1 Message Date
836107752b Format whole flake when fmt has no args
Now that Nix/Lix do not pass `.` by default for `nix fmt` we can take
`nix fmt` without an arg to mean to format the entire flake.
2025-01-26 20:32:19 -08:00
eedc71d648 Support nix 2.25 in formatter
Nix 2.25 changes the args passed to the formatter, so we now need to
handle an empty args.

See https://github.com/NixOS/nix/pull/11438
2025-01-15 10:12:59 -08:00
efcf01325b Enable faster building of formatter
Since the formatter always depended on devShell packages, building the
formatter involved building all the devShell packages, which can be
slow.

In the case where formatters are set to plain strings, such as
"nixpkgs-fmt", depending on the devShell packages is necessary in order
to put the formatting utility on the path. But when a formatters option
is set to an package, such as "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt",
then that formatter option does not depend on the devShell packages.

Flakelight now detects if any of the configured formatters are using the
first form, and only if so does it add the devShell packages dependency.
This allows the first form to still work, without incurring a cost for
flakes that only use the second form.

Users can use the second form for all formatters options if they wish to
not build the devShell packages when using the formatter.
2024-02-19 02:35:16 -08:00
981e22f851 Fix usage of devShell packages in formatters
Formatters should have the packages from devShell.packages, though a
regression caused PATH to not be set in the formatter. This fixes that
issue.
2024-02-19 02:03:21 -08:00
543e3aaa4d Replace nixpkgs nullOr type with custom type
`nullOr`'s merge function requires definitions to all be null or all be
non-null. It was being used where the intent was that null be used as a
value representing unset, and as such the merge should return null if
all definitions are null and ignore nulls otherwise. This adds a type
with that merge semantics.
2024-02-07 01:49:29 -08:00
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
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
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
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
e5db2dcd86 Have formatters for each file run in parallel 2023-08-28 19:57:26 -07:00
b8d9538c58 Rename project from flakelite to flakelight 2023-08-26 22:48:57 -07:00
f6c4424f6e Reimplement framework using the module system 2023-08-26 22:39:28 -07:00