nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 rustPlatform,
4 fetchFromGitHub,
5 versionCheckHook,
6 testers,
7 runCommand,
8 writeText,
9 nix-update-script,
10 brush,
11}:
12
13rustPlatform.buildRustPackage rec {
14 pname = "brush";
15 version = "0.2.20";
16
17 src = fetchFromGitHub {
18 owner = "reubeno";
19 repo = "brush";
20 tag = "brush-shell-v${version}";
21 hash = "sha256-yPd/dU/GOnx+R8tqkvWs+WsN0Zb6AHFITaE+N4m2rco=";
22 };
23
24 cargoHash = "sha256-IrjBd+RswBjk/2QW0syU4Hkj2rLfOn/W+czvdEw86RE=";
25
26 nativeInstallCheckInputs = [
27 versionCheckHook
28 ];
29 doInstallCheck = true;
30 versionCheckProgram = "${placeholder "out"}/bin/${meta.mainProgram}";
31 versionCheckProgramArg = "--version";
32
33 # Found argument '--test-threads' which wasn't expected, or isn't valid in this context
34 doCheck = false;
35
36 passthru = {
37 shellPath = "/bin/brush";
38
39 tests = {
40 complete = testers.testEqualContents {
41 assertion = "brushinfo performs to inspect completions";
42 expected = writeText "expected" ''
43 brush
44 brushctl
45 brushinfo
46 '';
47 actual =
48 runCommand "actual"
49 {
50 nativeBuildInputs = [ brush ];
51 }
52 ''
53 brush -c 'brushinfo complete line bru' >$out
54 '';
55 };
56 };
57
58 updateScript = nix-update-script { extraArgs = [ "--version-regex=brush-shell-v([\\d\\.]+)" ]; };
59 };
60
61 meta = {
62 description = "Bash/POSIX-compatible shell implemented in Rust";
63 homepage = "https://github.com/reubeno/brush";
64 changelog = "https://github.com/reubeno/brush/blob/${src.tag}/CHANGELOG.md";
65 license = lib.licenses.mit;
66 maintainers = with lib.maintainers; [ kachick ];
67 mainProgram = "brush";
68 };
69}