diff --git a/pkgs/tools/misc/rtx/default.nix b/pkgs/tools/misc/rtx/default.nix new file mode 100644 index 000000000000..7194dc492b33 --- /dev/null +++ b/pkgs/tools/misc/rtx/default.nix @@ -0,0 +1,63 @@ +{ lib +, rustPlatform +, fetchFromGitHub +, installShellFiles +, stdenv +, coreutils +, bash +, direnv +, Security +}: + +rustPlatform.buildRustPackage rec { + pname = "rtx"; + version = "1.30.5"; + + src = fetchFromGitHub { + owner = "jdxcode"; + repo = "rtx"; + rev = "v${version}"; + sha256 = "sha256-xJecTvhRMHyGOT1JJPSp+k5bI0FvIP2uySBt1R0YZ30="; + }; + + cargoSha256 = "sha256-29aGVKINVemppy+3nGDf5okvmJm72pVYUVbefuey0H8="; + + nativeBuildInputs = [ installShellFiles ]; + buildInputs = lib.optionals stdenv.isDarwin [ Security ]; + + 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 + ''; + + meta = rec { + 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 ]; + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 69b836bc03a6..003541270daa 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -17606,6 +17606,10 @@ with pkgs; asdf-vm = callPackage ../tools/misc/asdf-vm { }; + rtx = callPackage ../tools/misc/rtx { + inherit (darwin.apple_sdk.frameworks) Security; + }; + ### DEVELOPMENT / TOOLS abi-compliance-checker = callPackage ../development/tools/misc/abi-compliance-checker { };