Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 80 lines 2.1 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 versionCheckHook, 6 autoPatchelfHook, 7 makeWrapper, 8}: 9let 10 version = "4.1.11"; 11 inherit (stdenv.hostPlatform) system; 12 throwSystem = throw "tailwindcss has not been packaged for ${system} yet."; 13 14 plat = 15 { 16 aarch64-darwin = "macos-arm64"; 17 aarch64-linux = "linux-arm64"; 18 x86_64-darwin = "macos-x64"; 19 x86_64-linux = "linux-x64"; 20 } 21 .${system} or throwSystem; 22 23 hash = 24 { 25 aarch64-darwin = "sha256-9ZhLnABcPmeEHDOQbHp8kuheQF9h4Cnpu2LogN1mLnk="; 26 aarch64-linux = "sha256-BAmqQiKWn0f6b0Fg/lOH55v3Jp56/g6LIvdTLJjh0xQ="; 27 x86_64-darwin = "sha256-duJzJlBtENUOZbdReV8FN/kwTssQCr6DXsE4xBd084w="; 28 x86_64-linux = "sha256-ZIBbhK9CkuBD6m+G0kLxkcCsdTWcGkmEVd/mxkKv26s="; 29 } 30 .${system} or throwSystem; 31in 32stdenv.mkDerivation { 33 inherit version; 34 pname = "tailwindcss_4"; 35 36 src = fetchurl { 37 url = 38 "https://github.com/tailwindlabs/tailwindcss/releases/download/v${version}/tailwindcss-" + plat; 39 inherit hash; 40 }; 41 42 nativeBuildInputs = lib.optional stdenv.hostPlatform.isLinux autoPatchelfHook; 43 buildInputs = [ makeWrapper ]; 44 45 dontUnpack = true; 46 dontBuild = true; 47 dontStrip = true; 48 49 installPhase = '' 50 mkdir -p $out/bin 51 install -m755 $src $out/bin/tailwindcss 52 ''; 53 54 # libstdc++.so.6 for @parcel/watcher 55 postFixup = '' 56 wrapProgram $out/bin/tailwindcss --prefix LD_LIBRARY_PATH : ${ 57 lib.makeLibraryPath [ stdenv.cc.cc.lib ] 58 } 59 ''; 60 61 nativeInstallCheckInputs = [ versionCheckHook ]; 62 doInstallCheck = true; 63 versionCheckProgram = "${placeholder "out"}/bin/tailwindcss"; 64 versionCheckProgramArg = "--help"; 65 66 passthru.updateScript = ./update.sh; 67 68 meta = { 69 description = "Command-line tool for the CSS framework with composable CSS classes, standalone v4 CLI"; 70 homepage = "https://tailwindcss.com/blog/tailwindcss-v4"; 71 license = lib.licenses.mit; 72 sourceProvenance = [ lib.sourceTypes.binaryNativeCode ]; 73 maintainers = with lib.maintainers; [ 74 adamcstephens 75 adamjhf 76 ]; 77 mainProgram = "tailwindcss"; 78 platforms = lib.platforms.darwin ++ lib.platforms.linux; 79 }; 80}