Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shebang flakes #1

Closed
wants to merge 14 commits into from
Closed

Commits on Aug 18, 2023

  1. Shellbang support with flakes

    Enables shebang usage of nix shell. All arguments with `#! nix` get
    added to the nix invocation. This implementation does NOT set any
    additional arguments other than placing the script path itself as the
    first argument such that the interpreter can utilize it.
    
    Example below:
    
    ```
        #!/usr/bin/env nix
        #! nix shell --quiet
        #! nix nixpkgs#bash
        #! nix nixpkgs#shellcheck
        #! nix nixpkgs#hello
        #! nix --ignore-environment --command bash
        # shellcheck shell=bash
        set -eu
        shellcheck "$0" || exit 1
        function main {
            hello
            echo 0:"$0" 1:"$1" 2:"$2"
        }
        "$@"
    ```
    
    fix: include programName usage
    tomberek committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    6dd10bd View commit details
    Browse the repository at this point in the history
  2. src/libutil/util.hh: Formatting

    edolstra authored and tomberek committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    021e3f8 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5dafd1e View commit details
    Browse the repository at this point in the history
  4. doc: shebang release notes, docs, tests

    fix: release notes
    tomberek committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    20d3673 View commit details
    Browse the repository at this point in the history
  5. Read file incrementally

    tomberek committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    c4215fd View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    18fc581 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    e38af3a View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    fb21af9 View commit details
    Browse the repository at this point in the history
  9. libcmd: lookupFileArg(): add baseDir

    This will allow a different base directory to be used, matching
    a shebang script location instead of the working directory.
    roberth authored and tomberek committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    3746bdb View commit details
    Browse the repository at this point in the history
  10. nix: Reserve shebang line syntax and only parse double backtick quotes

    Being restrictive about syntax leaves opportunity to improve the
    syntax and functionality later.
    roberth authored and tomberek committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    2cd5449 View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    2d282f1 View commit details
    Browse the repository at this point in the history
  12. Configuration menu
    Copy the full SHA
    9ef43fc View commit details
    Browse the repository at this point in the history
  13. nix/installables.cc: Use getCommandBaseDir() where possible

    These usages of the working directory are perhaps unlikely to
    interact with shebangs, but the code is more consistent this way,
    and we're less likely to miss usages that do interact.
    roberth authored and tomberek committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    1383b04 View commit details
    Browse the repository at this point in the history
  14. doc: apply suggestions

    tomberek committed Aug 18, 2023
    Configuration menu
    Copy the full SHA
    5d33afe View commit details
    Browse the repository at this point in the history