cachix / cachix-action

Build software only once and put it in a global cache

Home Page:https://cachix.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error: unexpected end-of-file

bbigras opened this issue · comments

It might have started to happen when I added ca-derivations ca-references to experimental-features. I'm already using nix-command flakes.

I have the same problem on my computer, but I'm only using flakes.

Run cachix/cachix-action@v10
Cachix: installing
  /usr/bin/bash -c nix-env --quiet -j8 -iA cachix -f https://cachix.org/api/v1/install
  error: unexpected end-of-file
  Error: Action failed with error: Error: The process '/usr/bin/bash' failed with exit code 1

Hey @bbigras does it still happen?

Yes. On my computer and with github actions on 1 project:
https://github.com/bbigras/dendrite-demo-pinecone/runs/2869034346?check_suite_focus=true

Note that I don't have the problem on https://github.com/bbigras/nix-config/actions/runs/954487561 (I don't use ca-derivations ca-references for this one).

Also note that I can download and decompress https://cachix.org/api/v1/install just fine.

❯ curl https://cachix.org/api/v1/install > install
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 10240  100 10240    0     0  74202      0 --:--:-- --:--:-- --:--:-- 74202

❯ tar xvf install
./
./default.nix

❯ sha256sum default.nix
0c5047f9857fb360c8ad9c61bac4eaef580a18983f3270cbf05ce50cf41fe093  default.nix

❯ nix-env --quiet -j8 -iA cachix -f default.nix
error: unexpected end-of-file

default.nix

{ system ? builtins.currentSystem
, onlyFromSource ? false
}:

let
  mkFakeDerivation = attrs: outputs:
    let
        outputNames = builtins.attrNames outputs;
        common = attrs // outputsSet //
            { type = "derivation";
            outputs = outputNames;
            # TODO: this has name/value pairs
            all = outputsList;
            };
        outputToAttrListElement = outputName:
            { name = outputName;
              value = common // {
                inherit outputName;
                outPath = builtins.storePath (builtins.getAttr outputName outputs);
                # TODO: we lie here so that Nix won't build it
                drvPath = builtins.storePath (builtins.getAttr outputName outputs);
              };
            };
        outputsList = map outputToAttrListElement outputNames;
        outputsSet = builtins.listToAttrs outputsList;
    in outputsSet;
  packages = {
    x86_64-linux.cachix = 
  (mkFakeDerivation 
    { name = "cachix-0.6.0";
      system = "x86_64-linux";
    }
    { out = "/nix/store/q0lqpbbxcn2y4f23nhms7ncj7gvwbid1-cachix-0.6.0";
    }).out;

  x86_64-darwin.cachix = 
  (mkFakeDerivation 
    { name = "cachix-0.6.0";
      system = "x86_64-darwin";
    }
    { out = "/nix/store/wdnz76l76pskfdlbbi74aqnaz0cmadi3-cachix-0.6.0";
    }).out;

  aarch64-linux.cachix = 
  (mkFakeDerivation 
    { name = "cachix-0.6.0";
      system = "aarch64-linux";
    }
    { out = "/nix/store/jh60c0caxfm6x3bl485kjss89ryk3rlz-cachix-0.6.0";
    }).out;

  };  
in if builtins.hasAttr system packages && (!onlyFromSource)
   then packages.${system}
   else import (fetchTarball "https://github.com/NixOS/nixpkgs/tarball/9ffd16b3850536094ca36bc31520bb15a6d5a9ef") { inherit system; }

I'll look into this after lunch :)

This could be related: NixOS/nix#4903

Note that content addressable derivations aren't supported yet: cachix/cachix#373

Closing as it's a Nix issue: NixOS/nix#4977