Even better would be to have a step that “activates” the nix environment.
- name: "Load environment"
run: nix develop -c bash -c 'echo $PATH' > "$GITHUB_PATH"
# Now you can use all the dependencies
- name: prettier --write
PATH isn’t the only environment variable nix develop sets, especially when compilers and things like pkg-config are involved
Can do something similar for makefile dependencies. I wrote a little about it in https://t-ravis.com/post/nix/nix-make/ (using nix-shell) but basically:
export PATH := $(shell nix-shell -p hello --run 'echo $$PATH')
@echo nice hello
Oh that’s a nice trick
Some links are broken, for example the one to action.yml
Came to mention this as well. The flakes link actually directs to a Notion page containing the same post…
The giant amount of magic going on behind the scenes of even a simple Actions workflow is one of the main reasons I prefer GitLab and the like. You control the container and the commands, and can easily run things locally. Even easier if you’re just using Nix, where you don’t even need the container. Example.