mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 13:30:36 +00:00
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
135 lines
3.0 KiB
Nix
135 lines
3.0 KiB
Nix
{
|
|
lib,
|
|
autoPatchelfHook,
|
|
cpio,
|
|
freetype,
|
|
zlib,
|
|
openssl,
|
|
fetchurl,
|
|
dpkg,
|
|
gcc-unwrapped,
|
|
libjpeg,
|
|
libpng,
|
|
fontconfig,
|
|
stdenv,
|
|
xar,
|
|
libxrender,
|
|
libxext,
|
|
}:
|
|
|
|
let
|
|
darwinAttrs = rec {
|
|
version = "0.12.6-2";
|
|
src = fetchurl {
|
|
url = "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox-${version}.macos-cocoa.pkg";
|
|
sha256 = "sha256-gaZrd7UI/t6NvKpnEnIDdIN2Vos2c6F/ZhG21R6YlPg=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
xar
|
|
cpio
|
|
];
|
|
|
|
unpackPhase = ''
|
|
xar -xf $src
|
|
zcat Payload | cpio -i
|
|
tar -xf usr/local/share/wkhtmltox-installer/wkhtmltox.tar.gz
|
|
'';
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
mkdir -p $out
|
|
cp -r bin include lib share $out/
|
|
runHook postInstall
|
|
'';
|
|
};
|
|
|
|
_linuxAttrs = {
|
|
nativeBuildInputs = [
|
|
dpkg
|
|
autoPatchelfHook
|
|
];
|
|
|
|
buildInputs = [
|
|
libxext
|
|
libxrender
|
|
|
|
freetype
|
|
openssl
|
|
zlib
|
|
|
|
(lib.getLib fontconfig)
|
|
(lib.getLib gcc-unwrapped)
|
|
(lib.getLib libjpeg)
|
|
(lib.getLib libpng)
|
|
];
|
|
|
|
installPhase = ''
|
|
runHook preInstall
|
|
|
|
cp -r usr/local $out
|
|
|
|
runHook postInstall
|
|
'';
|
|
};
|
|
|
|
linuxAttrs.aarch64-linux = rec {
|
|
version = "0.12.6.1-3";
|
|
src = fetchurl {
|
|
url = "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox_${version}.bookworm_arm64.deb";
|
|
hash = "sha256-tmBhV7J8E+BE0Ku+ZwMB+I3k4Xgq/KT5wGpYF/PgOpw=";
|
|
};
|
|
}
|
|
// _linuxAttrs;
|
|
|
|
linuxAttrs.x86_64-linux = rec {
|
|
version = "0.12.6.1-3";
|
|
src = fetchurl {
|
|
url = "https://github.com/wkhtmltopdf/packaging/releases/download/${version}/wkhtmltox_${version}.bookworm_amd64.deb";
|
|
hash = "sha256-mLoNFXtQ028jvQ3t9MCqKMewxQ/NzcVKpba7uoGjlB0=";
|
|
};
|
|
}
|
|
// _linuxAttrs;
|
|
in
|
|
stdenv.mkDerivation (
|
|
{
|
|
pname = "wkhtmltopdf";
|
|
# required to fix eval when it's not overridden by platform below
|
|
version = "none";
|
|
|
|
dontStrip = true;
|
|
|
|
doInstallCheck = true;
|
|
|
|
installCheckPhase = ''
|
|
$out/bin/wkhtmltopdf --version
|
|
'';
|
|
|
|
meta = {
|
|
homepage = "https://wkhtmltopdf.org/";
|
|
description = "Tools for rendering web pages to PDF or images (binary package)";
|
|
longDescription = ''
|
|
wkhtmltopdf and wkhtmltoimage are open source (LGPL) command line tools
|
|
to render HTML into PDF and various image formats using the QT Webkit
|
|
rendering engine. These run entirely "headless" and do not require a
|
|
display or display service.
|
|
|
|
There is also a C library, if you're into that kind of thing.
|
|
'';
|
|
license = lib.licenses.gpl3Plus;
|
|
maintainers = with lib.maintainers; [
|
|
nbr
|
|
kalbasit
|
|
];
|
|
platforms = [
|
|
"x86_64-linux"
|
|
"aarch64-linux"
|
|
];
|
|
};
|
|
}
|
|
// lib.optionalAttrs (stdenv.hostPlatform.isDarwin) darwinAttrs
|
|
//
|
|
lib.optionalAttrs (stdenv.hostPlatform.isLinux)
|
|
linuxAttrs.${stdenv.system} or (throw "Unsupported system: ${stdenv.system}")
|
|
)
|