-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.nix
71 lines (57 loc) · 1.64 KB
/
package.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{
lib,
craneLib,
stdenv,
libiconv,
}: let
inherit (stdenv) hostPlatform;
# Since we take stdenv, we should be good citizens and pass it forward. However,
# passing stdenv to buildPackage or the like does nothing; we need to change the stdenv
# mkCargoDerivation (which buildPackage and friends are wrappers around) uses.
craneLib' = craneLib.overrideScope (finalCrane: prevCrane: {
mkCargoDerivation = prevCrane.mkCargoDerivation.override { inherit stdenv; };
});
commonArgs = {
src = lib.fileset.toSource {
root = ./.;
fileset = lib.fileset.unions [
./README.md
./src
./Cargo.toml
./Cargo.lock
];
};
strictDeps = true;
__structuredAttrs = true;
buildInputs = lib.optionals hostPlatform.isDarwin [
libiconv
];
};
cargoArtifacts = craneLib'.buildDepsOnly commonArgs;
in craneLib'.buildPackage (commonArgs // {
inherit cargoArtifacts;
passthru.mkDevShell = {
self,
rust-analyzer,
}: craneLib'.devShell {
inherit cargoArtifacts;
inputsFrom = [ self ];
packages = [ rust-analyzer ];
};
passthru.clippy = craneLib'.cargoClippy (commonArgs // {
inherit cargoArtifacts;
});
postInstall = ''
mkdir -p "$out/share/man/man1"
"$out/bin/git-point" --mangen > "$out/share/man/man1/git-point.1"
'';
meta = {
homepage = "https://github.com/Qyirad/git-point";
description = "Set arbitrary refs without shooting yourself in the foot, a procelain `git update-ref`";
maintainers = with lib.maintainers; [ qyriad ];
license = with lib.licenses; [ mit ];
sourceProvenance = with lib.sourceTypes; [ fromSource ];
platforms = with lib.platforms; all;
mainProgram = "git-point";
};
})