diff --git a/checks/pdfkiln.nix b/checks/pdfkiln.nix index 6ede78d..d6fcfa6 100644 --- a/checks/pdfkiln.nix +++ b/checks/pdfkiln.nix @@ -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; @@ -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 '

pdfkiln check

' > page.html - wkhtmltopdf page.html page.pdf - test "$(head -c 4 page.pdf)" = %PDF - ''} + printf '

pdfkiln check

' > 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 + '' + } '' diff --git a/flake.nix b/flake.nix index 68fa32e..c56c3a2 100644 --- a/flake.nix +++ b/flake.nix @@ -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/.nix is `{ lib }: { … }` and becomes lib.: pure # functions that take `pkgs` and the product's names as arguments.