Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 16 additions & 9 deletions checks/pdfkiln.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# packages/pdfkiln.nix, built and run: wkhtmltopdf reports the patched Qt it is
# built with, and on Linux its wrapper points PDFKILN_CHROMIUM at nixpkgs'
# chromium, the browser the package is built against.
# built with, and its wrapper points PDFKILN_CHROMIUM at the browser the package
# is built against: nixpkgs' chromium on Linux, which the check renders with, and
# nixpkgs' google-chrome-stable on darwin, which the check only names.
{ pkgs, self }:
let
inherit (pkgs) lib;
Expand All @@ -15,12 +16,18 @@ checks.script "pdfkiln" { tools = [ pdfkiln ]; } ''
cat version
grep -F 'with patched qt' version

${lib.optionalString pkgs.stdenv.hostPlatform.isLinux ''
grep -F 'PDFKILN_CHROMIUM' ${pdfkiln}/bin/wkhtmltopdf
grep -F '${pkgs.chromium}/bin/chromium' ${pdfkiln}/bin/wkhtmltopdf
${
lib.optionalString pkgs.stdenv.hostPlatform.isLinux ''
grep -F 'PDFKILN_CHROMIUM' ${pdfkiln}/bin/wkhtmltopdf
grep -F '${pkgs.chromium}/bin/chromium' ${pdfkiln}/bin/wkhtmltopdf

printf '<p>pdfkiln check</p>' > page.html
wkhtmltopdf page.html page.pdf
test "$(head -c 4 page.pdf)" = %PDF
''}
printf '<p>pdfkiln check</p>' > page.html
wkhtmltopdf page.html page.pdf
test "$(head -c 4 page.pdf)" = %PDF
''
+ lib.optionalString pkgs.stdenv.hostPlatform.isDarwin ''
grep -F 'PDFKILN_CHROMIUM' ${pdfkiln}/bin/wkhtmltopdf
grep -F '${pkgs.google-chrome}/bin/google-chrome-stable' ${pdfkiln}/bin/wkhtmltopdf
''
}
''
18 changes: 18 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,24 @@
"aarch64-darwin"
];

# This flake's package set: nixpkgs that allows exactly one unfree
# package, google-chrome, which the darwin pdfkiln wrapper runs
# (packages/pdfkiln.nix). Nothing else here is unfree-allowed.
# `_module.args.pkgs` is how flake-parts sets perSystem's `pkgs`; its
# nixpkgs module only supplies the default, which this replaces.
imports = [
{
perSystem =
{ system, ... }:
{
_module.args.pkgs = import nixpkgs {
inherit system;
config.allowUnfreePredicate = pkg: builtins.elem (lib.getName pkg) [ "google-chrome" ];
};
};
}
];

flake = {
# lib/<name>.nix is `{ lib }: { … }` and becomes lib.<name>: pure
# functions that take `pkgs` and the product's names as arguments.
Expand Down