cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
4.27k stars 322 forks source link

Nix error when updating lock file: `adding a file to a tree builder: failed to insert entry: invalid object specified` #1514

Open tomaskallup opened 1 week ago

tomaskallup commented 1 week ago

So I needed a newer kernel for my new laptop, so I updated my system (still on Nixpkgs 24.05 tho) and now all my devenvs stopped working. They seem to work at first, but if I change anything in the setup, I endup with this:

• Updating devenv.lock ...
error:
       … while updating the lock file of flake 'git+file:///path/to/project'

       … while updating the flake input 'devenv'

       … while fetching the input 'github:cachix/devenv'

       error:
       error: adding a file to a tree builder: failed to insert entry: invalid object specified - command.rs

✖ Command produced the following output:

✔ Updating devenv.lock in 0.8s.
Error:   × Command `/nix/store/x74x4sz8ayv0dqc001za5rxxr26l0lmv-nix-2.21-devenv/bin/nix --show-trace --extra-experimental-features nix-command --extra-
  │ experimental-features flakes --option warn-dirty false --keep-going --max-jobs 8 --option eval-cache false flake update` failed with with exit code 1

Looking at #1137, someone mentioned flake: false, but that did not help.

sandydoo commented 1 week ago

Upstream issues:

tomaskallup commented 1 week ago

I tried nix.package = pkgs.nixVersions.nix_2_20; but devenv still fails, does it have it's own version of nix?

Edit: Couldn't find a workaround, reverting to older devenv didn't help, as all of the older versions seem to use nix 2.21, guess I'm resurrecting my shell.nix, because otherwise I can't work.

sandydoo commented 1 week ago

I tried nix.package = pkgs.nixVersions.nix_2_20; but devenv still fails, does it have it's own version of nix?

Yes, we use our own version with performance and bug fixes.

Couldn't find a workaround, reverting to older devenv didn't help, as all of the older versions seem to use nix 2.21, guess I'm resurrecting my shell.nix, because otherwise I can't work.

Hmm. Would've thought dropping down to v1.1 would help. Might need to clear ~/.cache/nix or something.

We could try rolling back the Nix commit mentioned in the above issues.

sandydoo commented 1 week ago

@tomaskallup, which version of devenv were you on when the error appeared?

tomaskallup commented 1 week ago

@tomaskallup, which version of devenv were you on when the error appeared?

I'm not really sure, I'd say <= 1.0.5, but I don't remember.

I'll try removing the cache, maybe that will help.

tomaskallup commented 1 week ago

Allright, removing the cache did help! I can now seemingly use devenv, I have the following in my configuration.nix:

{ pkgs, ... }:
{
  nixpkgs.config.packageOverrides = pkgs: {
    frozenDevenv = import (builtins.fetchTarball "https://github.com/NixOS/nixpkgs/archive/613f8ec128bb662e8478a07aec7c8b5b236430bb.tar.gz") {
      inherit pkgs;
      config.allowUnfree = true;
    };
  };
  environment.systemPackages = [pkgs.frozenDevenv.devenv]
}

And it works (it uses devenv 1.1.0).

Edit: For anyone wondering, the commit hash is parent of this commit https://github.com/NixOS/nixpkgs/commit/aac6c070f5f0dc87829c88179d7583532787b18d, which seems to be the breaking one in 24.05.