diff --git a/nix-bundle.sh b/nix-bundle.sh index 83d2d11..2e47586 100755 --- a/nix-bundle.sh +++ b/nix-bundle.sh @@ -67,7 +67,8 @@ Flags: --argstr string-valued argument to be passed to Nix functions -f, --file evaluate FILE rather than the default -I, --include add a path to the list of locations used to look up <...> file names - --bin the binary to bundle, relative to TARGET's output path + --bin the binary to bundle, relative to TARGET's output path; defaults to + the lexicographically first file inside /bin Examples: @@ -100,14 +101,6 @@ do shift done -# Check if all required arguments were passed - -if [ -z ${bin+x} ] -then - echo "error: flag '--bin' is required" >&2 - fail -fi - # Create tmp directory for the links produced by `nix build` linkdir=$(mktemp -d) @@ -136,6 +129,13 @@ then target_path="$(readlink "$linkdir/result")" fi +# Apply default for --bin + +if [ -z ${bin+x} ] +then + bin=$(ls "$target_path/bin" | head -1) +fi + # Determine bootstrap function -- This seems like a total hack! bootstrap=nix-bootstrap