rikhuijzer / cache-install

Use the GitHub Actions cache for Nix packages
MIT License
42 stars 19 forks source link

Error while building a simplest app #9

Closed deemp closed 2 years ago

deemp commented 2 years ago

Hi, @rikhuijzer! Trying to build my simple app to deploy to GH pages. Followed this example and succesfully built locally. But get such error on GitHub. Here's the text:

2s
Run rikhuijzer/cache-install@v1.0.9
 Preparing restore 
/home/runner/work/_actions/rikhuijzer/cache-install/v1.0.9/dist/core.sh prepare-restore
changed ownership of '/nix' from root:root to runner:docker
 Restoring cache for key: nix-3f4f1b928261bdc1a6cce166c81850d9cfbff8ef1c24677500fd2c37f9c3eb4d 
 No cache found for given key 
 Installing with Nix 
/home/runner/work/_actions/rikhuijzer/cache-install/v1.0.9/dist/core.sh install-with-nix
tee: /tmp/nix.conf: Permission denied
Error: The process '/home/runner/work/_actions/rikhuijzer/cache-install/v1.0.9/dist/core.sh' failed with exit code 1
    at ExecState._setResult (/home/runner/work/_actions/rikhuijzer/cache-install/v1.0.9/webpack:/Cache install Nix packages/node_modules/@actions/exec/lib/toolrunner.js:574:1)
    at ExecState.CheckComplete (/home/runner/work/_actions/rikhuijzer/cache-install/v1.0.9/webpack:/Cache install Nix packages/node_modules/@actions/exec/lib/toolrunner.js:557:1)
    at ChildProcess.<anonymous> (/home/runner/work/_actions/rikhuijzer/cache-install/v1.0.9/webpack:/Cache install Nix packages/node_modules/@actions/exec/lib/toolrunner.js:451:1)
    at ChildProcess.emit (events.js:314:20)
    at maybeClose (internal/child_process.js:1022:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)

Do you have any idea how to fix this?

rikhuijzer commented 2 years ago

It looks like you're also installing Nix via cachix/install-nix-action

https://github.com/br4ch1st0chr0n3/try-ghcjs/blob/43d26a9ae0b87c67442129830db3166532d17f67/.github/workflows/main.yaml#L28-L33

while the instructions in the README of this repository are to only use rikhuijzer/cache-install. Then, this Action can handle the permissions when installing Nix.

Having said that, I'm trying to get it to work but don't have much success yet. I've removed the cachix/install-nix-actions and changed your default.nix to

let
  nixpkgs = builtins.fetchGit {
    url = "https://github.com/NixOS/nixpkgs.git";
    rev = "2291838453cd4fc3622aa73270390fc86c4ebf3e";
  };
in with (import (builtins.fetchGit {
  url = "https://github.com/dmjio/miso";
  ref = "refs/tags/1.8.2";
}) {});
pkgs.haskell.packages.ghcjs.callCabal2nix "try-ghcjs" ./. {}

but then nix-shell default.nix gives

error: builder for '/nix/store/7zn7jf9bqj207gwj5jmqvc25b7iwsaqm-ghcjs-base-01014ad.drv' failed with exit code 1;
       last 10 log lines:
       > Initialized empty Git repository in /nix/store/rw6wianl67igvdka1jrddbsrq3q2kri8-ghcjs-base-01014ad/.git/
       > fatal: remote error:
       >   The unauthenticated git protocol on port 9418 is no longer supported.
       > Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
       >
       > fatal: remote error:
       >   The unauthenticated git protocol on port 9418 is no longer supported.
       > Please see https://github.blog/2021-09-01-improving-git-protocol-security-github/ for more information.
       >
       > Unable to checkout 01014ade3f8f5ae677df192d7c2a208bd795b96c from git://github.com/ghcjs/ghcjs-base.
       For full logs, run 'nix log /nix/store/7zn7jf9bqj207gwj5jmqvc25b7iwsaqm-ghcjs-base-01014ad.drv'.
error: 1 dependencies of derivation '/nix/store/9bnzmda3sphnwzbzqryd1hc8ay9zjcvz-ghcjs-base-0.2.0.0.drv' failed to build
error: 1 dependencies of derivation '/nix/store/xyfry5pax1ph3rf0g6al16rccdcralaj-miso-1.8.2.0.drv' failed to build
error: build of '/nix/store/3hbxj8hkg9cw0kzvl8j5xzrys0pc5z74-ghcjs-8.6.0.1.drv', '/nix/store/85ayr5fziyydm0hh5k4gfvvlr4p2laqi-ghc-8.6.4.drv', '/nix/store/xyfry5pax1ph3rf0g6al16rccdcralaj-miso-1.8.2.0.drv' failed

I saw the same thing when running against NixOS stable in CI.

deemp commented 2 years ago

Thank you! Got a similar error when trying to follow nix's CI guide. That's, probably, a ghcjs problem. Maybe will just build js locally and then push