mirror of
https://github.com/cachix/install-nix-action.git
synced 2024-11-22 00:20:53 +00:00
allow binary caches for runner user
This commit is contained in:
parent
15adaed2d7
commit
9420096b1d
3 changed files with 9 additions and 4 deletions
5
.github/workflows/test.yml
vendored
5
.github/workflows/test.yml
vendored
|
@ -19,5 +19,6 @@ jobs:
|
||||||
uses: ./
|
uses: ./
|
||||||
- run: nix-build test.nix
|
- run: nix-build test.nix
|
||||||
- run: nix-env -iA cachix -f https://github.com/NixOS/nixpkgs/tarball/ab5863afada3c1b50fc43bf774b75ea71b287cde
|
- run: nix-env -iA cachix -f https://github.com/NixOS/nixpkgs/tarball/ab5863afada3c1b50fc43bf774b75ea71b287cde
|
||||||
# cachix should be available
|
- run: cat /etc/nix/nix.conf
|
||||||
- run: which cachix
|
# cachix should be available and be able to configure a cache
|
||||||
|
- run: cachix use cachix
|
|
@ -30,6 +30,8 @@ function run() {
|
||||||
yield exec.exec("sudo", ["sh", "-c", "echo http2 = false >> /etc/nix/nix.conf"]);
|
yield exec.exec("sudo", ["sh", "-c", "echo http2 = false >> /etc/nix/nix.conf"]);
|
||||||
// Set jobs to number of cores
|
// Set jobs to number of cores
|
||||||
yield exec.exec("sudo", ["sh", "-c", "echo max-jobs = auto >> /etc/nix/nix.conf"]);
|
yield exec.exec("sudo", ["sh", "-c", "echo max-jobs = auto >> /etc/nix/nix.conf"]);
|
||||||
|
// Allow binary caches for runner user
|
||||||
|
yield exec.exec("sudo", ["sh", "-c", "echo trusted-users = root runner >> /etc/nix/nix.conf"]);
|
||||||
// Catalina workaround https://github.com/NixOS/nix/issues/2925
|
// Catalina workaround https://github.com/NixOS/nix/issues/2925
|
||||||
if (os_1.type() == "Darwin") {
|
if (os_1.type() == "Darwin") {
|
||||||
yield exec.exec("sudo", ["sh", "-c", `echo \"nix\t${INSTALL_PATH}\" >> /etc/synthetic.conf`]);
|
yield exec.exec("sudo", ["sh", "-c", `echo \"nix\t${INSTALL_PATH}\" >> /etc/synthetic.conf`]);
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import * as core from '@actions/core';
|
import * as core from '@actions/core';
|
||||||
import * as exec from '@actions/exec';
|
import * as exec from '@actions/exec';
|
||||||
import * as tc from '@actions/tool-cache';
|
import * as tc from '@actions/tool-cache';
|
||||||
import {homedir, userInfo, type} from 'os';
|
import {type} from 'os';
|
||||||
import {existsSync} from 'fs';
|
|
||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
|
@ -16,6 +15,9 @@ async function run() {
|
||||||
// Set jobs to number of cores
|
// Set jobs to number of cores
|
||||||
await exec.exec("sudo", ["sh", "-c", "echo max-jobs = auto >> /etc/nix/nix.conf"]);
|
await exec.exec("sudo", ["sh", "-c", "echo max-jobs = auto >> /etc/nix/nix.conf"]);
|
||||||
|
|
||||||
|
// Allow binary caches for runner user
|
||||||
|
await exec.exec("sudo", ["sh", "-c", "echo trusted-users = root runner >> /etc/nix/nix.conf"]);
|
||||||
|
|
||||||
// Catalina workaround https://github.com/NixOS/nix/issues/2925
|
// Catalina workaround https://github.com/NixOS/nix/issues/2925
|
||||||
if (type() == "Darwin") {
|
if (type() == "Darwin") {
|
||||||
await exec.exec("sudo", ["sh", "-c", `echo \"nix\t${INSTALL_PATH}\" >> /etc/synthetic.conf`]);
|
await exec.exec("sudo", ["sh", "-c", `echo \"nix\t${INSTALL_PATH}\" >> /etc/synthetic.conf`]);
|
||||||
|
|
Loading…
Reference in a new issue