1
1
forked from extern/flakelight

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.
This commit is contained in:
Archit Gupta 2024-02-19 02:03:21 -08:00
parent db9da2b1f7
commit 981e22f851

View File

@ -28,8 +28,13 @@ in
(mkIf (config.formatters != null) {
outputs.formatter = mkDefault (genSystems
({ pkgs, lib, fd, coreutils, ... }:
let
packages =
if config.devShell == null then [ ]
else (config.devShell pkgs).packages pkgs;
in
pkgs.writeShellScriptBin "formatter" ''
PATH=${lib.makeBinPath (config.devShell.packages or (_: [ ]) pkgs)}
PATH=${lib.makeBinPath packages}
for f in "$@"; do
if [ -d "$f" ]; then
${fd}/bin/fd "$f" -Htf -x "$0" &