Compare commits
18 Commits
fix-segfau
...
releases/v
Author | SHA1 | Date | |
---|---|---|---|
06b877d930 | |||
d1407282e6 | |||
9130accbad | |||
9c08345130 | |||
4ad20b153f | |||
65ed8d8b59 | |||
e3eb20c3db | |||
2b219c86f3 | |||
ba979b5e7d | |||
67bd092214 | |||
f104d5a8aa | |||
d266f22fdb | |||
7f8f39bf55 | |||
645ab54feb | |||
557c7af1de | |||
82911d15ab | |||
ff1a6b6f95 | |||
fc1e077596 |
8
.github/workflows/test.yml
vendored
8
.github/workflows/test.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: "nix-action test"
|
||||
name: "install-nix-action test"
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
@ -6,13 +6,15 @@ jobs:
|
||||
tests:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-18.04, macos]
|
||||
os: [ubuntu-18.04, macos-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- run: yarn install --frozen-lockfile
|
||||
- run: yarn build
|
||||
# TODO: just commit it using github
|
||||
- run: git diff --exit-code
|
||||
- run: yarn test
|
||||
- name: Install Nix
|
||||
uses: ./
|
||||
- run: nix-build test.nix
|
||||
- run: nix-build test.nix
|
||||
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,7 +1,6 @@
|
||||
__tests__/runner/*
|
||||
|
||||
# comment out in distribution branches
|
||||
node_modules/
|
||||
|
||||
# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
|
||||
# Logs
|
||||
|
18
README.md
18
README.md
@ -1,8 +1,8 @@
|
||||
# nix-action
|
||||
# install-nix-action
|
||||
|
||||

|
||||

|
||||
|
||||
Installs [Nix](https://nixos.org/nix/) in platform agnostic way (supports: Linux/macOS).
|
||||
Installs [Nix](https://nixos.org/nix/) on GitHub Actions for the supported platforms: Linux and macOS.
|
||||
|
||||
## Usage
|
||||
|
||||
@ -18,18 +18,22 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: cachix/nix-action@v1
|
||||
- uses: cachix/install-nix-action@v3
|
||||
- run: nix-build
|
||||
```
|
||||
|
||||
|
||||
See [action.yml](action.yml) for all options.
|
||||
|
||||
See also [cachix-action](https://github.com/cachix/cachix-action) for
|
||||
simple binary cache setup.
|
||||
simple binary cache setup to speed up your builds and share binaries
|
||||
with developers.
|
||||
|
||||
---
|
||||
|
||||
## Hacking
|
||||
|
||||
Install the dependencies
|
||||
Install the dependencies
|
||||
```bash
|
||||
$ yarn install
|
||||
```
|
||||
@ -39,7 +43,7 @@ Build the typescript
|
||||
$ yarn build
|
||||
```
|
||||
|
||||
Run the tests :heavy_check_mark:
|
||||
Run the tests :heavy_check_mark:
|
||||
```bash
|
||||
$ yarn test
|
||||
```
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: 'Nix'
|
||||
description: 'Install Nix'
|
||||
name: 'Install Nix'
|
||||
description: 'Installs Nix on GitHub Actions for the supported platforms: Linux and macOS.'
|
||||
author: 'Domen Kožar'
|
||||
branding:
|
||||
color: 'blue'
|
||||
|
5
lib/README.md
Normal file
5
lib/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
|
||||
# Generated Code
|
||||
|
||||
The files in this directory are generated.
|
||||
See [src](../src)
|
14
lib/main.js
14
lib/main.js
@ -24,11 +24,23 @@ const fs_1 = require("fs");
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
// rest of the constants
|
||||
const home = os_1.homedir();
|
||||
const { username } = os_1.userInfo();
|
||||
const PATH = process.env.PATH;
|
||||
const INSTALL_PATH = '/opt/nix';
|
||||
const CERTS_PATH = home + '/.nix-profile/etc/ssl/certs/ca-bundle.crt';
|
||||
// Workaround a segfault: https://github.com/NixOS/nix/issues/2733
|
||||
yield exec.exec("sudo", ["mkdir", "-p", "/etc/nix"]);
|
||||
yield exec.exec("sudo", ["sh", "-c", "echo http2 = false >> /etc/nix/nix.conf"]);
|
||||
// Set jobs to number of cores
|
||||
yield exec.exec("sudo", ["sh", "-c", "echo max-jobs = auto >> /etc/nix/nix.conf"]);
|
||||
// Catalina workaround https://github.com/NixOS/nix/issues/2925
|
||||
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", `mkdir -m 0755 ${INSTALL_PATH} && chown runner ${INSTALL_PATH}`]);
|
||||
yield exec.exec("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util", ["-B"]);
|
||||
core.exportVariable('NIX_IGNORE_SYMLINK_STORE', "1");
|
||||
}
|
||||
// TODO: retry due to all the things that go wrong
|
||||
const nixInstall = yield tc.downloadTool('https://nixos.org/nix/install');
|
||||
yield exec.exec("sh", [nixInstall]);
|
||||
|
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "nix-action",
|
||||
"name": "install-nix-action",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "nix-build with the help of caching to Cachix",
|
||||
"description": "Installs Nix on GitHub Actions for the supported platforms: Linux and macOS.",
|
||||
"main": "lib/main.js",
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
@ -10,7 +10,7 @@
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/cachix/nix-action.git"
|
||||
"url": "git+https://github.com/cachix/install-nix-action.git"
|
||||
},
|
||||
"keywords": [
|
||||
"actions",
|
||||
|
8
shell.nix
Normal file
8
shell.nix
Normal file
@ -0,0 +1,8 @@
|
||||
{ pkgs ? import <nixpkgs> {}
|
||||
}:
|
||||
|
||||
pkgs.mkShell {
|
||||
name = "install-nix-action-shell";
|
||||
|
||||
buildInputs = [ pkgs.yarn ];
|
||||
}
|
16
src/main.ts
16
src/main.ts
@ -1,7 +1,7 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import {homedir, userInfo} from 'os';
|
||||
import {homedir, userInfo, type} from 'os';
|
||||
import {existsSync} from 'fs';
|
||||
|
||||
async function run() {
|
||||
@ -9,11 +9,23 @@ async function run() {
|
||||
const home = homedir();
|
||||
const {username} = userInfo();
|
||||
const PATH = process.env.PATH;
|
||||
const INSTALL_PATH = '/opt/nix';
|
||||
const CERTS_PATH = home + '/.nix-profile/etc/ssl/certs/ca-bundle.crt';
|
||||
|
||||
// Workaround a segfault: https://github.com/NixOS/nix/issues/2733
|
||||
await exec.exec("sudo", ["mkdir", "-p", "/etc/nix"]);
|
||||
await exec.exec("sudo", ["echo", "http2 = false", ">>", "/etc/nix/nix.conf"]);
|
||||
await exec.exec("sudo", ["sh", "-c", "echo http2 = false >> /etc/nix/nix.conf"]);
|
||||
|
||||
// Set jobs to number of cores
|
||||
await exec.exec("sudo", ["sh", "-c", "echo max-jobs = auto >> /etc/nix/nix.conf"]);
|
||||
|
||||
// Catalina workaround https://github.com/NixOS/nix/issues/2925
|
||||
if (type() == "Darwin") {
|
||||
await exec.exec("sudo", ["sh", "-c", `echo \"nix\t${INSTALL_PATH}\" >> /etc/synthetic.conf`]);
|
||||
await exec.exec("sudo", ["sh", "-c", `mkdir -m 0755 ${INSTALL_PATH} && chown runner ${INSTALL_PATH}`]);
|
||||
await exec.exec("/System/Library/Filesystems/apfs.fs/Contents/Resources/apfs.util", ["-B"]);
|
||||
core.exportVariable('NIX_IGNORE_SYMLINK_STORE', "1");
|
||||
}
|
||||
|
||||
// TODO: retry due to all the things that go wrong
|
||||
const nixInstall = await tc.downloadTool('https://nixos.org/nix/install');
|
||||
|
Reference in New Issue
Block a user