1{ lib
2, fetchurl
3, stdenv
4, runCommand
5, tailwindcss
6,
7}:
8let
9 inherit (stdenv.hostPlatform) system;
10 throwSystem = throw "tailwindcss has not been packaged for ${system} yet.";
11
12 plat = {
13 aarch64-darwin = "macos-arm64";
14 aarch64-linux = "linux-arm64";
15 armv7l-linux = "linux-armv7";
16 x86_64-darwin = "macos-x64";
17 x86_64-linux = "linux-x64";
18 }.${system} or throwSystem;
19
20 hash = {
21 aarch64-darwin = "sha256-Wsys6Iagq/dwOKb+htMWosLL51blPxxq3PX8ioZ1UZw=";
22 aarch64-linux = "sha256-vXvhtfHd/Pg4Pv6X23Y9nC1OFUeju5vBn9SEOaI5G6E=";
23 armv7l-linux = "sha256-ZCqvztsUD+dom6HL/IejSjn9Cy/Rwnn7/QFxtW0XFoU=";
24 x86_64-darwin = "sha256-vVbDvu3R66AwCZgg75k1Mjp2oVsrkdMXtqHA5sdACEo=";
25 x86_64-linux = "sha256-POpm9f2HmGU4cBpVHHNCwpoK4+MTnu1Xxb2RUfZtq5Y=";
26 }.${system} or throwSystem;
27in
28stdenv.mkDerivation rec {
29 pname = "tailwindcss";
30 version = "3.4.3";
31
32 src = fetchurl {
33 url = "https://github.com/tailwindlabs/tailwindcss/releases/download/v${version}/tailwindcss-${plat}";
34 inherit hash;
35 };
36
37 dontUnpack = true;
38 dontConfigure = true;
39 dontBuild = true;
40 dontFixup = true;
41
42 installPhase = ''
43 mkdir -p $out/bin
44 cp ${src} $out/bin/tailwindcss
45 chmod 755 $out/bin/tailwindcss
46 '';
47
48 passthru.tests.helptext = runCommand "tailwindcss-test-helptext" { } ''
49 ${tailwindcss}/bin/tailwindcss --help > $out
50 '';
51 passthru.updateScript = ./update.sh;
52
53 meta = with lib; {
54 description = "Command-line tool for the CSS framework with composable CSS classes, standalone CLI";
55 homepage = "https://tailwindcss.com/blog/standalone-cli";
56 license = licenses.mit;
57 sourceProvenance = [ sourceTypes.binaryNativeCode ];
58 maintainers = [ maintainers.adamcstephens ];
59 mainProgram = "tailwindcss";
60 platforms = platforms.darwin ++ platforms.linux;
61 };
62}