Unverified Commit a6621bdf authored by Philip Taron's avatar Philip Taron
Browse files

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.
parent b97dde9a
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -29,12 +29,12 @@ let
    }
    .${system} or throwSystem;
in
stdenv.mkDerivation rec {
stdenv.mkDerivation (finalAttrs: {
  pname = "tailwindcss";
  version = "3.4.17";

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

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

  installPhase = ''
    runHook preInstall
    mkdir -p $out/bin
    cp ${src} $out/bin/tailwindcss
    cp ${finalAttrs.src} $out/bin/tailwindcss
    chmod 755 $out/bin/tailwindcss
    runHook postInstall
  '';

  passthru.tests.helptext = runCommand "tailwindcss-test-helptext" { } ''
    ${tailwindcss}/bin/tailwindcss --help > $out
    ${lib.getExe finalAttrs.finalPackage} --help > $out
  '';
  passthru.updateScript = ./update.sh;

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