Closed 573 closed 1 year ago
Ohhh, using a matrix? Cool! I'd try splitting apart those commands into just the parts which vary, and use includes:
, maybe like this:
jobs:
nix-checks:
strategy:
matrix:
includes:
- shell: cljShell
command: clj --version
- shell: rustyShell
command: rustc --version
- shell: rustShell
command: rustc --version
# ...etc
steps:
- uses: actions/checkout@v4
- uses: nicknovitski/nix-develop@v1
with:
arguments: ./#${{ matrix.shell }} --impure --accept-flake-config
- run: ${{ matrix.command }}
But if you only ever need to run a single command in a given shell, that's actually great, and you're past the point of needing this action. I personally think it's a big improvement to move commands from multiple CI yaml steps into single locally executable scripts.
For example, here's a refactor that I would approve on a project
# before
- uses: nicknovitski/nix-develop@v1
- run: cargo fmt --check
- run: cargo-deny check
- run: eclint \
-exclude "Cargo.lock"
- run: codespell \
--skip target,.git \
--ignore-words-list crate
# after
- run: nix develop --command ./run-checks.sh # bash script which calls those other things
I should probably add that advice to the readme...
Does any of this help you?
Awesome! Thx!
with: arguments: .#${{ matrix.shell }} --impure --accept-flake-config
./#
/.#
but somehow not working:
/tmp/nix-shell.epBN0p: line 113: mktemp: command not found /tmp/nix-shell.epBN0p: line 179: mkdir: command not found /tmp/nix-shell.epBN0p: line 180: rm: command not found /tmp/nix-shell.epBN0p: line 181: ln: command not found /tmp/nix-shell.epBN0p: line 119: rm: command not found /tmp/nix-shell.epBN0p: line 120: exec: true: not found
Ah, are you using devenv with flakes? At the moment that requires the flags --impure --keep PATH
, but that's because of something in the action i've now decided to change; it surprised me and it surprised you, so i bet it will surprise other people too.
I just made a new release, v1.1.0, that makes --keep PATH
unnecessary.
I have
Is that translatable to
nix-develop
syntax i. e. not using the default.#
?Right now I only see
but that alone wouldn't help DRY either.