2023-02-26 14:17:01 +00:00
|
|
|
{ lib
|
2023-06-21 12:01:36 +00:00
|
|
|
, nix-update-script
|
2023-02-26 14:17:01 +00:00
|
|
|
, rustPlatform
|
|
|
|
, fetchFromGitHub
|
|
|
|
, installShellFiles
|
|
|
|
, stdenv
|
|
|
|
, coreutils
|
|
|
|
, bash
|
2023-08-03 12:40:44 +00:00
|
|
|
, pkg-config
|
|
|
|
, openssl
|
2023-02-26 14:17:01 +00:00
|
|
|
, direnv
|
|
|
|
, Security
|
2023-10-06 18:47:26 +00:00
|
|
|
, SystemConfiguration
|
2023-02-26 14:17:01 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "rtx";
|
2023-10-05 13:41:07 +00:00
|
|
|
version = "2023.10.1";
|
2023-02-26 14:17:01 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "jdxcode";
|
|
|
|
repo = "rtx";
|
|
|
|
rev = "v${version}";
|
2023-10-05 13:41:07 +00:00
|
|
|
hash = "sha256-E0jBTnfp8asLC2V8TtYSCh6fTxqkFwCMZjsjjBKEN0s=";
|
2023-02-26 14:17:01 +00:00
|
|
|
};
|
|
|
|
|
2023-10-05 13:41:07 +00:00
|
|
|
cargoHash = "sha256-n/GxC5wDfhPboynFu8S1f9+kNDVmcKoSHaT96khyi2Q=";
|
2023-02-26 14:17:01 +00:00
|
|
|
|
2023-08-03 12:40:44 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles pkg-config ];
|
2023-10-06 18:47:26 +00:00
|
|
|
buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security SystemConfiguration ];
|
2023-02-26 14:17:01 +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
|
|
|
|
'';
|
|
|
|
|
2023-06-21 12:01:36 +00:00
|
|
|
passthru = {
|
|
|
|
updateScript = nix-update-script { };
|
|
|
|
};
|
|
|
|
|
2023-06-07 06:53:55 +00:00
|
|
|
meta = {
|
2023-02-26 14:17:01 +00:00
|
|
|
homepage = "https://github.com/jdxcode/rtx";
|
|
|
|
description = "Polyglot runtime manager (asdf rust clone)";
|
|
|
|
changelog = "https://github.com/jdxcode/rtx/releases/tag/v${version}";
|
|
|
|
license = lib.licenses.mit;
|
|
|
|
maintainers = with lib.maintainers; [ konradmalik ];
|
2023-08-03 12:31:09 +00:00
|
|
|
mainProgram = "rtx";
|
2023-02-26 14:17:01 +00:00
|
|
|
};
|
|
|
|
}
|