-
Notifications
You must be signed in to change notification settings - Fork 956
Expand file tree
/
Copy pathdefault.nix
More file actions
81 lines (74 loc) · 1.91 KB
/
default.nix
File metadata and controls
81 lines (74 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
71
72
73
74
75
76
77
78
79
80
81
{
lib,
stdenv,
rustPlatform,
gitRev ? null,
git,
gnupg,
installShellFiles,
mold,
openssh,
}: let
packageVersion = (builtins.fromTOML (builtins.readFile ./Cargo.toml)).workspace.package.version;
filterSrc = src: regexes:
lib.cleanSourceWith {
inherit src;
filter = path: type: let
relPath = lib.removePrefix (toString src + "/") (toString path);
in
lib.all (re: builtins.match re relPath == null) regexes;
};
in
rustPlatform.buildRustPackage {
pname = "jujutsu";
version = "${packageVersion}-unstable-${
if gitRev != null
then gitRev
else "dirty"
}";
cargoBuildFlags = ["--bin" "jj"]; # don't build and install the fake editors
useNextest = true;
cargoTestFlags = ["--profile" "ci"];
src = filterSrc ./. [
".*\\.nix$"
"^.jj/"
"^flake\\.lock$"
"^target/"
];
cargoLock.lockFile = ./Cargo.lock;
nativeBuildInputs =
[
installShellFiles
]
++ lib.optionals stdenv.isLinux [
mold
];
buildInputs = [];
nativeCheckInputs = [
# for signing tests
gnupg
openssh
# for git subprocess test
git
];
env = {
RUST_BACKTRACE = 1;
CARGO_INCREMENTAL = "0"; # https://github.com/rust-lang/rust/issues/139110
RUSTFLAGS = lib.optionalString stdenv.isLinux "-C link-arg=-fuse-ld=mold";
NIX_JJ_GIT_HASH = gitRev;
};
postInstall = ''
$out/bin/jj util install-man-pages man
installManPage ./man/man1/*
installShellCompletion --cmd jj \
--bash <(COMPLETE=bash $out/bin/jj) \
--fish <(COMPLETE=fish $out/bin/jj) \
--zsh <(COMPLETE=zsh $out/bin/jj)
'';
meta = {
description = "Git-compatible DVCS that is both simple and powerful";
homepage = "https://github.com/jj-vcs/jj";
license = lib.licenses.asl20;
mainProgram = "jj";
};
}