nixpkgs/pkgs/tools/misc/mise/default.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

93 lines
2.5 KiB
Nix
Raw Normal View History

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
, mise
2023-12-29 12:04:18 +00:00
, testers
2023-02-26 14:17:01 +00:00
}:
rustPlatform.buildRustPackage rec {
pname = "mise";
2024-09-05 01:41:27 +00:00
version = "2024.9.0";
2023-02-26 14:17:01 +00:00
src = fetchFromGitHub {
owner = "jdx";
repo = "mise";
2023-02-26 14:17:01 +00:00
rev = "v${version}";
2024-09-05 01:41:27 +00:00
hash = "sha256-q515JEpws1UnZm1b8zgGxPvudH846XV+Ct4qKN2mNMQ=";
# 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
'';
2023-02-26 14:17:01 +00:00
};
2024-09-05 01:41:27 +00:00
cargoHash = "sha256-jGqaGbue+AEK0YjhHMlm84XBgA20p8Um03TjctjXVz0=";
2023-02-26 14:17:01 +00:00
2023-08-03 12:40:44 +00:00
nativeBuildInputs = [ installShellFiles pkg-config ];
2023-12-29 12:04:18 +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 \
2024-08-26 22:54:45 +00:00
./src/cli/generate/git_pre_commit.rs \
./src/cli/generate/snapshots/*.snap \
./src/cli/reshim.rs \
./test/cwd/.mise/tasks/filetask
2023-02-26 14:17:01 +00:00
2024-08-26 22:54:45 +00:00
substituteInPlace ./src/test.rs \
--replace-fail '/usr/bin/env bash' '${bash}/bin/bash'
2023-02-26 14:17:01 +00:00
substituteInPlace ./src/env_diff.rs \
2024-08-26 22:54:45 +00:00
--replace-fail '"bash"' '"${bash}/bin/bash"'
2023-02-26 14:17:01 +00:00
substituteInPlace ./src/cli/direnv/exec.rs \
2024-08-26 22:54:45 +00:00
--replace-fail '"env"' '"${coreutils}/bin/env"' \
--replace-fail 'cmd!("direnv"' 'cmd!("${direnv}/bin/direnv"'
2023-02-26 14:17:01 +00:00
'';
checkFlags = [
# Requires .git directory to be present
"--skip=cli::plugins::ls::tests::test_plugin_list_urls"
2024-08-26 22:54:45 +00:00
"--skip=cli::generate::git_pre_commit::tests::test_git_pre_commit"
"--skip=cli::generate::github_action::tests::test_github_action"
2023-02-26 14:17:01 +00:00
];
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
2023-02-26 14:17:01 +00:00
installShellCompletion \
--bash ./completions/mise.bash \
--fish ./completions/mise.fish \
--zsh ./completions/_mise
2023-02-26 14:17:01 +00:00
'';
2023-06-21 12:01:36 +00:00
passthru = {
updateScript = nix-update-script { };
tests.version = testers.testVersion { package = mise; };
2023-06-21 12:01:36 +00:00
};
2023-06-07 06:53:55 +00:00
meta = {
homepage = "https://mise.jdx.dev";
description = "Front-end to your dev env";
changelog = "https://github.com/jdx/mise/releases/tag/v${version}";
2023-02-26 14:17:01 +00:00
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ konradmalik ];
mainProgram = "mise";
2023-02-26 14:17:01 +00:00
};
}