nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromGitHub,
4 rustPlatform,
5 cmake,
6 pkg-config,
7 oniguruma,
8 installShellFiles,
9 tpnote,
10 versionCheckHook,
11 nix-update-script,
12}:
13
14rustPlatform.buildRustPackage (finalAttrs: {
15 pname = "tpnote";
16 version = "1.25.17";
17
18 src = fetchFromGitHub {
19 owner = "getreu";
20 repo = "tp-note";
21 tag = "v${finalAttrs.version}";
22 hash = "sha256-XOoqPhWS50kj2n48A0SyOuUZHsoP7YxMrWpzgpTr/DY=";
23 };
24
25 cargoHash = "sha256-4e06W8Q+pJTcUgfDSHU1ZTMG/55mYvJ6DAX3QeAa9TI=";
26
27 nativeBuildInputs = [
28 cmake
29 pkg-config
30 installShellFiles
31 ];
32
33 buildInputs = [
34 oniguruma
35 ];
36
37 postPatch = ''
38 # In these `Cargo.toml`s, local dependencies should be specified by path,
39 # otherwise they will be looked up in vendored dependencies.
40 substituteInPlace tpnote/Cargo.toml \
41 --replace-fail 'tpnote-lib = { version =' 'tpnote-lib = { path = "../tpnote-lib", version ='
42
43 substituteInPlace tpnote-lib/Cargo.toml \
44 --replace-fail 'tpnote-html2md = { version =' 'tpnote-html2md = { path = "../tpnote-html2md", version ='
45 '';
46
47 postInstall = ''
48 installManPage docs/build/man/man1/tpnote.1
49 '';
50
51 env.RUSTONIG_SYSTEM_LIBONIG = true;
52
53 # The `tpnote` crate has no unit tests. All tests are in `tpnote-lib`.
54 checkType = "debug";
55 cargoTestFlags = [
56 "--package"
57 "tpnote-lib"
58 ];
59 doCheck = true;
60
61 nativeInstallCheckInputs = [
62 versionCheckHook
63 ];
64 doInstallCheck = true;
65
66 passthru = {
67 updateScript = nix-update-script { };
68 };
69
70 meta = {
71 changelog = "https://github.com/getreu/tp-note/releases/tag/v${finalAttrs.version}";
72 description = "Markup enhanced granular note-taking";
73 homepage = "https://blog.getreu.net/projects/tp-note/";
74 license = lib.licenses.mit;
75 mainProgram = "tpnote";
76 maintainers = with lib.maintainers; [
77 getreu
78 starryreverie
79 ];
80 };
81})