Enable prettier prose-wrap by default

This commit is contained in:
Archit Gupta 2025-05-17 23:41:46 -07:00
parent 95f19ef320
commit a06c4cd93a
3 changed files with 24 additions and 21 deletions

View File

@ -6,8 +6,8 @@ This section covers important functions available in Flakelight's lib attribute.
### mkFlake ### mkFlake
The outputs of a flake using Flakelight are created using the `mkFlake` function. The outputs of a flake using Flakelight are created using the `mkFlake`
When called directly, Flakelight invokes `mkFlake`, as follows: function. When called directly, Flakelight invokes `mkFlake`, as follows:
```nix ```nix
{ {
@ -203,8 +203,8 @@ To enable using a directory for an attrset that includes a `default` attribute,
attr names can be escaped with an underscore. For example, attr names can be escaped with an underscore. For example,
`${nixDir}/nix/packages/_default.nix` will be loaded as `packages.default`. `${nixDir}/nix/packages/_default.nix` will be loaded as `packages.default`.
Aliases for options can be set with the `nixDirAliases` option. For example, Aliases for options can be set with the `nixDirAliases` option. For example, by
by default `nixDirAliases.nixosConfigurations = [ "nixos" ];` is set which means default `nixDirAliases.nixosConfigurations = [ "nixos" ];` is set which means
"nixos" can be used instead of "nixosConfigurations" for loading the files as "nixos" can be used instead of "nixosConfigurations" for loading the files as
described above. described above.
@ -360,8 +360,8 @@ Types:
``` ```
The `package` and `packages` options allow you to add packages. These are The `package` and `packages` options allow you to add packages. These are
exported in the `packages.${system}` outputs, are included in `overlays.default`, exported in the `packages.${system}` outputs, are included in
and have build checks in `checks.${system}`. `overlays.default`, and have build checks in `checks.${system}`.
`package` can be set to a package definition, and will set `packages.default`. `package` can be set to a package definition, and will set `packages.default`.
@ -369,10 +369,10 @@ and have build checks in `checks.${system}`.
will additionally get a `system` arg in addition to module args, to allow will additionally get a `system` arg in addition to module args, to allow
conditionally including package definitions depending on the system. conditionally including package definitions depending on the system.
By default, the `packages.default` package's name (its attribute name in By default, the `packages.default` package's name (its attribute name in the
the package set and overlay) is automatically determined from the derivation's package set and overlay) is automatically determined from the derivation's
`pname`. In order to use a different attribute name from the package pname, `pname`. In order to use a different attribute name from the package pname, to
to set it in cases where it cannot be automatically determined, or to speed up set it in cases where it cannot be automatically determined, or to speed up
uncached evaluation, the flakelight `pname` option can be set. uncached evaluation, the flakelight `pname` option can be set.
To set the default package, you can set the options as follows: To set the default package, you can set the options as follows:
@ -768,8 +768,7 @@ Types:
(ModuleArgs -> (AttrsOf (Template | (ModuleArgs -> Template)))) (ModuleArgs -> (AttrsOf (Template | (ModuleArgs -> Template))))
``` ```
The `template` and `templates` options allow you to set `templates` The `template` and `templates` options allow you to set `templates` outputs.
outputs.
`templates` is an attribute set to template values. `templates` is an attribute set to template values.
@ -1172,8 +1171,8 @@ Types:
This option has options for configuring Flakelight's defaults. This option has options for configuring Flakelight's defaults.
`flakelight.editorconfig` can be set to false to disable the editorconfig `flakelight.editorconfig` can be set to false to disable the editorconfig check
check that is added if editorconfig configuration is detected. that is added if editorconfig configuration is detected.
`flakelight.builtinFormatters` can be set to false to disable the default `flakelight.builtinFormatters` can be set to false to disable the default
formatting configuration. formatting configuration.

View File

@ -15,7 +15,8 @@ A modular Nix flake framework for simplifying flake definitions.
- Handles generating per-system attributes - Handles generating per-system attributes
- Extensible using the module system - Extensible using the module system
- Given package definitions, generates package and overlay outputs - Given package definitions, generates package and overlay outputs
- Automatically import attributes from nix files in a directory (default `./nix`) - Automatically import attributes from nix files in a directory (default
`./nix`)
- Builds formatter outputs that can format multiple file types - Builds formatter outputs that can format multiple file types
- Provides outputs/perSystem options for easy migration - Provides outputs/perSystem options for easy migration
@ -84,8 +85,8 @@ To use a different nixpkgs, you can instead use:
### Rust package ### Rust package
The following is an example flake for a Rust project using `flakelight-rust`, The following is an example flake for a Rust project using `flakelight-rust`,
invoked by using `flakelight-rust`'s wrapper. invoked by using `flakelight-rust`'s wrapper. Package metadata is taken from the
Package metadata is taken from the project's `Cargo.toml`. project's `Cargo.toml`.
```nix ```nix
{ {
@ -100,8 +101,8 @@ The above flake exports the following:
- `packages.${system}.default` attributes for each system - `packages.${system}.default` attributes for each system
- `overlays.default` providing an overlay with the package (built with the - `overlays.default` providing an overlay with the package (built with the
applied pkg set's dependencies) applied pkg set's dependencies)
- `devShells.${system}.default` that provides `rust-analyzer`, `cargo`, `clippy`, - `devShells.${system}.default` that provides `rust-analyzer`, `cargo`,
`rustc`, and `rustfmt` as well as sets `RUST_SRC_PATH` `clippy`, `rustc`, and `rustfmt` as well as sets `RUST_SRC_PATH`
- `checks.${system}.${check}` attributes for build, test, clippy, and formatting - `checks.${system}.${check}` attributes for build, test, clippy, and formatting
checks checks
- `formatter.${system}` with additional support for formatting Rust files - `formatter.${system}` with additional support for formatting Rust files
@ -123,7 +124,8 @@ Equivalently, you can just import the `flakelight-rust` module as follows:
See [flakelight-rust.nix][flakelight-rust] to see how you could configure it See [flakelight-rust.nix][flakelight-rust] to see how you could configure it
without the module. without the module.
[flakelight-rust]: https://github.com/accelbread/flakelight-rust/blob/master/flakelight-rust.nix [flakelight-rust]:
https://github.com/accelbread/flakelight-rust/blob/master/flakelight-rust.nix
### C application ### C application

View File

@ -20,8 +20,10 @@ in
formatters = pkgs: formatters = pkgs:
let let
nixpkgs-fmt = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt"; nixpkgs-fmt = "${pkgs.nixpkgs-fmt}/bin/nixpkgs-fmt";
# prefer-file would be better but does not work with prose-wrap
prettier = "${pkgs.nodePackages.prettier}/bin/prettier --write" prettier = "${pkgs.nodePackages.prettier}/bin/prettier --write"
+ " --cache-location=.prettiercache"; + " --cache-location=.prettiercache"
+ " --config-precedence file-override --prose-wrap always";
in in
{ {
"*.nix" = mkDefault nixpkgs-fmt; "*.nix" = mkDefault nixpkgs-fmt;