To reproduce:
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: nix-x86_64-darwin
language: nix
rule:
any:
- pattern: "\"x86_64-darwin\""
kind: list_expression > string_expression
- pattern:
context: "{ \"x86_64-darwin\" = $EXPR; }"
selector: binding
- pattern:
context: "{ x86_64-darwin = $EXPR; }"
selector: binding
fix:
template: ""
' pkgs
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: json-first-x86_64-darwin
language: json
rule:
kind: object > pair:nth-child(1)
has:
pattern: "\"x86_64-darwin\""
field: key
fix:
template: ""
expandEnd: { regex: "," }
' pkgs
$ nix run nixpkgs/3b32825de172d0bc85664f495edb096b10862524#ast-grep \
-- scan --update-all --inline-rules '
id: json-x86_64-darwin
language: json
rule:
kind: object > pair
has:
pattern: "\"x86_64-darwin\""
field: key
fix:
template: ""
expandStart: { regex: "," }
' pkgs
$ git restore pkgs/by-name/om/omnix/package.nix
$ git diff --name-only -z \
| nix shell nixpkgs/3b32825de172d0bc85664f495edb096b10862524#gnused \
-c xargs -0 sed -i '/^$/N; /^\n\? \+$/d'
$ treefmt
66 lines
1.8 KiB
Nix
66 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
fetchurl,
|
|
stdenv,
|
|
runCommand,
|
|
}:
|
|
let
|
|
inherit (stdenv.hostPlatform) system;
|
|
throwSystem = throw "tailwindcss has not been packaged for ${system} yet.";
|
|
|
|
plat =
|
|
{
|
|
aarch64-darwin = "macos-arm64";
|
|
aarch64-linux = "linux-arm64";
|
|
armv7l-linux = "linux-armv7";
|
|
x86_64-linux = "linux-x64";
|
|
}
|
|
.${system} or throwSystem;
|
|
|
|
hash =
|
|
{
|
|
aarch64-darwin = "sha256-odDHmFdZrMygvxLlGsHcvw9s8v/7Yubg9i0JHEd6EKM=";
|
|
aarch64-linux = "sha256-abE3i4EzGS19L+sSoRb6EtA1WU9Y2z7/IVh55K2M85s=";
|
|
armv7l-linux = "sha256-cE59ka+6bh9jCImv0NfbNrRjTmKFEswUHVBKW+riiGA=";
|
|
x86_64-linux = "sha256-fST3+hkdIZO3jNX1pCpgk+FECVIZCFKfQtgLEf3h8dQ=";
|
|
}
|
|
.${system} or throwSystem;
|
|
in
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "tailwindcss_3";
|
|
version = "3.4.17";
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/tailwindlabs/tailwindcss/releases/download/v${finalAttrs.version}/tailwindcss-${plat}";
|
|
inherit hash;
|
|
};
|
|
|
|
dontUnpack = true;
|
|
dontConfigure = true;
|
|
dontBuild = true;
|
|
dontFixup = true;
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out/bin
|
|
cp ${finalAttrs.src} $out/bin/tailwindcss
|
|
chmod 755 $out/bin/tailwindcss
|
|
runHook postInstall
|
|
'';
|
|
|
|
passthru.tests.helptext = runCommand "tailwindcss-test-helptext" { } ''
|
|
${lib.getExe finalAttrs.finalPackage} --help > $out
|
|
'';
|
|
passthru.updateScript = ./update.sh;
|
|
|
|
meta = {
|
|
description = "Command-line tool for the CSS framework with composable CSS classes, standalone CLI";
|
|
homepage = "https://tailwindcss.com/blog/standalone-cli";
|
|
license = lib.licenses.mit;
|
|
sourceProvenance = [ lib.sourceTypes.binaryNativeCode ];
|
|
maintainers = [ lib.maintainers.adamcstephens ];
|
|
mainProgram = "tailwindcss";
|
|
platforms = lib.platforms.darwin ++ lib.platforms.linux;
|
|
};
|
|
})
|