Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] NixOS package distribution #160

Open
DennisJensen95 opened this issue Feb 24, 2024 · 2 comments
Open

[Feature] NixOS package distribution #160

DennisJensen95 opened this issue Feb 24, 2024 · 2 comments

Comments

@DennisJensen95
Copy link

Hey!

Thanks for your guys hard work!

It would be awesome if these packages were made available in NixOS packages as well so you could import them in your Nix flakes. Would be a supreme developer experience.

@bblanchon
Copy link
Owner

Hi @DennisJensen95,

Would you be able to prepare a pull request?

Best regards,
Benoit

@DennisJensen95
Copy link
Author

DennisJensen95 commented Mar 7, 2024

I would like to, but I am a bit strained on time. I have made a few nix derivations that does install the binaries though. I will leave it here if anyone wants to pick it up, else i might come back later at a day where I have more time :)

{ stdenv, fetchurl }:

stdenv.mkDerivation {
  name = "pdfium-linux-x64  ";
  src = fetchurl {
    url = "https://github.com/bblanchon/pdfium-binaries/releases/download/chromium%2F6309/pdfium-linux-x64.tgz";
    sha256 = "as+hRy1Mg5l8oEAOyDXY9crRHx2PRT0RQC+YEUD/ako=";
  };

  sourceRoot = "lib";

  # Assuming the tarball contains binaries and doesn't need building
  installPhase = ''
    mkdir -p $out/lib
    cp -r * $out/lib
  '';

  meta = {
    description = "PDFium library for linux x64";
    homepage = "https://github.com/bblanchon/pdfium-binaries";
  };
}

And for anyone interested, this is how i import it in my nix flake:

pdfiumPackageForSystem = system:
if system == "x86_64-linux" then "pdfium-linux-x64"
else if system == "aarch64-darwin" then "pdfium-mac-arm64"
else if system == "aarch64-linux" then "pdfium-linux-arm64"
else throw "Unsupported system: ${system}";

callPdfiumPackage = name: pkgs.callPackage (./nix/${name}.nix) { };
pdfium = callPdfiumPackage (pdfiumPackageForSystem system);

⚠️ DISCLAIMER

I am by no means, no nix expert. So this might not be the correct way to do things 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants