Skip to content

Instantly share code, notes, and snippets.

@sleexyz
Created May 27, 2023 00:04
Show Gist options
  • Save sleexyz/852d38158190187050515c6ad0ba9c2e to your computer and use it in GitHub Desktop.
Save sleexyz/852d38158190187050515c6ad0ba9c2e to your computer and use it in GitHub Desktop.
wrapper around just that always nix develops
self: super: {
just-wrapper = super.writeShellScriptBin "just" ''
# Check if path argument is provided
if [ -z "$1" ]; then
echo "Usage: just <path> [extra_arguments]"
exit 1
fi
# Split the path into $DIRECTORY and $COMMAND
DIRECTORY=$(dirname "$1")
COMMAND=$(basename "$1")
EXTRA_ARGUMENTS="${ "\${@:2}" }"
# Run the command in the desired directory
(cd "$DIRECTORY"; exec nix develop --command sh -c "${super.just}/bin/just $COMMAND $EXTRA_ARGUMENTS")
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment