The Nix installer produces a significant number of log messages, but
usually those messages are not really interesting. Group those messages
under a header, so that GitHub will keep them collapsed by default.
(Usually log messages are collapsed under the step title anyway, but if
this action is uses inside another composite action, there is no
separate step title, therefore the whole Nix installer output is
immediately visible when the log section for the outer composite action
is expanded. Adding the group header fixes this problem.)
sudo has stuck around since the early days of this repo when /etc/nix/nix.conf
was being created/mutated and required `sudo`. This was changed to a different/local
file where sudo is no longer needed in commit 642cfa0200.
Don't run the installer if Nix has already been installed on the host.
We assume that the installed Nix is already in the desired state.
This allows to share a given pipeline between hosted and self-hosted
runners. Usually the self-hosted runners are long-lived and already have
Nix installed.
@ -6,16 +6,19 @@ Installs [Nix](https://nixos.org/nix/) on GitHub Actions for the supported platf
By default it has no nixpkgs configured, you have to set `nix_path`
By default it has no nixpkgs configured, you have to set `nix_path`
by [picking a channel](https://status.nixos.org/)
by [picking a channel](https://status.nixos.org/)
or [pin nixpkgs yourself](https://nix.dev/tutorials/towards-reproducibility-pinning-nixpkgs.html).
or [pin nixpkgs yourself](https://nix.dev/reference/pinning-nixpkgs.html)
(see also [pinning tutorial](https://nix.dev/tutorials/towards-reproducibility-pinning-nixpkgs.html)).
# Features
# Features
- Quick installation (~4s on Linux, ~20s on macOS)
- Quick installation (~4s on Linux, ~20s on macOS)
- Multi-User installation (with sandboxing enabled only on Linux)
- Multi-User installation (with sandboxing enabled only on Linux)
- [Self-hosted github runner](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners) support
- [Self-hosted github runner](https://docs.github.com/en/actions/hosting-your-own-runners/about-self-hosted-runners) support
- Allows specifying Nix installation URL via `install_url`
- Allows specifying Nix installation URL via `install_url` (the oldest supported Nix version is 2.3.5)
- Allows specifying extra Nix configration options via `extra_nix_config`
- Allows specifying extra Nix configration options via `extra_nix_config`
- Allows specifying `$NIX_PATH` and channels via `nix_path`
- Allows specifying `$NIX_PATH` and channels via `nix_path`
- Share `/nix/store` between builds using [cachix-action](https://github.com/cachix/cachix-action) for simple binary cache setup to speed up your builds and share binaries with your team
- Enables `flakes` and `nix-command` experimental features by default (to disable, set ``experimental-features`` via ``extra_nix_config``)
## Usage
## Usage
@ -30,20 +33,17 @@ jobs:
tests:
tests:
runs-on:ubuntu-latest
runs-on:ubuntu-latest
steps:
steps:
- uses:actions/checkout@v2
- uses:actions/checkout@v3
- uses:cachix/install-nix-action@v11
- uses:cachix/install-nix-action@v17
with:
with:
nix_path:nixpkgs=channel:nixos-unstable
nix_path:nixpkgs=channel:nixos-unstable
- run:nix-build
- run:nix-build
```
```
See also [cachix-action](https://github.com/cachix/cachix-action) for
simple binary cache setup to speed up your builds and share binaries
To install Nix from any commit, go to [the corresponding installer_test action](https://github.com/NixOS/nix/runs/2219534360) and click on "Run cachix/install-nix-action@XX" step and expand the first line.
## Inputs (specify using `with:`)
## Inputs (specify using `with:`)
-`install_url`: specify URL to install Nix from (useful for testing non-stable releases)
-`install_url`: specify URL to install Nix from (useful for testing non-stable releases or pinning Nix for example https://releases.nixos.org/nix/nix-2.3.7/install)
-`nix_path`: set `NIX_PATH` environment variable, for example `nixpkgs=channel:nixos-unstable`
-`nix_path`: set `NIX_PATH` environment variable, for example `nixpkgs=channel:nixos-unstable`
@ -76,14 +75,56 @@ jobs:
## FAQ
## FAQ
### Is it possible to run NixOS tests / Qemu+KVM with GitHub Actions?
### How do I print nixpkgs version I have configured?
[Currently GitHub Actions are not running on Azure instance types that support nested virtualization](https://github.com/actions/virtual-environments/issues/183#issuecomment-610723516).
### How do I print nixpkgs version with the channel I have configured?
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/*ExperimentalOptions*/
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.