2023-07-15 17:15:38 +00:00
|
|
|
{ lib
|
|
|
|
, nix-update-script
|
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
, stdenv
|
|
|
|
, coreutils
|
|
|
|
, bash
|
2023-08-04 22:07:22 +00:00
|
|
|
, pkg-config
|
|
|
|
, openssl
|
2023-07-15 17:15:38 +00:00
|
|
|
, direnv
|
|
|
|
, Security
|
2023-10-09 19:29:22 +00:00
|
|
|
, SystemConfiguration
|
2024-01-02 11:29:13 +00:00
|
|
|
, rtx
|
|
|
|
, testers
|
2023-07-15 17:15:38 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "rtx";
|
2024-01-02 11:29:13 +00:00
|
|
|
version = "2023.12.35";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2024-01-02 11:29:13 +00:00
|
|
|
owner = "jdx";
|
2023-07-15 17:15:38 +00:00
|
|
|
repo = "rtx";
|
|
|
|
rev = "v${version}";
|
2024-01-02 11:29:13 +00:00
|
|
|
hash = "sha256-vzMjC6qIPhZm80hzYQRpF3j+s85B0nwTcgSGRATQEIg=";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
2024-01-02 11:29:13 +00:00
|
|
|
cargoHash = "sha256-LvW5xGVggzuXlFPhbrc93Dht3S9zaQyx9Nm+Mx/Mjh0=";
|
2023-07-15 17:15:38 +00:00
|
|
|
|
2023-08-04 22:07:22 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles pkg-config ];
|
2024-01-02 11:29:13 +00:00
|
|
|
buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security SystemConfiguration ];
|
2023-07-15 17:15:38 +00:00
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
patchShebangs --build ./test/data/plugins/**/bin/* ./src/fake_asdf.rs ./src/cli/reshim.rs
|
|
|
|
|
|
|
|
substituteInPlace ./src/env_diff.rs \
|
|
|
|
--replace '"bash"' '"${bash}/bin/bash"'
|
|
|
|
|
|
|
|
substituteInPlace ./src/cli/direnv/exec.rs \
|
|
|
|
--replace '"env"' '"${coreutils}/bin/env"' \
|
|
|
|
--replace 'cmd!("direnv"' 'cmd!("${direnv}/bin/direnv"'
|
|
|
|
'';
|
|
|
|
|
|
|
|
checkFlags = [
|
|
|
|
# Requires .git directory to be present
|
|
|
|
"--skip=cli::plugins::ls::tests::test_plugin_list_urls"
|
|
|
|
];
|
|
|
|
cargoTestFlags = [ "--all-features" ];
|
|
|
|
# some tests access the same folders, don't test in parallel to avoid race conditions
|
|
|
|
dontUseCargoParallelTests = true;
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
installManPage ./man/man1/rtx.1
|
|
|
|
|
|
|
|
installShellCompletion \
|
|
|
|
--bash ./completions/rtx.bash \
|
|
|
|
--fish ./completions/rtx.fish \
|
|
|
|
--zsh ./completions/_rtx
|
|
|
|
'';
|
|
|
|
|
|
|
|
passthru = {
|
|
|
|
updateScript = nix-update-script { };
|
2024-01-02 11:29:13 +00:00
|
|
|
tests.version = testers.testVersion { package = rtx; };
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
2024-01-02 11:29:13 +00:00
|
|
|
homepage = "https://github.com/jdx/rtx";
|
2023-07-15 17:15:38 +00:00
|
|
|
description = "Polyglot runtime manager (asdf rust clone)";
|
2024-01-02 11:29:13 +00:00
|
|
|
changelog = "https://github.com/jdx/rtx/releases/tag/v${version}";
|
2023-07-15 17:15:38 +00:00
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ konradmalik ];
|
2023-08-04 22:07:22 +00:00
|
|
|
mainProgram = "rtx";
|
2023-07-15 17:15:38 +00:00
|
|
|
};
|
|
|
|
}
|