Package pdfpc-extractor for NixOS users#114
Package pdfpc-extractor for NixOS users#114data-niklas wants to merge 2 commits intopolylux-typ:mainfrom
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: Details{
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-extractorand exposes it as a package.Usage
flake.nixas inputinputs.polylux.defaultPackage.${pkgs.system}(under the assumption that the flake was namedpolyluxin your inputs), which will build pdfpc-extractorDev env
Either run
nix buildto build the package into the result directoryor run
nix developto enter a dev env where you should be able to runcargo buildcommands as usual