Compare commits
10 Commits
fix-segfau
...
5-max-jobs
Author | SHA1 | Date | |
---|---|---|---|
ba979b5e7d | |||
67bd092214 | |||
f104d5a8aa | |||
d266f22fdb | |||
7f8f39bf55 | |||
645ab54feb | |||
557c7af1de | |||
82911d15ab | |||
ff1a6b6f95 | |||
fc1e077596 |
4
.github/workflows/test.yml
vendored
4
.github/workflows/test.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: "nix-action test"
|
name: "install-nix-action test"
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
push:
|
push:
|
||||||
@ -12,6 +12,8 @@ jobs:
|
|||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- run: yarn install --frozen-lockfile
|
- run: yarn install --frozen-lockfile
|
||||||
- run: yarn build
|
- run: yarn build
|
||||||
|
# TODO: just commit it using github
|
||||||
|
- run: git diff --exit-code
|
||||||
- run: yarn test
|
- run: yarn test
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
uses: ./
|
uses: ./
|
||||||
|
15
README.md
15
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
|
## Usage
|
||||||
|
|
||||||
@ -18,18 +18,19 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
- uses: cachix/nix-action@v1
|
- uses: cachix/install-nix-action@v2
|
||||||
- run: nix-build
|
- run: nix-build
|
||||||
```
|
```
|
||||||
|
|
||||||
See also [cachix-action](https://github.com/cachix/cachix-action) for
|
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
|
## Hacking
|
||||||
|
|
||||||
Install the dependencies
|
Install the dependencies
|
||||||
```bash
|
```bash
|
||||||
$ yarn install
|
$ yarn install
|
||||||
```
|
```
|
||||||
@ -39,7 +40,7 @@ Build the typescript
|
|||||||
$ yarn build
|
$ yarn build
|
||||||
```
|
```
|
||||||
|
|
||||||
Run the tests :heavy_check_mark:
|
Run the tests :heavy_check_mark:
|
||||||
```bash
|
```bash
|
||||||
$ yarn test
|
$ yarn test
|
||||||
```
|
```
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
name: 'Nix'
|
name: 'Install Nix'
|
||||||
description: 'Install Nix'
|
description: 'Installs Nix on GitHub Actions for the supported platforms: Linux and macOS.'
|
||||||
author: 'Domen Kožar'
|
author: 'Domen Kožar'
|
||||||
branding:
|
branding:
|
||||||
color: 'blue'
|
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)
|
@ -24,11 +24,15 @@ const fs_1 = require("fs");
|
|||||||
function run() {
|
function run() {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
try {
|
try {
|
||||||
// rest of the constants
|
|
||||||
const home = os_1.homedir();
|
const home = os_1.homedir();
|
||||||
const { username } = os_1.userInfo();
|
const { username } = os_1.userInfo();
|
||||||
const PATH = process.env.PATH;
|
const PATH = process.env.PATH;
|
||||||
const CERTS_PATH = home + '/.nix-profile/etc/ssl/certs/ca-bundle.crt';
|
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"]);
|
||||||
// TODO: retry due to all the things that go wrong
|
// TODO: retry due to all the things that go wrong
|
||||||
const nixInstall = yield tc.downloadTool('https://nixos.org/nix/install');
|
const nixInstall = yield tc.downloadTool('https://nixos.org/nix/install');
|
||||||
yield exec.exec("sh", [nixInstall]);
|
yield exec.exec("sh", [nixInstall]);
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "nix-action",
|
"name": "install-nix-action",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"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",
|
"main": "lib/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
@ -10,7 +10,7 @@
|
|||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/cachix/nix-action.git"
|
"url": "git+https://github.com/cachix/install-nix-action.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
|
@ -13,7 +13,10 @@ async function run() {
|
|||||||
|
|
||||||
// Workaround a segfault: https://github.com/NixOS/nix/issues/2733
|
// Workaround a segfault: https://github.com/NixOS/nix/issues/2733
|
||||||
await exec.exec("sudo", ["mkdir", "-p", "/etc/nix"]);
|
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"]);
|
||||||
|
|
||||||
// TODO: retry due to all the things that go wrong
|
// TODO: retry due to all the things that go wrong
|
||||||
const nixInstall = await tc.downloadTool('https://nixos.org/nix/install');
|
const nixInstall = await tc.downloadTool('https://nixos.org/nix/install');
|
||||||
|
Reference in New Issue
Block a user