NixOS / nix

Nix, the purely functional package manager
https://nixos.org/
GNU Lesser General Public License v2.1
12.83k stars 1.52k forks source link

`nix flake lock` nix 2.4 and unstable in error "failing to extract archive" #5857

Open ghost opened 2 years ago

ghost commented 2 years ago

Describe the bug I follow the manual to turn my NixOS config to flake, after writing flake.nix when running nix flake lock command with ssh git inputs, report error:

error: failed to extract archive (Write failed)
(use '--show-trace' to show detailed location information)

simular with #5741 I tried with nix 2.4 (pkgs.nixFlakes) and nix unstable, still report this error

Steps To Reproduce

  1. Run nix flake lock
  2. Waiting repository cloned
  3. See error

Expected behavior Lock successful and generate file flake.lock

nix-env --version output nix-env (Nix) 2.5.0pre20211206_d1aaa7e

Additional context My flake.nix

{
  inputs = {
    nixpkgs.url = "git+ssh://git@github.com/NixOS/nixpkgs?ref=nixos-21.11";
    flake-utils.url = "git+ssh://git@github.com/numtide/flake-utils";
  };
  outputs = inputs@{ self, nixpkgs, flake-utils }:
    flake-utils.lib.eachSystem [ "x86_64-linux" ]
    (system: let pkgs = nixpkgs.legacyPackages.${system}; in { }) // {
      nixosConfigurations = {
        workstation = nixpkgs.lib.nixosSystem {
          system = "x86_64-linux";
          modules = [ ./configuration.nix ];
        };
      };
    };
}
ghost commented 2 years ago

And, I tried http input in nix 2.4, also report this error

stale[bot] commented 2 years ago

I marked this as stale due to inactivity. → More info

florence-wolfe commented 1 year ago

I'm still experiencing this issue as well with 2.12.0. It doesn't seem to only be limited to flake commands either.

Whether I use nix flake lock, or nix profile install or even nix-env -if i get the same result. It seems to happen with binaries though.

Here are a few examples

nix flake lock fails nix-env -iA cachix -f https://cachix.org/api/v1/install works nix-env -if https://github.com/cachix/devenv/tarball/v0.5 fails nix profile install nixpkgs#cachix fails nix profile install nixpkgs#hello fails nix-env -iA nixpkgs.hello works

osmano807 commented 1 year ago

Experiencing this on NixOS 22.11.1574.6a3f9996408

[nix-shell:~/test-bug]# cat flake.nix
{
  description = "A very basic flake";

  inputs.latest.url = "github:nixos/nixpkgs/nixos-unstable";

  outputs = { self, nixpkgs }: {

    packages.x86_64-linux.hello = nixpkgs.legacyPackages.x86_64-linux.hello;

    packages.x86_64-linux.default = self.packages.x86_64-linux.hello;

  };
}

[nix-shell:~/test-bug]# nix flake lock --show-trace
error: failed to extract archive (Write failed)

       … while fetching the input 'github:nixos/nixpkgs/nixos-unstable'

       … while updating the flake input 'latest'

       … while updating the lock file of flake 'path:/root/test-bug?lastModified=1673643915&narHash=sha256-ytsbtyERsoM1WKJNfiZRj5UKC+ViPnEhZs47gdCFPVU='
the-argus commented 1 year ago

I am able to reproduce the exact same issue as @osmano807. My configuration can be found at https://github.com/the-argus/nixsys/tree/bddd92bb65958313cd74cdaf679ea185de4b1617. I am using nix 2.11.1.

the-argus commented 1 year ago

Found out the problem was full disk space- it just happened that the update would always fail at the archive extraction, so it would give that error message. Propagating the stderr from tar to the nix stderr would be appreciated, though.