Skip to content

Commit 6c2770d

Browse files
authored
haskellPackages.tailwind: fix build (#380641)
2 parents a179479 + ec820a8 commit 6c2770d

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

pkgs/development/haskell-modules/configuration-nix.nix

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1426,6 +1426,16 @@ self: super: builtins.intersectAttrs super {
14261426
pkgs.nodePackages."@tailwindcss/line-clamp"
14271427
pkgs.nodePackages."@tailwindcss/typography"
14281428
];
1429+
# Added a shim for the `tailwindcss` CLI entry point
1430+
nativeBuildInputs = (oa.nativeBuildInputs or []) ++ [ pkgs.buildPackages.makeBinaryWrapper ];
1431+
postInstall = (oa.postInstall or "") + ''
1432+
nodePath=""
1433+
for p in "$out" "${pkgs.nodePackages.postcss}" $plugins; do
1434+
nodePath="$nodePath''${nodePath:+:}$p/lib/node_modules"
1435+
done
1436+
makeWrapper "$out/bin/tailwindcss" "$out/bin/tailwind" --prefix NODE_PATH : "$nodePath"
1437+
unset nodePath
1438+
'';
14291439
})) super.tailwind;
14301440

14311441
emanote = addBuildDepend pkgs.stork super.emanote;

pkgs/development/tools/tailwindcss/default.nix

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ let
2929
}
3030
.${system} or throwSystem;
3131
in
32-
stdenv.mkDerivation rec {
32+
stdenv.mkDerivation (finalAttrs: {
3333
pname = "tailwindcss";
3434
version = "3.4.17";
3535

3636
src = fetchurl {
37-
url = "https://github.com/tailwindlabs/tailwindcss/releases/download/v${version}/tailwindcss-${plat}";
37+
url = "https://github.com/tailwindlabs/tailwindcss/releases/download/v${finalAttrs.version}/tailwindcss-${plat}";
3838
inherit hash;
3939
};
4040

@@ -44,13 +44,15 @@ stdenv.mkDerivation rec {
4444
dontFixup = true;
4545

4646
installPhase = ''
47+
runHook preInstall
4748
mkdir -p $out/bin
48-
cp ${src} $out/bin/tailwindcss
49+
cp ${finalAttrs.src} $out/bin/tailwindcss
4950
chmod 755 $out/bin/tailwindcss
51+
runHook postInstall
5052
'';
5153

5254
passthru.tests.helptext = runCommand "tailwindcss-test-helptext" { } ''
53-
${tailwindcss}/bin/tailwindcss --help > $out
55+
${lib.getExe finalAttrs.finalPackage} --help > $out
5456
'';
5557
passthru.updateScript = ./update.sh;
5658

@@ -63,4 +65,4 @@ stdenv.mkDerivation rec {
6365
mainProgram = "tailwindcss";
6466
platforms = platforms.darwin ++ platforms.linux;
6567
};
66-
}
68+
})

0 commit comments

Comments
 (0)