Downloads PDFs from LibGen (primary) or Anna's Archive API (fallback), converts to markdown via marker_single, and prints to stdout. Includes XDG-compliant caching, nix flake with marker-pdf packaging, and a Claude Code skill for paper-reader integration. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
55 lines
1.6 KiB
Nix
55 lines
1.6 KiB
Nix
{
|
|
description = "paper — download papers by DOI and convert to markdown";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
rust-overlay = {
|
|
url = "github:oxalica/rust-overlay";
|
|
inputs.nixpkgs.follows = "nixpkgs";
|
|
};
|
|
};
|
|
|
|
outputs = { self, nixpkgs, flake-utils, rust-overlay }:
|
|
flake-utils.lib.eachDefaultSystem (system:
|
|
let
|
|
overlays = [ (import rust-overlay) ];
|
|
pkgs = import nixpkgs { inherit system overlays; };
|
|
rust-nightly = pkgs.rust-bin.nightly.latest.default.override {
|
|
extensions = [ "rust-src" "rust-analyzer" ];
|
|
};
|
|
|
|
marker = import ./nix/marker.nix { inherit pkgs; };
|
|
|
|
paper = pkgs.rustPlatform.buildRustPackage {
|
|
pname = "paper";
|
|
version = "0.1.0";
|
|
src = pkgs.lib.cleanSource ./.;
|
|
cargoLock.lockFile = ./Cargo.lock;
|
|
};
|
|
|
|
# Wrap the paper binary so marker_single is on PATH
|
|
paper-wrapped = pkgs.symlinkJoin {
|
|
name = "paper-${paper.version}";
|
|
paths = [ paper ];
|
|
nativeBuildInputs = [ pkgs.makeWrapper ];
|
|
postBuild = ''
|
|
wrapProgram $out/bin/paper \
|
|
--prefix PATH : ${pkgs.lib.makeBinPath [ marker.markerEnv ]}
|
|
'';
|
|
};
|
|
in
|
|
{
|
|
packages = {
|
|
default = paper-wrapped;
|
|
unwrapped = paper;
|
|
};
|
|
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = [
|
|
rust-nightly
|
|
marker.markerEnv
|
|
];
|
|
};
|
|
});
|
|
}
|