13 rustPlatform.buildRustPackage rec {
16 outputs = [ "out" "man" "doc" ];
18 src = fetchFromGitHub {
21 rev = "refs/tags/${version}";
22 hash = "sha256-4p4otR0W/v0DoWwwcNq/UEDa1V8vlZMpdk33B/9A4Bo=";
25 cargoHash = "sha256-y6wBFjBOeymbXUIeflQ35FxQRMPlDvB0Zeo2bQeZjJ0=";
27 nativeBuildInputs = [ installShellFiles mdbook ];
28 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
31 # USER must not be empty
33 export USERNAME=just-user
34 export JUST_CHOOSER="${coreutils}/bin/cat"
36 # Prevent string.rs from being changed
37 cp tests/string.rs $TMPDIR/string.rs
39 sed -i src/justfile.rs \
41 -e "s@/bin/echo@${coreutils}/bin/echo@g" \
42 -e "s@/usr/bin/env@${coreutils}/bin/env@g"
44 # Return unchanged string.rs
45 cp $TMPDIR/string.rs tests/string.rs
47 # For shell completion tests
48 export PATH=${bashInteractive}/bin:$PATH
53 ./fix-just-path-in-tests.patch
57 cargo run --package generate-book
59 mkdir -p completions man
61 cargo run -- --man > man/just.1
63 for shell in bash fish zsh; do
64 cargo run -- --completions $shell > completions/just.$shell
67 # No linkcheck in sandbox
68 echo 'optional = true' >> book/en/book.toml
74 "--skip=backticks::trailing_newlines_are_stripped" # Wants to use python3 as alternate shell
75 "--skip=choose::invoke_error_function" # wants JUST_CHOOSER to be fzf
76 "--skip=choose::default" # symlinks cat->fzf which fails as coreutils doesn't understand name
77 "--skip=config::tests::show_arguments" # interferes with JUST_CHOOSER being set
78 "--skip=edit::editor_precedence" # 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
79 "--skip=shebang::run_shebang" # test case very rarely fails with "Text file busy"
83 mkdir -p $doc/share/doc/$name
84 mv ./book/en/build/html $doc/share/doc/$name
85 installManPage man/just.1
87 installShellCompletion --cmd just \
88 --bash completions/just.bash \
89 --fish completions/just.fish \
90 --zsh completions/just.zsh
93 setupHook = ./setup-hook.sh;
95 passthru.updateScript = nix-update-script { };
98 homepage = "https://github.com/casey/just";
99 changelog = "https://github.com/casey/just/blob/${version}/CHANGELOG.md";
100 description = "Handy way to save and run project-specific commands";
101 license = licenses.cc0;
102 maintainers = with maintainers; [ xrelkd jk ];
103 mainProgram = "just";