mirror of
https://github.com/nix-community/flakelight.git
synced 2024-09-11 08:55:39 +03: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) {
|
||||
perSystem = { pkgs, lib, fd, coreutils, ... }: {
|
||||
formatter = mkDefault (pkgs.writeShellScriptBin "formatter" ''
|
||||
PATH=${lib.makeBinPath (config.devShell.packages pkgs)}
|
||||
PATH=${lib.makeBinPath ((config.devShell.packages or (_: [ ])) pkgs)}
|
||||
for f in "$@"; do
|
||||
if [ -d "$f" ]; then
|
||||
${fd}/bin/fd "$f" -Htf -x "$0" &
|
||||
|
@ -509,7 +509,16 @@ in
|
||||
formatters-fn = test
|
||||
(flakelight ./empty {
|
||||
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);
|
||||
|
Loading…
Reference in New Issue
Block a user