- Shell 50.3%
- Nix 49.7%
| .forgejo/workflows | ||
| build | ||
| develop | ||
| shell | ||
| .gitignore | ||
| COPYING.md | ||
| README.md | ||
actions/nix
This repository provides a number of Forgejo Actions, all aimed at making it more pleasant to work with both Nix (either by running under NixOS, or using the Nix package manager on its own). The provided actions are listed below. All examples show the default inputs, unless otherwise specified. If the defaults are fine, those inputs can be safely omitted.
All of these actions assume that Nix is used with Flakes.
actions/nix/build
A thin wrapper around nix build, to make it slightly easier to build flakes. While it pretty much just wraps a single nix build invocation, I felt it more appropriate to have it in an action, because the actions/nix/develop and actions/nix/shell actions below do a fair bit more. Having this in an action makes my workflows prettier.
Usage
- name: Build a Nix package
uses: actions/nix/build@main
with:
flake: .
package: # there's no default, Nix itself will fall back to "default"
logs: false
out-link: "result"
By default, it builds the default package in the flake at the root of the repository the action is used for, thus, if all you want to do is build the default package, and don't care about seeing full logs, you do not need to specify any parameters, the action will do the right thing out of the box.
actions/nix/develop
Something I found myself do often, is run commands within a Nix development environment. This action makes that a whole lot nicer, because I don't have to call nix develop -c bash -c "<imagine many lines of shell code here>", I can make it look almost like a regular run property in a workflow!
The script simply puts the contents of run into a shell script, and runs that in a Nix development environment.
Usage
- name: Run something in a development environment
uses: actions/nix/develop@main
with:
flake: .
package: # no default, see above
run: |
# No default here, either!
The commands specified in the run input will be written to a shell script, and the shell script will be executed with bash -eo pipefail. Everything that is in the development environment, will be available for the script.
actions/nix/shell
Exactly the same as actions/nix/develop above, except it runs a shell with the given package available in it, rather than a development environment. Otherwise its behaviour is the same.
Usage
- name: Run something in a Nix shell
uses: actions/nix/shell@main
with:
flake: .
package: # no default, see above
run: |
# No default here, either!
The commands specified in the run input will be written to a shell script, and the shell script will be executed with bash -eo pipefail.