nixpkgs/pkgs/tools/misc/mise/default.nix
Alexis Hildebrandt f8c4a98e8e treewide: Remove the definite article from meta.description
nix run nixpkgs#silver-searcher -- -G '\.nix$' -0l 'description.*"([Tt]he)? ' pkgs \
  | xargs -0 nix run nixpkgs#gnused -- -i '' -Ee 's/(description.*")[Tt]he (.)/\1\U\2/'
2024-06-09 23:08:46 +02:00

86 lines
2.2 KiB
Nix

{ lib
, nix-update-script
, rustPlatform
, fetchFromGitHub
, installShellFiles
, stdenv
, coreutils
, bash
, pkg-config
, openssl
, direnv
, Security
, SystemConfiguration
, mise
, testers
}:
rustPlatform.buildRustPackage rec {
pname = "mise";
version = "2024.5.9";
src = fetchFromGitHub {
owner = "jdx";
repo = "mise";
rev = "v${version}";
hash = "sha256-vmY+uI/NqMCLJwJaQU+aDppmn5OSLPUIbeqCSlN8Xb0=";
# registry is not needed for compilation nor for tests.
# contains files with the same name but different case, which cause problems with hash on darwin
postFetch = ''
rm -rf $out/registry
'';
};
cargoHash = "sha256-7kcs1vOM68uKjMrRn8jGI6mgXd90TeMUeYWnAGl8sgE=";
nativeBuildInputs = [ installShellFiles pkg-config ];
buildInputs = [ openssl ] ++ lib.optionals stdenv.isDarwin [ Security SystemConfiguration ];
postPatch = ''
patchShebangs --build \
./test/data/plugins/**/bin/* \
./src/fake_asdf.rs \
./src/cli/reshim.rs \
./test/cwd/.mise/tasks/filetask
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/mise.1
installShellCompletion \
--bash ./completions/mise.bash \
--fish ./completions/mise.fish \
--zsh ./completions/_mise
'';
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion { package = mise; };
};
meta = {
homepage = "https://mise.jdx.dev";
description = "Front-end to your dev env";
changelog = "https://github.com/jdx/mise/releases/tag/v${version}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ konradmalik ];
mainProgram = "mise";
};
}