2022-03-30 09:31:56 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, rustPlatform
|
|
|
|
, coreutils
|
|
|
|
, bash
|
|
|
|
, installShellFiles
|
|
|
|
, libiconv
|
2023-05-24 13:37:59 +00:00
|
|
|
, mdbook
|
2023-07-15 17:15:38 +00:00
|
|
|
, nix-update-script
|
2022-03-30 09:31:56 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
rustPlatform.buildRustPackage rec {
|
|
|
|
pname = "just";
|
2023-10-19 13:55:26 +00:00
|
|
|
version = "1.15.0";
|
2023-05-24 13:37:59 +00:00
|
|
|
outputs = [ "out" "man" "doc" ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "casey";
|
|
|
|
repo = pname;
|
2023-02-02 18:25:31 +00:00
|
|
|
rev = "refs/tags/${version}";
|
2023-10-19 13:55:26 +00:00
|
|
|
hash = "sha256-r1YJ7L98aLAwBd3g+WlW/UijceR7t9z7aXSZZjlMNnM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
2022-02-10 20:34:41 +00:00
|
|
|
|
2023-10-19 13:55:26 +00:00
|
|
|
cargoHash = "sha256-Fx2BdSHo+W43ZM/SX1ccddXG9QHlftrupT2cbyT4KM0=";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
nativeBuildInputs = [ installShellFiles mdbook ];
|
2021-04-25 03:57:28 +00:00
|
|
|
buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
preCheck = ''
|
|
|
|
# USER must not be empty
|
|
|
|
export USER=just-user
|
|
|
|
export USERNAME=just-user
|
2021-06-28 23:13:55 +00:00
|
|
|
export JUST_CHOOSER="${coreutils}/bin/cat"
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-05-03 20:48:10 +00:00
|
|
|
# Prevent string.rs from being changed
|
|
|
|
cp tests/string.rs $TMPDIR/string.rs
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
sed -i src/justfile.rs \
|
|
|
|
-i tests/*.rs \
|
|
|
|
-e "s@/bin/echo@${coreutils}/bin/echo@g" \
|
2021-06-28 23:13:55 +00:00
|
|
|
-e "s@/usr/bin/env@${coreutils}/bin/env@g"
|
2021-05-03 20:48:10 +00:00
|
|
|
|
|
|
|
# Return unchanged string.rs
|
|
|
|
cp $TMPDIR/string.rs tests/string.rs
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
postBuild = ''
|
|
|
|
cargo run --package generate-book
|
|
|
|
|
|
|
|
# No linkcheck in sandbox
|
|
|
|
echo 'optional = true' >> book/en/book.toml
|
|
|
|
mdbook build book/en
|
|
|
|
find .
|
|
|
|
'';
|
|
|
|
|
2021-06-28 23:13:55 +00:00
|
|
|
checkFlags = [
|
|
|
|
"--skip=edit" # trying to run "vim" fails as there's no /usr/bin/env or which in the sandbox to find vim and the dependency is not easily patched
|
|
|
|
"--skip=run_shebang" # test case very rarely fails with "Text file busy"
|
2021-08-22 07:53:02 +00:00
|
|
|
"--skip=invoke_error_function" # wants JUST_CHOOSER to be fzf
|
2023-07-15 17:15:38 +00:00
|
|
|
"--skip=choose::default" # symlinks cat->fzf which fails as coreutils doesn't understand name
|
2021-06-28 23:13:55 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
postInstall = ''
|
2023-05-24 13:37:59 +00:00
|
|
|
mkdir -p $doc/share/doc/$name
|
|
|
|
mv ./book/en/build/html $doc/share/doc/$name
|
2022-03-05 16:20:37 +00:00
|
|
|
installManPage man/just.1
|
|
|
|
|
|
|
|
installShellCompletion --cmd just \
|
|
|
|
--bash completions/just.bash \
|
|
|
|
--fish completions/just.fish \
|
|
|
|
--zsh completions/just.zsh
|
|
|
|
'';
|
|
|
|
|
2023-08-22 20:05:09 +00:00
|
|
|
setupHook = ./setup-hook.sh;
|
|
|
|
|
2023-07-15 17:15:38 +00:00
|
|
|
passthru.updateScript = nix-update-script { };
|
|
|
|
|
2021-02-05 17:12:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/casey/just";
|
2021-06-28 23:13:55 +00:00
|
|
|
changelog = "https://github.com/casey/just/blob/${version}/CHANGELOG.md";
|
|
|
|
description = "A handy way to save and run project-specific commands";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.cc0;
|
2023-02-02 18:25:31 +00:00
|
|
|
maintainers = with maintainers; [ xrelkd jk adamcstephens ];
|
2023-08-10 07:59:29 +00:00
|
|
|
mainProgram = "just";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|