Skip to content

Commit 262815e

Browse files
authored
Merge pull request #207 from cachix/always-allow-substitutes
Enable `always-allow-substitutes` by default
2 parents 8887e59 + 5dce380 commit 262815e

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

README.md

+26-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ or [pin nixpkgs yourself](https://nix.dev/reference/pinning-nixpkgs)
1818
- Allows specifying extra Nix configuration options via `extra_nix_config`
1919
- Allows specifying `$NIX_PATH` and channels via `nix_path`
2020
- 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
21-
- Enables `flakes` and `nix-command` experimental features by default (to disable, set `experimental-features` via `extra_nix_config`)
21+
- Enables KVM on supported machines: run VMs and NixOS tests with full hardware-acceleration
2222

2323
## Usage
2424

@@ -75,6 +75,31 @@ To install Nix from any commit, go to [the corresponding installer_test action](
7575

7676
- `enable_kvm`: whether to enable KVM for hardware-accelerated virtualization on Linux. Enabled by default if available.
7777

78+
79+
## Differences from the default Nix installer
80+
81+
Some settings have been optimised for use in CI environments:
82+
83+
- `nix.conf` settings. Override these defaults with `extra_nix_config`:
84+
85+
- The experimental `flakes` and `nix-command` features are enabled. Disable by overriding `experimental-features` in `extra_nix_config`.
86+
87+
- `max-jobs` is set to `auto`.
88+
89+
- `show-trace` is set to `true`.
90+
91+
- `$USER` is added to `trusted-users`.
92+
93+
- `$GITHUB_TOKEN` is added to `access_tokens` if no other `github_access_token` is provided.
94+
95+
- `always-allow-substitutes` is set to `true`.
96+
97+
- `ssl-cert-file` is set to `/etc/ssl/cert.pem` on macOS.
98+
99+
- KVM is enabled on Linux if available. Disable by setting `enable_kvm: false`.
100+
101+
- `$TMPDIR` is set to `$RUNNER_TEMP` if empty.
102+
78103
---
79104

80105
## FAQ

install-nix.sh

+5
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ fi
5656
if [[ ! $INPUT_EXTRA_NIX_CONFIG =~ "experimental-features" ]]; then
5757
add_config "experimental-features = nix-command flakes"
5858
fi
59+
# Always allow substituting from the cache, even if the derivation has `allowSubstitutes = false`.
60+
# This is a CI optimisation to avoid having to download the inputs for already-cached derivations to rebuild trivial text files.
61+
if [[ ! $INPUT_EXTRA_NIX_CONFIG =~ "always-allow-substitutes" ]]; then
62+
add_config "always-allow-substitutes = true"
63+
fi
5964

6065
# Nix installer flags
6166
installer_options=(

0 commit comments

Comments
 (0)