-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Expand file tree
/
Copy pathpackage.nix
More file actions
78 lines (69 loc) · 1.96 KB
/
package.nix
File metadata and controls
78 lines (69 loc) · 1.96 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
{
lib,
stdenv,
buildPackages,
fetchFromGitHub,
rustPlatform,
installShellFiles,
pkg-config,
withPCRE2 ? true,
pcre2,
writableTmpDirAsHomeHook,
}:
let
canRunRg = stdenv.hostPlatform.emulatorAvailable buildPackages;
rg = "${stdenv.hostPlatform.emulator buildPackages} $out/bin/rg${stdenv.hostPlatform.extensions.executable}";
in
rustPlatform.buildRustPackage (finalAttrs: {
pname = "ripgrep";
version = "15.1.0";
src = fetchFromGitHub {
owner = "BurntSushi";
repo = "ripgrep";
rev = finalAttrs.version;
hash = "sha256-0gjwYMUlXYnmIWQS1SVzF1yQw1lpveRLw5qp049lc3I=";
};
cargoHash = "sha256-ry3pLuYNwX776Dpj9IE2+uc7eEa5+sQvdNNeG1eJecs=";
nativeBuildInputs = [
installShellFiles
writableTmpDirAsHomeHook # required for wine when cross-compiling to Windows
]
++ lib.optional withPCRE2 pkg-config;
buildInputs = lib.optional withPCRE2 pcre2;
buildFeatures = lib.optional withPCRE2 "pcre2";
postFixup = lib.optionalString canRunRg ''
${rg} --generate man > rg.1
installManPage rg.1
installShellCompletion --cmd rg \
--bash <(${rg} --generate complete-bash) \
--fish <(${rg} --generate complete-fish) \
--zsh <(${rg} --generate complete-zsh)
'';
doInstallCheck = true;
installCheckPhase = ''
file="$(mktemp)"
echo "abc\nbcd\ncde" > "$file"
${rg} -N 'bcd' "$file"
${rg} -N 'cd' "$file"
''
+ lib.optionalString withPCRE2 ''
echo '(a(aa)aa)' | ${rg} -P '\((a*|(?R))*\)'
'';
meta = {
description = "Utility that combines the usability of The Silver Searcher with the raw speed of grep";
homepage = "https://github.com/BurntSushi/ripgrep";
changelog = "https://github.com/BurntSushi/ripgrep/releases/tag/${finalAttrs.version}";
license = with lib.licenses; [
unlicense # or
mit
];
maintainers = with lib.maintainers; [
globin
ma27
zowoq
kaynetik
];
mainProgram = "rg";
platforms = lib.platforms.all;
};
})