-
Notifications
You must be signed in to change notification settings - Fork 58
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
Package pdfpc-extractor for NixOS users #114
Conversation
Cool! Can you add a note to the installation section in this file? https://github.com/andreasKroepelin/polylux/blob/main/book/src/external/pdfpc.md Also, I don't really know much about Nix, so it's hard for me to review... @drupol, can you have a look maybe? |
Sure, will do that tomorrow! I'm using the pdfpc extractor in a presentation, with its own nix file. I'll let you know what I think of this PR tomorrow. |
I slightly restructured the installation instruction section to streamline instructions for different OS, so we now have 3 subtitles for
|
Dear @data-niklas, Here's my take on this: {
description = "Polylux packages";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
outputs = inputs @ { self, flake-parts, ... }: flake-parts.lib.mkFlake { inherit inputs; } {
imports = [
inputs.flake-parts.flakeModules.easyOverlay
];
systems = import inputs.systems;
perSystem = { config, self', inputs', pkgs, system, lib, ... }:
let
pdfpc-extractor = pkgs.rustPlatform.buildRustPackage {
pname = "pdfpc-extractor";
version = "dev";
src = ./pdfpc-extractor;
cargoHash = "sha256-VTJRfDFprKIrwfw5lU9/RnDuGLQ7nXBEc/dms5YVupM=";
meta.mainProgram = "polylux2pdfpc";
};
in
{
formatter = pkgs.nixpkgs-fmt;
overlayAttrs = self'.packages;
packages = {
pdfpc-extractor = pdfpc-extractor;
default = pdfpc-extractor;
};
apps = {
default = {
type = "app";
program = lib.getExec self'.packages.pdfpc-extractor;
};
};
devShells.default = pkgs.mkShell {
name = "polylux-devshell";
buildInputs = with pkgs; [
cargo
rustc
];
};
};
};
} When I have to add a flake to a project, I try to limit to the maximum the external dependencies it depends on to avoid bad surprises. Therefore, I don't think using the contrib project I also expose I don't use the old flake syntax I forgot to add the default overlay, I will do that as soon as I'm back on a computer. Let me know what you think of all of this. PS: I'm currently travelling to Germany to make a talk (where the slides were made with Typst/Polylux) so there might be some delay in my replies. |
Awesome! I reused the naersk Rust template from another template, as I was not so familiar withe the other methods to package Rust programs. If your version works and is more minimal, great. How will the cargoHash work between updates? I tried to use your flake locally and got mismatched cargoHashes, as my local version is slightly different. Does it only base the hash on the cargo dependencies? I think we then need to at least document somewhere, that the cargoHash needs to be updated, when the Rust dependencies change.
Sadly the checksum would need to be updated by a NixOS user. Alternatively we could try to add the polylux package into |
Else I would just more or less replace the flake with your more minimal flake |
Package has been merged in Nix today @ NixOS/nixpkgs#280525 |
Great! In that case I can and will close this PR. |
This PR will add a NixOS flake, which builds the
pdfpc-extractor
and exposes it as a package.Usage
flake.nix
as inputinputs.polylux.defaultPackage.${pkgs.system}
(under the assumption that the flake was namedpolylux
in your inputs), which will build pdfpc-extractorDev env
Either run
nix build
to build the package into the result directoryor run
nix develop
to enter a dev env where you should be able to runcargo build
commands as usual