diff --git a/pkgs/by-name/br/brush/package.nix b/pkgs/by-name/br/brush/package.nix new file mode 100644 index 000000000000..34dc141a49bd --- /dev/null +++ b/pkgs/by-name/br/brush/package.nix @@ -0,0 +1,68 @@ +{ + lib, + rustPlatform, + fetchFromGitHub, + versionCheckHook, + testers, + runCommand, + writeText, + nix-update-script, + brush, +}: + +rustPlatform.buildRustPackage rec { + pname = "brush"; + version = "0.2.15"; + + src = fetchFromGitHub { + owner = "reubeno"; + repo = "brush"; + tag = "brush-shell-v${version}"; + hash = "sha256-hPF2nXYXAM+5Lz2VJw9vZ6RFZ40y+YkO94Jc/sLUYsg="; + }; + + useFetchCargoVendor = true; + cargoHash = "sha256-A4v4i6U6BwUMNTI/TO7wTQvNVtQYKGiQfDXOCy8hFTE="; + + nativeInstallCheckInputs = [ + versionCheckHook + ]; + doInstallCheck = true; + versionCheckProgram = "${placeholder "out"}/bin/${meta.mainProgram}"; + versionCheckProgramArg = [ "--version" ]; + + # Found argument '--test-threads' which wasn't expected, or isn't valid in this context + doCheck = false; + + passthru = { + tests = { + complete = testers.testEqualContents { + assertion = "brushinfo performs to inspect completions"; + expected = writeText "expected" '' + brush + brushctl + brushinfo + ''; + actual = + runCommand "actual" + { + nativeBuildInputs = [ brush ]; + } + '' + brush -c 'brushinfo complete line bru' >$out + ''; + }; + }; + + updateScript = nix-update-script { extraArgs = [ "--version-regex=brush-shell-v([\\d\\.]+)" ]; }; + }; + + meta = { + description = "Bash/POSIX-compatible shell implemented in Rust"; + homepage = "https://github.com/reubeno/brush"; + changelog = "https://github.com/reubeno/brush/blob/${src.tag}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ kachick ]; + mainProgram = "brush"; + }; +}