-
-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathflake.nix
More file actions
70 lines (58 loc) · 1.91 KB
/
Copy pathflake.nix
File metadata and controls
70 lines (58 loc) · 1.91 KB
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
{
description = "revdiff - TUI for reviewing diffs, files, and documents with inline annotations";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
};
outputs =
{ self
, nixpkgs
, flake-utils
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
version = self.shortRev or self.dirtyShortRev or "dev";
in
{
packages.default = pkgs.buildGoModule {
pname = "revdiff";
inherit version;
src = ./.;
# The repository vendors all dependencies (vendor/ is committed),
# so build straight from the vendored tree with no network fetch.
vendorHash = null;
subPackages = [ "app" ];
# Tests need the git working tree, which is absent in the Nix sandbox.
doCheck = false;
# The project builds with cgo disabled.
env.CGO_ENABLED = 0;
# Mirror the Makefile's ldflags, injecting the revision into
# `var revision` in package main.
ldflags = [
"-s"
"-w"
"-X main.revision=${version}"
];
# The main package lives in ./app, so the produced binary is named
# `app`; rename it to `revdiff`.
postInstall = ''
mv $out/bin/app $out/bin/revdiff
'';
meta = {
description = "TUI for reviewing diffs, files, and documents with inline annotations";
homepage = "https://github.com/umputun/revdiff";
license = pkgs.lib.licenses.mit;
mainProgram = "revdiff";
};
};
apps.default = flake-utils.lib.mkApp {
drv = self.packages.${system}.default;
};
devShells.default = pkgs.mkShell {
packages = [ pkgs.go ];
};
}
);
}