NixOS packages are not upgrading even though I am certainly configured to 'unstable' system state

Latest suggested commands and their outout
$ sudo nix-channel --update
[sudo] password for evangelist: 
unpacking 3 channels...

$ sudo nixos-rebuild switch --upgrade-all
unpacking 3 channels...
unpacking 3 channels...
unpacking 3 channels...
unpacking 3 channels...
error:
       … while calling the 'import' builtin
         at «string»:1:6:
            1| with import <nixpkgs/nixos> {}; config.system.build.nixos-rebuild
             |      ^

       … while realising the context of a path

       … while calling the 'findFile' builtin
         at «string»:1:13:
            1| with import <nixpkgs/nixos> {}; config.system.build.nixos-rebuild
             |             ^

       error: experimental Nix feature 'flakes' is disabled; add '--extra-experimental-features flakes' to enable it
building Nix...
error: experimental Nix feature 'flakes' is disabled; add '--extra-experimental-features flakes' to enable it
error: experimental Nix feature 'flakes' is disabled; add '--extra-experimental-features flakes' to enable it
error: experimental Nix feature 'flakes' is disabled; add '--extra-experimental-features flakes' to enable it
/tmp/nixos-rebuild.JTUehF/nix
error: experimental Nix feature 'flakes' is disabled; add '--extra-experimental-features flakes' to enable it
building the system configuration...
error: experimental Nix feature 'flakes' is disabled; add '--extra-experimental-features flakes' to enable it
nixoslaptop-configs on  main [$] 
$

Notice that it says “Unpacking 3 channels”. @Torinthiel you and I were working with 2 but in my dance and stabbing in the dark with those arbitrary commands reported in my previous post, I added a third one. Not sure which ones are necessary or if we should reduce it back down to 2 or even 1. Here is my nix-channel list as it stands now:

sudo nix-channel --list
[sudo] password for evangelist: 
nixos https://channels.nixos.org/nixos-unstable
nixos-unstable https://nixos.org/channels/nixos-unstable
nixpkgs https://nixos.org/channels/nixos-unstable

We’ll deal with spurious channels later. Good that we got rid of readlink errors.

please run the whole

sudo -i
export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels 
nixos-rebuild switch --upgrade all

as previously.

Eureka! A lot of packages were downloaded and installed / upgraded but new tracebacks remain.

Full details
sudo -i
[sudo] password for evangelist: 
root@nixoslaptop:~/ > export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels 
root@nixoslaptop:~/ > nixos-rebuild switch --upgrade-all
unpacking 3 channels...
unpacking 3 channels...
unpacking 3 channels...
unpacking 3 channels...
error:
       … while evaluating the attribute 'config'
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:12284:
       … while calling the 'seq' builtin
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:12293:
       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
building Nix...
error:
       … while evaluating the attribute 'config'
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:12284:
       … while calling the 'seq' builtin
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:12293:
       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
these 51 paths will be fetched (23.41 MiB download, 95.77 MiB unpacked):
  /nix/store/81bvbv58jrjdcd11m3iv0dk9xf01l48c-acl-2.3.2
  /nix/store/718q5lcpvbk3s8i9pqr19c20n9ma91v7-attr-2.5.2
  /nix/store/d5gymr0i4csibyfz6bm5qz7x4igypwq7-aws-c-auth-0.8.0
  /nix/store/ml0qq5vrlnwwqqiswir7lcf52b1bnv5n-aws-c-cal-0.8.0
  /nix/store/m31f0km2879gz2mkjvhh3b39dk9ipnlb-aws-c-common-0.10.3
  /nix/store/iaf4zqcn8bzh8akr41xm0fhbjfsgi6ws-aws-c-compression-0.3.0
  /nix/store/6iwscm2d6ggz9dsa0x145pk9gl6hmq81-aws-c-event-stream-0.5.0
  /nix/store/3ch7ngnhyfyq7l52flcvkixnrbbvnp5h-aws-c-http-0.9.2
  /nix/store/3grskyxjvap8dizlv359x4k3jgzzgf3b-aws-c-io-0.15.3
  /nix/store/z3a602pmw5g9gwz0sll6xhxjny7lwfmz-aws-c-mqtt-0.11.0
  /nix/store/fgx2g1xx6911aydi0h2agn41sxyw3gxq-aws-c-s3-0.7.1
  /nix/store/cqc82sl1rcwk46r0icwkzpdry4zaa2qn-aws-c-sdkutils-0.2.1
  /nix/store/v82g6zwqnc58vmk7k5az3zs49j7x2awy-aws-checksums-0.2.2
  /nix/store/s7yckqfgk7sf4khpk0ncpj723m39rf7d-aws-crt-cpp-0.29.4
  /nix/store/q61vi73f882nbn8ridd431rg949an09j-aws-sdk-cpp-1.11.448
  /nix/store/fd118hwh7d1ncib4mdw56ylv3g9k0iyj-bash-5.2p37
  /nix/store/qn7qd1vknsrkbm6hgxpk2dc3rr5k2k92-boehm-gc-8.2.8
  /nix/store/6h75nd43hbzp7pcan8w5bmqrq33lvhs2-brotli-1.1.0-lib
  /nix/store/yfyg454f58n9n2rh47wrlqf4641nbka8-busybox-1.36.1
  /nix/store/vv1w45nb0rfqc6n76s11ip085kg1js86-bzip2-1.0.8
  /nix/store/a6lkdradawy6ybr5kv9lh5x5rwa2aa30-curl-8.11.1
  /nix/store/lxjyk27xc131fgi4disl7xy9prh0qqls-editline-1.17.1
  /nix/store/ggqfrwgzpr3v3dkvh4cnmhymnvf6cqja-gcc-14-20241116-lib
  /nix/store/qjg34af79vcz9k2x386wjg6pk905cs42-gcc-14-20241116-libgcc
  /nix/store/81mi7m3k3wsiz9rrrg636sx21psj20hc-glibc-2.40-66
  /nix/store/c8n566488azxaqjsms2dhjpvzl1w90zv-keyutils-1.6.3-lib
  /nix/store/vjvzk9ifx05pwznia9kvbajbh08k4k8a-krb5-1.21.3-lib
  /nix/store/wg8a1qh0lcy84l44h5zvza8d2k3hyxg1-libarchive-3.7.7-lib
  /nix/store/5gszga7x76b41zf7jww9baxwyc3s1yc3-libcpuid-0.7.1
  /nix/store/lgkbq1q5qklfbwp00m3xcpy1pgp0lfpn-libgit2-1.9.0-lib
  /nix/store/pyy5hx150l4m9grcm7k8p0rg863lllgb-libidn2-2.3.7
  /nix/store/njkj1ayhqlnw2msla0b3iknq908274w8-libpsl-0.21.5
  /nix/store/g1fj8fw9clr3xnwkppgwdv985hwi8m30-libseccomp-2.5.5-lib
  /nix/store/1phz9ga6ji0bqflb41l0lvsg0wk24m3q-libsodium-1.0.20
  /nix/store/qpzb764s6v2mpbjh66d3jx7g0qzrd1az-libssh2-1.11.1
  /nix/store/08p73d581f4iagpdx93n3rbk1b03qpbb-libunistring-1.3
  /nix/store/g092gwqmc4l4qk8i4ry4lyglzfxlhr73-libxml2-2.13.5
  /nix/store/ksv45pv2dvsn0pd9mdxh7arf3ya4za64-llhttp-9.2.1
  /nix/store/1k5wrai0gqrcxjqzvprh72ms95p8zarq-lowdown-1.3.2-lib
  /nix/store/1f1ja61ch7s7qzx1qcag0a0dlfsai15d-nghttp2-1.64.0-lib
  /nix/store/glnnzicqirkxlkvbxpv6fr2avzkf4nbx-nix-2.24.12
  /nix/store/c3vszywxbqa3lhzz5mdkz1z2xdh9n4yc-nix-2.24.12-man
  /nix/store/f1nih7ybzfmpgspzp6ixfh9vibdbkygh-openssl-3.3.2
  /nix/store/xlxqgm56nx8b1b20lbk05pd0ndmg3jbn-pcre2-10.44
  /nix/store/3wqqd0s4k0pq357q1sljz11iy6r7jd4r-publicsuffix-list-0-unstable-2025-01-16
  /nix/store/2cg8i9v739rawq8cdvj6w2flxi05ffmv-s2n-tls-1.5.10
  /nix/store/m7i7mj48d03f9i43mnvkq9rg4ls24w68-sqlite-3.47.2
  /nix/store/v5h01qmqjbhj3ysrd1li9364fcnlap2k-xgcc-14-20241116-libgcc
  /nix/store/s9qwscklmg3a6r5mda34f8iyrv8dmail-xz-5.6.3
  /nix/store/jb442jir0a2x7zsk0d63xb6rh8p280ai-zlib-1.3.1
  /nix/store/b2sdg3i6z4llcfmz1wm246hvjbns5ljk-zstd-1.5.6
copying path '/nix/store/yfyg454f58n9n2rh47wrlqf4641nbka8-busybox-1.36.1' from 'https://cache.nixos.org'...
copying path '/nix/store/c3vszywxbqa3lhzz5mdkz1z2xdh9n4yc-nix-2.24.12-man' from 'https://cache.nixos.org'...
copying path '/nix/store/qjg34af79vcz9k2x386wjg6pk905cs42-gcc-14-20241116-libgcc' from 'https://cache.nixos.org'...
copying path '/nix/store/v5h01qmqjbhj3ysrd1li9364fcnlap2k-xgcc-14-20241116-libgcc' from 'https://cache.nixos.org'...
copying path '/nix/store/08p73d581f4iagpdx93n3rbk1b03qpbb-libunistring-1.3' from 'https://cache.nixos.org'...
copying path '/nix/store/3wqqd0s4k0pq357q1sljz11iy6r7jd4r-publicsuffix-list-0-unstable-2025-01-16' from 'https://cache.nixos.org'...
copying path '/nix/store/pyy5hx150l4m9grcm7k8p0rg863lllgb-libidn2-2.3.7' from 'https://cache.nixos.org'...
copying path '/nix/store/81mi7m3k3wsiz9rrrg636sx21psj20hc-glibc-2.40-66' from 'https://cache.nixos.org'...
copying path '/nix/store/718q5lcpvbk3s8i9pqr19c20n9ma91v7-attr-2.5.2' from 'https://cache.nixos.org'...
copying path '/nix/store/m31f0km2879gz2mkjvhh3b39dk9ipnlb-aws-c-common-0.10.3' from 'https://cache.nixos.org'...
copying path '/nix/store/fd118hwh7d1ncib4mdw56ylv3g9k0iyj-bash-5.2p37' from 'https://cache.nixos.org'...
copying path '/nix/store/6h75nd43hbzp7pcan8w5bmqrq33lvhs2-brotli-1.1.0-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/vv1w45nb0rfqc6n76s11ip085kg1js86-bzip2-1.0.8' from 'https://cache.nixos.org'...
copying path '/nix/store/lxjyk27xc131fgi4disl7xy9prh0qqls-editline-1.17.1' from 'https://cache.nixos.org'...
copying path '/nix/store/ggqfrwgzpr3v3dkvh4cnmhymnvf6cqja-gcc-14-20241116-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/c8n566488azxaqjsms2dhjpvzl1w90zv-keyutils-1.6.3-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/5gszga7x76b41zf7jww9baxwyc3s1yc3-libcpuid-0.7.1' from 'https://cache.nixos.org'...
copying path '/nix/store/njkj1ayhqlnw2msla0b3iknq908274w8-libpsl-0.21.5' from 'https://cache.nixos.org'...
copying path '/nix/store/1phz9ga6ji0bqflb41l0lvsg0wk24m3q-libsodium-1.0.20' from 'https://cache.nixos.org'...
copying path '/nix/store/g1fj8fw9clr3xnwkppgwdv985hwi8m30-libseccomp-2.5.5-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/g092gwqmc4l4qk8i4ry4lyglzfxlhr73-libxml2-2.13.5' from 'https://cache.nixos.org'...
copying path '/nix/store/1k5wrai0gqrcxjqzvprh72ms95p8zarq-lowdown-1.3.2-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/ksv45pv2dvsn0pd9mdxh7arf3ya4za64-llhttp-9.2.1' from 'https://cache.nixos.org'...
copying path '/nix/store/1f1ja61ch7s7qzx1qcag0a0dlfsai15d-nghttp2-1.64.0-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/f1nih7ybzfmpgspzp6ixfh9vibdbkygh-openssl-3.3.2' from 'https://cache.nixos.org'...
copying path '/nix/store/xlxqgm56nx8b1b20lbk05pd0ndmg3jbn-pcre2-10.44' from 'https://cache.nixos.org'...
copying path '/nix/store/81bvbv58jrjdcd11m3iv0dk9xf01l48c-acl-2.3.2' from 'https://cache.nixos.org'...
copying path '/nix/store/s9qwscklmg3a6r5mda34f8iyrv8dmail-xz-5.6.3' from 'https://cache.nixos.org'...
copying path '/nix/store/jb442jir0a2x7zsk0d63xb6rh8p280ai-zlib-1.3.1' from 'https://cache.nixos.org'...
copying path '/nix/store/m7i7mj48d03f9i43mnvkq9rg4ls24w68-sqlite-3.47.2' from 'https://cache.nixos.org'...
copying path '/nix/store/iaf4zqcn8bzh8akr41xm0fhbjfsgi6ws-aws-c-compression-0.3.0' from 'https://cache.nixos.org'...
copying path '/nix/store/cqc82sl1rcwk46r0icwkzpdry4zaa2qn-aws-c-sdkutils-0.2.1' from 'https://cache.nixos.org'...
copying path '/nix/store/v82g6zwqnc58vmk7k5az3zs49j7x2awy-aws-checksums-0.2.2' from 'https://cache.nixos.org'...
copying path '/nix/store/qn7qd1vknsrkbm6hgxpk2dc3rr5k2k92-boehm-gc-8.2.8' from 'https://cache.nixos.org'...
copying path '/nix/store/b2sdg3i6z4llcfmz1wm246hvjbns5ljk-zstd-1.5.6' from 'https://cache.nixos.org'...
copying path '/nix/store/ml0qq5vrlnwwqqiswir7lcf52b1bnv5n-aws-c-cal-0.8.0' from 'https://cache.nixos.org'...
copying path '/nix/store/vjvzk9ifx05pwznia9kvbajbh08k4k8a-krb5-1.21.3-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/qpzb764s6v2mpbjh66d3jx7g0qzrd1az-libssh2-1.11.1' from 'https://cache.nixos.org'...
copying path '/nix/store/2cg8i9v739rawq8cdvj6w2flxi05ffmv-s2n-tls-1.5.10' from 'https://cache.nixos.org'...
copying path '/nix/store/wg8a1qh0lcy84l44h5zvza8d2k3hyxg1-libarchive-3.7.7-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/3grskyxjvap8dizlv359x4k3jgzzgf3b-aws-c-io-0.15.3' from 'https://cache.nixos.org'...
copying path '/nix/store/lgkbq1q5qklfbwp00m3xcpy1pgp0lfpn-libgit2-1.9.0-lib' from 'https://cache.nixos.org'...
copying path '/nix/store/6iwscm2d6ggz9dsa0x145pk9gl6hmq81-aws-c-event-stream-0.5.0' from 'https://cache.nixos.org'...
copying path '/nix/store/3ch7ngnhyfyq7l52flcvkixnrbbvnp5h-aws-c-http-0.9.2' from 'https://cache.nixos.org'...
copying path '/nix/store/a6lkdradawy6ybr5kv9lh5x5rwa2aa30-curl-8.11.1' from 'https://cache.nixos.org'...
copying path '/nix/store/d5gymr0i4csibyfz6bm5qz7x4igypwq7-aws-c-auth-0.8.0' from 'https://cache.nixos.org'...
copying path '/nix/store/z3a602pmw5g9gwz0sll6xhxjny7lwfmz-aws-c-mqtt-0.11.0' from 'https://cache.nixos.org'...
copying path '/nix/store/fgx2g1xx6911aydi0h2agn41sxyw3gxq-aws-c-s3-0.7.1' from 'https://cache.nixos.org'...
copying path '/nix/store/s7yckqfgk7sf4khpk0ncpj723m39rf7d-aws-crt-cpp-0.29.4' from 'https://cache.nixos.org'...
copying path '/nix/store/q61vi73f882nbn8ridd431rg949an09j-aws-sdk-cpp-1.11.448' from 'https://cache.nixos.org'...
copying path '/nix/store/glnnzicqirkxlkvbxpv6fr2avzkf4nbx-nix-2.24.12' from 'https://cache.nixos.org'...
building the system configuration...
error:
       … while evaluating the attribute 'config.system.build.toplevel'
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:12284:
       … while calling the 'seq' builtin
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:12293:
       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
root@nixoslaptop:~/ > 

When I re-run the most recent command, the list of packages does not show. Instead all I see are the tracebacks. Here is what we are contending with now more cleanly:

root@nixoslaptop:~/ > nixos-rebuild switch --upgrade-all 
unpacking 3 channels...
unpacking 3 channels...
unpacking 3 channels...
unpacking 3 channels...
error:
       … while evaluating the attribute 'config'
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:12284:
       … while calling the 'seq' builtin
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:12293:
       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
building Nix...
error:
       … while evaluating the attribute 'config'
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:12284:
       … while calling the 'seq' builtin
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:12293:
       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
building the system configuration...
error:
       … while evaluating the attribute 'config.system.build.toplevel'
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:12284:
       … while calling the 'seq' builtin
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:12293:
       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
root@nixoslaptop:~/ > 

That’s not a lot, but a good start. nix itself (the package manager) got updated. It’s still not visible in the OS, but nixos-rebuild is using the new version underneeth.

That’s to be expected. Those got downloaded & stored in your /nix/store, no need to download them again.

It looks like it can’t find your nix configuration. It may sound strange, but actually nixos-install takes special measures to pass it, and nixos-rebuild in flake mode avoids this problem altogether.

Caveat: As warned previously, I’m digging more and more into it and far from my area of comfort. Watch your step.

That being said, I believe there are at least 3 different ways of solving this. If one of them works, there should be no need to run remaining ones. I believe your configuration is at default /etc/nixos/configuration.nix, update below as necessary if it isn’t.

Variant 1:

sudo -i
export NIX_PATH=nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels
nixos-rebuild switch --upgrade all

Variant 2 (based on <nixpkgs/nixos/modules/config/nix-channel.nix>):

sudo -i
export NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels/configuration.nix
nixos-rebuild switch --upgrade all

Variant 3 (explicit configuration):

sudo -i
export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels 
export NIXOS_CONFIG=/etc/nixos/configuration.nix
nixos-rebuild switch --upgrade all

All 3 should be equivalent (barring any typos and my lack of knowledge), if one succeeds there’s no need to run others.

And, having read <nixpkgs/nixos/modules/config/nix-channel.nix>, I think I know :slight_smile: .

1 Like
Variant 1
root@nixoslaptop:~/ > export NIX_PATH=nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels
root@nixoslaptop:~/ > nixos-rebuild switch --upgrade-all
unpacking 3 channels...
unpacking 3 channels...
unpacking 3 channels...
unpacking 3 channels...
building Nix...
building the system configuration...
error:
       … while calling the 'head' builtin
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/attrsets.nix:1:35741:
       … while evaluating the attribute 'value'
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:34707:
       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `warnings':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/boot/systemd/tmpfiles.nix':

       … while evaluating the option `boot.initrd.systemd.storePaths':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/config/console.nix':

       … while evaluating the option `console.keyMap':

       … while evaluating the option `environment.sessionVariables':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/services/x11/desktop-managers/gnome.nix':

       … while evaluating the option `environment.systemPackages':

       … while evaluating definitions from `/etc/nixos/configuration.nix':

       … while evaluating the module argument `inputs' in "/etc/nixos/configuration.nix":

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

       error: attribute 'inputs' missing
       at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:20801:
root@nixoslaptop:~/ > 
Variant 2

warning: Nix search path entry ‘/nix/var/nix/profiles/per-user/root/channels/configuration.nix’ does not exist, ignoring
warning: Nix search path entry ‘/nix/var/nix/profiles/per-user/root/channels/configuration.nix’ does not exist, ignoring
warning: Nix search path entry ‘/nix/var/nix/profiles/per-user/root/channels/configuration.nix’ does not exist, ignoring
warning: Nix search path entry ‘/nix/var/nix/profiles/per-user/root/channels/configuration.nix’ does not exist, ignoring
warning: Nix search path entry ‘/nix/var/nix/profiles/per-user/root/channels/configuration.nix’ does not exist, ignoring
warning: Nix search path entry ‘/nix/var/nix/profiles/per-user/root/channels/configuration.nix’ does not exist, ignoring
error:
… while calling the ‘head’ builtin
at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/attrsets.nix:1:35741:
… while evaluating the attribute ‘value’
at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1:34707:
… while evaluating the option `system.build.toplevel’:

   … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/activation/top-level.nix':

   … while evaluating the option `warnings':

   … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/system/boot/systemd/tmpfiles.nix':

   … while evaluating the option `boot.initrd.systemd.storePaths':

   … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/config/console.nix':

   … while evaluating the option `console.keyMap':

   … while evaluating the option `environment.sessionVariables':

   … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixos/nixos/modules/services/x11/desktop-managers/gnome.nix':

   … while evaluating the option `environment.systemPackages':

   … while evaluating definitions from `/etc/nixos/configuration.nix':

   … while evaluating the module argument `inputs' in "/etc/nixos/configuration.nix":

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

   error: attribute 'inputs' missing
   at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:1:20801:

root@nixoslaptop:~/ >

Variant 3
$ sudo -i
[sudo] password for evangelist: 
root@nixoslaptop:~/ > export NIX_PATH=/nix/var/nix/profiles/per-user/root/channels 
root@nixoslaptop:~/ > export NIXOS_CONFIG=/etc/nixos/configuration.nix
root@nixoslaptop:~/ > nixos-rebuild switch --upgrade-all
unpacking 3 channels...
unpacking 3 channels...
unpacking 3 channels...
unpacking 3 channels...
building Nix...
building the system configuration...
error:
       … while calling the 'head' builtin
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/attrsets.nix:1:35741:
       … while evaluating the attribute 'value'
         at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:34707:
       … while evaluating the option `system.build.toplevel':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/activation/top-level.nix':

       … while evaluating the option `warnings':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/system/boot/systemd/tmpfiles.nix':

       … while evaluating the option `boot.initrd.systemd.storePaths':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/config/console.nix':

       … while evaluating the option `console.keyMap':

       … while evaluating the option `environment.sessionVariables':

       … while evaluating definitions from `/nix/var/nix/profiles/per-user/root/channels/nixpkgs/nixos/modules/services/x11/desktop-managers/gnome.nix':

       … while evaluating the option `environment.systemPackages':

       … while evaluating definitions from `/etc/nixos/configuration.nix':

       … while evaluating the module argument `inputs' in "/etc/nixos/configuration.nix":

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

       error: attribute 'inputs' missing
       at /nix/var/nix/profiles/per-user/root/channels/nixpkgs/lib/modules.nix:1:20801:
root@nixoslaptop:~/ > 

One more thing to consider: A recurring theme in these tracebacks (recent ones and previous ones) suggest that nixpkgs can’t access configuration.nix. I am handling my configuration.nix inside a home user directory which is symlinked to /etc/nixos. See here:

❯ sudo -i
root@nixoslaptop:~/ > ls -la /etc/nixos/                  
total 12
drwxr-xr-x  2 root root 4096 Feb  5 18:13 .
drwxr-xr-x 39 root root 4096 Feb  4 18:53 ..
lrwxrwxrwx  1 root root   54 Jan  4 02:41 configuration.nix -> /home/evangelist/nixoslaptop-configs/configuration.nix
lrwxrwxrwx  1 root root   63 Jan  4 02:55 hardware-configuration.nix -> /home/evangelist/nixoslaptop-configs/hardware-configuration.nix
root@nixoslaptop:~/ > 

So configuration.nix does exist and it exists in the appropriate location as far as I can tell.

not really, it says

whuch means that it can find configuration.nix, but that file is expecting an inputs parameter that cannot be found. And indeed, the repo you’ve share previously has that. That’s a common convention (and only convention, nothing is forcing it and there are other ways) when using flakes, and looking deeper into your file, there is nixoslaptop-configs/configuration.nix at 7fa0e855fabece12b77ed3e604def3fceb846627 · enoren5/nixoslaptop-configs · GitHub which uses it.

Again, 3 venues are ahead, but this time more diffrerent than previously. You can either drop helix (possibly just for now). in this case remove thst line and remove inputs from nixoslaptop-configs/configuration.nix at 7fa0e855fabece12b77ed3e604def3fceb846627 · enoren5/nixoslaptop-configs · GitHub so that it reads { config, pkgs, lib, ... }:. After that run any of the 3 previous sets of commands.

You can return to flake config, effectively undoing what we done so far. This means recreating the flake.nix file that was deleted (isn’t that complex). This will get your packages upgraded now, but --upgrade-all to nixos-rebuild will not update it further. Upgrading is a simple command, but a different one.

Finally, we can try installing helix without flake, no idea how complex it. Especially as it’s available in nixpkgs by default, so you probably had a reason to pick a non-default one.

There’s nothing preventing us from removing helix temporarily and trying too re-add it later when we got nixos back into a sane state.

1 Like

You fixed it! Removing inputs from the top line of configuration.nix as well as removing that line involving helix. I then used the first variant as super user and VOILA, everything upgraded and I am finally up to date. Thank you very much @Torinthiel for spending so much time and researching at such great length to help a novice user like me! :slightly_smiling_face:

Glad to hear that. There are still a few details to wrap up - you have too many channels added, and there might be an issue with helix. If you want we can try to solve those (though probably better on separate thread or PM). Also, if some of the things we did in between are unclear, here’s the moment to ask.

1 Like

The origin of the whole issue with Helix was that it was in ryan4yin’s Unofficial Flakes Book that I was following originally. He used it to demo how to build an app from source using Flakes. I don’t intend on using the tool. My text editor of choice is Neovim and I have NvChad installed as well.

I will create a new thread to troubleshoot multiple channels.

My only outstanding question is: Which documentation were you reading/consulting that informed your research and suggested commands? Was it the official NixOS docs/wiki? Or Stack Overflow? Do you have some links to share?

Thank you again, my friend.

That’s unfortunately a pretty tough question. I wasn’t consulting a lot when solving this (had I, maybe we’d have to go through fewer iterations). What I did (at the time) was e.g. to read man sudo to figure out why sudo NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/root/channels nixos-rebuild switch --upgrade all didn’t work. It was more like reading the error message you’ve provided, figuring out what it really means (I agree, those aren’t very readable) and imagining where to point it to solve this specific issue, not wondering what will break next. Most of this unfortunately comes with generic experience, understanding how Linux/Nix/NixOs stuff works etc. rather than specific info after encountering an issue.

As for stuff to read - nix & NixOS official manuals obviously (weirdly enough, I haven’t read nixpkgs one). If you want to know more about nix & nixpgks (less so about NixOs) than Nix pills is relatively nice introduction. Modularize Your NixOS Configuration | NixOS & Flakes Book has some nice introduction to nixos modules (and, really, nixos is just nixpkgs + module system + set of modules). In general it’s mostly about flakes (hey, have you noticed the domain name? :stuck_out_tongue:), but there are also fragments of non-flake information, in other sections as well.

Reading the source of nixpkgs and nixos itself (it’s the same repository) isn’t that hard, once you get the hang of it (disclaimer: I’m a dev by trade, reading code is pretty natural for me in the first place. Also helps with getting head or tails of cryptic error messages). However, I’ve read quite a few things in general on nix to build a mental image on nixos, and I won’t be able to disclose all of that. Also note that pretty famous monad tutorial fallacy applies, even though NixOS has nothing to do with monads. You can read it not, just mentally replace monad with ‘whatever complex concept you’re trying to grasp’. Even if I give you the single reference I consider most influential, I might be lying both to you and to myself.

2 Likes