Skip to content

Commit a6621bd

Browse files
committed
tailwindcss: use finalAttrs, run install hooks
This allows for overriding this derivation with `postInstall` and better supports other sorts of overriding because of referencing `finalAttrs` instead of hard-coding the values from the initial derivation.
1 parent b97dde9 commit a6621bd

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

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)