aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2024-04-29 18:47:41 +0200
committerLibravatar Rutger Broekhoff2024-04-29 18:47:41 +0200
commita072a4206e2056e91d0e92d3ac21d9806eed555c (patch)
tree2fa2dfb7f820e65394d672e80242954a5b6ea60e
parentb8905bf2fcc3c743d8f9bebd3579928e7e91766c (diff)
downloadgitolfs3-a072a4206e2056e91d0e92d3ac21d9806eed555c.tar.gz
gitolfs3-a072a4206e2056e91d0e92d3ac21d9806eed555c.zip
Build man pages inside of Crane derivation
-rw-r--r--.gitignore1
-rw-r--r--flake.nix40
2 files changed, 20 insertions, 21 deletions
diff --git a/.gitignore b/.gitignore
index 15873fc..fdfe02a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,5 +3,6 @@
3.vscode/ 3.vscode/
4# nix build 4# nix build
5/result 5/result
6/result-man
6# cargo build 7# cargo build
7/target/ 8/target/
diff --git a/flake.nix b/flake.nix
index 312d624..1a5da5c 100644
--- a/flake.nix
+++ b/flake.nix
@@ -35,7 +35,15 @@
35 extensions = [ "rust-src" ]; 35 extensions = [ "rust-src" ];
36 }; 36 };
37 craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain; 37 craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
38 src = craneLib.cleanCargoSource (craneLib.path ./.); 38
39 src =
40 let docsFilter = path: _type: builtins.match ".*docs/man/.*\.[1-9]$" path != null;
41 docsOrCargo = path: type:
42 (docsFilter path type) || (craneLib.filterCargoSources path type);
43 in pkgs.lib.cleanSourceWith {
44 src = craneLib.path ./.;
45 filter = docsOrCargo;
46 };
39 47
40 commonArgs = { 48 commonArgs = {
41 inherit src; 49 inherit src;
@@ -46,30 +54,20 @@
46 54
47 cargoArtifacts = craneLib.buildDepsOnly commonArgs; 55 cargoArtifacts = craneLib.buildDepsOnly commonArgs;
48 56
49 gitolfs3-bare = craneLib.buildPackage (commonArgs // { 57 gitolfs3 = (craneLib.buildPackage (commonArgs // {
50 # We already have the gitolfs3-nextest check 58 # We already have the gitolfs3-nextest check
51 doCheck = false; 59 doCheck = false;
52 }); 60 })).overrideAttrs(old: old // {
53 61 postInstall = (old.postInstall or "") + ''
54 gitolfs3-man = pkgs.stdenv.mkDerivation { 62 ls docs
55 name = "gitolfs3-man"; 63 ls docs/man
56 64 install -D docs/man/gitolfs3-authenticate.1 $man/share/man/gitolfs3-authenticate.1
57 src = ./docs/man; 65 install -D docs/man/gitolfs3-server.1 $man/share/man/gitolfs3-server.1
58 66 install -D docs/man/gitolfs3-shell.1 $man/share/man/gitolfs3-shell.1
59 installPhase = ''
60 install -D gitolfs3-authenticate.1 $out/share/man/gitolfs3-authenticate.1
61 install -D gitolfs3-server.1 $out/share/man/gitolfs3-server.1
62 install -D gitolfs3-shell.1 $out/share/man/gitolfs3-shell.1
63 ''; 67 '';
64 };
65
66 gitolfs3 = pkgs.buildEnv {
67 name = "gitolfs3";
68
69 paths = [ gitolfs3-bare gitolfs3-man ];
70 68
71 pathsToLink = [ "/bin" "/share/man" ]; 69 outputs = [ "out" "man" ];
72 }; 70 });
73 in 71 in
74 { 72 {
75 checks = { 73 checks = {