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
|
2024-01-05 22:21:06 +00:00
|
|
|
, mise
|
2023-12-29 12:04:18 +00:00
|
|
|
, testers
|
2023-02-26 14:17:01 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
2024-01-05 22:21:06 +00:00
|
|
|
pname = "mise";
|
2024-09-05 01:41:27 +00:00
|
|
|
version = "2024.9.0";
|
2023-02-26 14:17:01 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
2023-11-29 23:41:04 +00:00
|
|
|
owner = "jdx";
|
2024-01-05 22:21:06 +00:00
|
|
|
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=";
|
2024-04-21 19:11:39 +00:00
|
|
|
|
|
|
|
# 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 = ''
|
2024-01-05 22:21:06 +00:00
|
|
|
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 \
|
2024-01-05 22:21:06 +00:00
|
|
|
./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 = ''
|
2024-01-05 22:21:06 +00:00
|
|
|
installManPage ./man/man1/mise.1
|
2023-02-26 14:17:01 +00:00
|
|
|
|
|
|
|
installShellCompletion \
|
2024-01-05 22:21:06 +00:00
|
|
|
--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 { };
|
2024-01-05 22:21:06 +00:00
|
|
|
tests.version = testers.testVersion { package = mise; };
|
2023-06-21 12:01:36 +00:00
|
|
|
};
|
|
|
|
|
2023-06-07 06:53:55 +00:00
|
|
|
meta = {
|
2024-01-05 22:21:06 +00:00
|
|
|
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 ];
|
2024-01-05 22:21:06 +00:00
|
|
|
mainProgram = "mise";
|
2023-02-26 14:17:01 +00:00
|
|
|
};
|
|
|
|
}
|