mirror of
https://github.com/nix-community/flakelight.git
synced 2025-06-25 03:51:32 +02:00
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.
This commit is contained in:
parent
dccabae216
commit
27f9ac981c
@ -30,7 +30,7 @@ in
|
|||||||
(mkIf (config.formatters != null) {
|
(mkIf (config.formatters != null) {
|
||||||
perSystem = { pkgs, lib, fd, coreutils, ... }: {
|
perSystem = { pkgs, lib, fd, coreutils, ... }: {
|
||||||
formatter = mkDefault (pkgs.writeShellScriptBin "formatter" ''
|
formatter = mkDefault (pkgs.writeShellScriptBin "formatter" ''
|
||||||
PATH=${lib.makeBinPath (config.devShell.packages pkgs)}
|
PATH=${lib.makeBinPath ((config.devShell.packages or (_: [ ])) pkgs)}
|
||||||
for f in "$@"; do
|
for f in "$@"; do
|
||||||
if [ -d "$f" ]; then
|
if [ -d "$f" ]; then
|
||||||
${fd}/bin/fd "$f" -Htf -x "$0" &
|
${fd}/bin/fd "$f" -Htf -x "$0" &
|
||||||
|
@ -509,7 +509,16 @@ in
|
|||||||
formatters-fn = test
|
formatters-fn = test
|
||||||
(flakelight ./empty {
|
(flakelight ./empty {
|
||||||
formatters = { rustfmt, ... }: {
|
formatters = { rustfmt, ... }: {
|
||||||
"*.rs" = "rustfmt";
|
"*.rs" = "${rustfmt}";
|
||||||
|
};
|
||||||
|
})
|
||||||
|
(f: lib.isDerivation f.formatter.x86_64-linux);
|
||||||
|
|
||||||
|
formatters-no-devshell = test
|
||||||
|
(flakelight ./empty {
|
||||||
|
devShell = lib.mkForce null;
|
||||||
|
formatters = { rustfmt, ... }: {
|
||||||
|
"*.rs" = "${rustfmt}";
|
||||||
};
|
};
|
||||||
})
|
})
|
||||||
(f: lib.isDerivation f.formatter.x86_64-linux);
|
(f: lib.isDerivation f.formatter.x86_64-linux);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user