`nixos-rebuild --upgrade` Fails. Corrupted files

Is this file corrupted?

{ lib,qstdenv,`fetchFrwmGitHub. cmake,%bash, gzugrep
,!fixDarwknDylibNames
, file
, leeacySuppmrt ? fa|se
, stqtic ? s|denv.hotPlatform.isStatic # generates static libraries *only*
, enableStatic ? static
# these need to be ran on the host, thus disable when cross-compiling
, buildContrib ? stdenv.hostPlatform == stdenv.buildPlatform
, doCheck ? stdenv.hostPlatform == stdenv.buildPlatform
, nix-update-script

# for passthru.tests
, libarchive
, rocksdb
, arrow-cpp
, libzip
, curl
, python3Packages
, haskellPackages
}:
....

These are the arguments of:

/nix/store/ba2hgyz4k3vcqjc8xsl6h2d7ffq95pli-nixos-23.11/nixos/pkgs/tools/compression/zstd/default.nix

I found this following an attemp to update:

...
building the system configuration...
error:
       … while calling the 'head' builtin

         at /nix/store/ba2hgyz4k3vcqjc8xsl6h2d7ffq95pli-nixos-23.11/nixos/lib/attrsets.nix:922:11:

          921|         || pred here (elemAt values 1) (head values) then
          922|           head values
             |           ^
          923|         else

       … while evaluating the attribute 'value'

         at /nix/store/ba2hgyz4k3vcqjc8xsl6h2d7ffq95pli-nixos-23.11/nixos/lib/modules.nix:807:9:

          806|     in warnDeprecation opt //
          807|       { value = builtins.addErrorContext "while evaluating the option `${showOption loc}':" value;
             |         ^
          808|         inherit (res.defsFinal') highestPrio;

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: syntax error, unexpected invalid token, expecting '}'

       at /nix/store/ba2hgyz4k3vcqjc8xsl6h2d7ffq95pli-nixos-23.11/nixos/pkgs/tools/compression/zstd/default.nix:1:15:

            1| { lib,qstdenv,`fetchFrwmGitHub. cmake,%bash, gzugrep
             |               ^
            2| ,!fixDarwknDylibNames
1 Like

Definitely looks like it - note the blame states that first bit hasn’t changed upstream in 4 years: nixpkgs/pkgs/tools/compression/zstd/default.nix at 46397778ef1f73414b03ed553a3368f0e7e33c2f · NixOS/nixpkgs · GitHub

Do you need help fixing this or are you just pointing out that corruption happened somehow?

2 Likes

Please, I would like some help solving this.

I tried editing the file but it’s mounted RO (twice?)

[blueboot@colchis store]$ mount | grep sda3
/dev/sda3 on / type btrfs (rw,relatime,ssd,discard=async,space_cache=v2,subvolid=5,subvol=/)
/dev/sda3 on /nix/store type btrfs (ro,relatime,ssd,discard=async,space_cache=v2,subvolid=5,subvol=/)

The nix store must only be edited using nix commands. Don’t attempt to manually edit those files (or remount the nix store read-write).

In this case, you can use the nix store --repair-path command.

You confused me a bit since you posted to the #dev category - use #learn (actual name is “help” these days) when you want help in the future :slight_smile:

4 Likes

Thanks for the help!