Reinstalling nixos with flakes --> problem with hardware-configuration.nix

Hello there !!
I’m reinstalling nixos on a machine, using flakes. I’m using a flake file I used before.

Here is the link to the flake git:

I am quite struggling to reinstall flakes, getting some error messages. Debugged myself of a few, but this one is tricky :


error:
… while calling the ‘seq’ builtin
at /nix/store/7swmjsxz9m2gamk8q5m0m2byb2gq35v5-source/lib/modules.nix:359:18:
358| options = checked options;
359| config = checked (removeAttrs config [ “_module” ]);
| ^
360| _module = checked (config._module);

   … while evaluating a branch condition
     at /nix/store/7swmjsxz9m2gamk8q5m0m2byb2gq35v5-source/lib/modules.nix:295:9:
      294|       checkUnmatched =
      295|         if config._module.check && config._module.freeformType == null && merged.unmatchedDefns != [ ] then
         |         ^
      296|           let

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

   error: path '/nix/store/47gmghq44mdwmyfrl6pq2rfmnbsvzzrs-source/common/hardware-configuration.nix' does not exist

Do you know what the problem might be ?

hardware-configuration.nix is missing in common as you have them in osytertop etc. I get this sometime changing things around where there seems to be some caching or not updating going on (sorry not sure the exact reason and hopefully someone else can chip in.

I find that nix-collect garbage --delete-older-than =7d or similar then rebuild works…

Thanks for the reply !!!
Damn it didn’t work :((
Have a great day !!

Just closing your flake I noticed this:

nixpkgs.url = "github:nixos/nixpkgs/nixos-25.05";
home-manager = {
url = "github:nix-community/home-manager/release-24.11";

The versions should match when not using nixos unstable (i.e. both 25.05 for example).

I’ll look again if I get chance later…

oooh true
fixed that :smiley:
But still stuck with the hardware config problem :open_mouth:

The nix store doesn’t come into play at eval time, this does nothing.

Garbage collection is not a troubleshooting step, even if there is store corruption the answer is a store repair rather than just random garbage collection. This is only necessary if you’re running out of disk space. Doing this in response evaluation errors (especially excluding things added in the last week) implies a fundamental misunderstanding of how nix works, please join me in my crusade against the cargo cult and stop recommending it.


Caching can come into play if you’re using flakes because flakes have an eval cache, but i’s highly unlikely that this is the issue here. It’s much more likely that your repository doesn’t contain the latest changes, please share your configuration as it is right now; push the state to a separate branch if you’re not ready to merge.

2 Likes

Oh wow you’re a real crusader luv it
The config is the same apart from the home manager version
Changing it didn’t help with the error message :frowning:

You changed the wrong thing.

Change the url in flake.nix and stop touching stateVersion.

Once you’ve done that, please commit and push your current changes.

1 Like

Can you show us a git diff? There are no references to that file in your repository, so it’s hard to go on your word here.

My best guess if there are indeed no changes is that you’re not running the code you think you are, what command are you running, and what is in $NIX_PATH?

Didn’t change StateVersion ? Or I don’t think so :open_mouth: just the url in flake.nix
Pushed the change !

git diff in the fifis_flakes git doesnt return nothing
I’m running “sudo nixos-rebuild switch --flake ~/flakes#thinkbug”
How to I print the $NIX_PATH to you ?
Thanks for the help :slight_smile:

@waffle8946 is referring to a commit from 5 hours ago. You should never touch that value (like the comment right above it says), see this post for details see the wiki entry I just updated for details: FAQ/When do I update stateVersion - NixOS Wiki

The change that ended up being made to it is at least that now you must specify a valid NixOS version, but I still think forcing it to be a hash would prevent mistakes like this… Anyway, this is besides the problem you’re having right now.

Hm, if you’re running that the contents of $NIX_PATH don’t actually matter, but a simple echo $NIX_PATH would do :slight_smile:

You’re sure that directory contains the exact same repository as the commit you’ve just pushed? Again, there is no reference to that file:

~/Documents/Projects/fifis_flakes> rg hardware-configuration
flake.nix
20:          ./thinkbug/hardware-configuration.nix
36:       ./oystertop/hardware-configuration.nix

And actually evaluating your configuration works just fine:

~/Documents/Projects/fifis_flakes> nixos-rebuild dry-build --flake .#thinkbug
building the system configuration...
warning: Git tree '/home/tlater/Documents/Projects/fifis_flakes' is dirty
these 385 derivations will be built:
  /nix/store/00ggwi7kcxh7q83jlrma9p53b4rhc79a-check-link-targets.sh.drv
  /nix/store/m0k29s59q5k2wawa3s4aj0d37hcb4d91-builder.pl.drv
  ...

I.e., if you were using the repository on codeberg, your configuration should evaluate just fine. You have either indeed stumbled upon a rather massive nix bug, or you’re not actually running the code you’ve published.

Actually, you could just do this:

$ nixos-rebuild switch \
  --flake 'git+https://codeberg.org/filemon_filemon/fifis_flakes#thinkbug' \
  --use-remote-sudo

$NIX-SHELL returns
nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels

That does mean that if you ran nixos-rebuild without the --flake flag, it would read your configuration from /etc/nixos/configuration.nix. But as it stands, as long as you actually use the --flake flag, this should not be happening, so…

Give the last command I shared a shot, it’ll just use your codeberg code. If that works, we know for sure it’s something fishy with your local repos, and you should probably just restart from a fresh clone of your own repository.