Skip to content

Commit 21e6bcc

Browse files
committed
action: add option to configure updating trusted users
1 parent 53fb48f commit 21e6bcc

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,8 @@ 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+
- `set_as_trusted_user`: whether to add the current user to `trusted-users`. Enabled by default.
79+
7880

7981
## Differences from the default Nix installer
8082

action.yml

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ inputs:
55
extra_nix_config:
66
description: 'Gets appended to `/etc/nix/nix.conf` if passed.'
77
github_access_token:
8-
description: 'Configure nix to pull from github using the given github token.'
8+
description: 'Configure Nix to pull from GitHub using the given GitHub token.'
99
install_url:
1010
description: 'Installation URL that will contain a script to install Nix.'
1111
install_options:
@@ -16,6 +16,10 @@ inputs:
1616
description: 'Enable KVM for hardware-accelerated virtualization on Linux, if available.'
1717
required: false
1818
default: true
19+
set_as_trusted_user:
20+
description: 'Add current user to `trusted-users`.'
21+
required: false
22+
default: true
1923
branding:
2024
color: 'blue'
2125
icon: 'sun'
@@ -31,4 +35,5 @@ runs:
3135
INPUT_INSTALL_URL: ${{ inputs.install_url }}
3236
INPUT_NIX_PATH: ${{ inputs.nix_path }}
3337
INPUT_ENABLE_KVM: ${{ inputs.enable_kvm }}
38+
INPUT_SET_AS_TRUSTED_USER: ${{ inputs.set_as_trusted_user }}
3439
GITHUB_TOKEN: ${{ github.token }}

install-nix.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,10 @@ add_config "max-jobs = auto"
3434
if [[ $OSTYPE =~ darwin ]]; then
3535
add_config "ssl-cert-file = /etc/ssl/cert.pem"
3636
fi
37-
# Allow binary caches for user
38-
add_config "trusted-users = root ${USER:-}"
37+
# Allow binary caches specified at user level
38+
if [[ $INPUT_SET_AS_TRUSTED_USER == 'true' ]]; then
39+
add_config "trusted-users = root ${USER:-}"
40+
fi
3941
# Add a GitHub access token.
4042
# Token-less access is subject to lower rate limits.
4143
if [[ -n "${INPUT_GITHUB_ACCESS_TOKEN:-}" ]]; then

0 commit comments

Comments
 (0)