Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .claude/settings.local.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"permissions": {
"allow": ["WebFetch(domain:nix.dev)"]
}
}
29 changes: 10 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,37 +54,28 @@ jobs:
script: |
echo The future is $FUTURE
[[ -z "${ANSWER}" ]] && exit 1 || exit 0
test-legacy-nix:
test-no-stderr-noise:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Nix
uses: cachix/install-nix-action@v30
with:
nix_path: nixpkgs=channel:release-21.05
extra_nix_config: |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
- name: Test Basic Bash Shell
- name: Run action with packages
uses: ./
with:
script: |
echo "test!"
- name: Test Bash Shell with Packages
uses: ./
with:
packages: hello,docker
packages: hello
script: |
hello
command -v docker
- name: Test Bash Shell with Enviroment
uses: ./
env:
FUTURE: now
ANSWER: 42
with:
script: |
echo The future is $FUTURE
[[ -z "${ANSWER}" ]] && exit 1 || exit 0
- name: Assert wrapper does not use legacy nix run
run: |
if grep -q 'nix run nixpkgs\.' dist/wrapper.sh 2>/dev/null; then
echo "FAIL: wrapper.sh contains legacy 'nix run nixpkgs.' invocation"
exit 1
fi
echo "PASS: no legacy nix run pattern found"

test-flakes:
runs-on: ubuntu-latest
Expand Down
21 changes: 0 additions & 21 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

22 changes: 0 additions & 22 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ export async function run(): Promise<void> {
? `./script.sh`
: `${import.meta.dirname}/script.sh`;

const wrappedPackages = packages
.split(",")
.map((pkg) => `nixpkgs.${pkg.trim()}`)
.join(" ");

const flakeWrappedPackages = flakesFromDevshell
? flakes
: flakes.split(",").join(" ") ||
Expand All @@ -43,24 +38,7 @@ export async function run(): Promise<void> {
const nixWrapper = `
set -euo pipefail

verlte() {
[ "$1" = "$(echo -e "$1\n$2" | sort -V | head -n1)" ]
}

verlt() {
[ "$1" = "$2" ] && return 1 || verlte $1 $2
}

nix_version=$(nix --version | awk '{ print $3 }')

if verlt $nix_version 2.4
then
# before nix 2.4: nix run
nix run ${wrappedPackages} -c ${interpreter} ${scriptPath}
else
# nix 2.4 and later: nix shell
nix --experimental-features 'nix-command flakes' ${nixCommand} ${flakeWrappedPackages} -c ${interpreter} ${scriptPath}
fi
`;

const wrappedScript = `
Expand Down
Loading