Run several nixos machines which all largely share the same configuration. However I’m now encountering an issue on one machine which refuses to rebuild (see output below).
[root@aelita:/home/aelita]# nixos-rebuild boot --flake github:TimoVerbrugghe/homelab-monorepo?dir=nixos#aelita --refresh --impure --no-write-lock-file
error:
… while updating the lock file of flake 'github:TimoVerbrugghe/homelab-monorepo/248850a31b308ca1013d6c60dc56890b679c0274?dir=nixos&narHash=sha256-EJaNmNJXfpIuJu/RWUhNeosI3TxYww7YXQARPTywu5U%3D'
… while updating the flake input 'nixpkgs'
… while fetching the input 'github:NixOS/nixpkgs/nixos-24.11'
error: adding a file to a tree builder: failed to insert entry: invalid object specified - libvirtd.nix
I don’t have a file called libvirtd.nix and I’m not even using libvirtd options…
Any inputs I use in the flake and files I import in the configuration.nix, I also import/use in some of my other nixos machines and they all rebuild with no issues…
I also built the configuration an another nixos machine and used nix-copy to copy & activate it on the machine encountering errors. That worked and I could verify because nix updated from version 2.24.11 to 2.24.12. But still same issue happening
I’m seeing when I run nix-info -m that nixpkgs is not found?
Whelp, that’ll be impossible to figure out without having the machine to test on then.
Can you get rid of the --impure? That’ll probably show you whatever is causing the issue, at the very least, even if it won’t be immediately obvious why.
[root@aelita:/home/aelita]# nixos-rebuild boot --flake github:TimoVerbrugghe/homelab-monorepo?dir=nixos#aelita --refresh --no-write-lock-file
error:
… while updating the lock file of flake 'github:TimoVerbrugghe/homelab-monorepo/baff57724444dcf2152002c86da66d7e3341c2c6?dir=nixos&narHash=sha256-nnoAT%2BUIyoEPZjL4mUZimKtohnfUsImSLw5JQ5Rul70%3D'
… while updating the flake input 'nixpkgs'
… while fetching the input 'github:NixOS/nixpkgs/nixos-24.11'
error: adding a file to a tree builder: failed to insert entry: invalid object specified - libvirtd.nix
Problem here is that even using nix shell gives me the same error:
[root@aelita:/home/aelita]# nix shell github:NixOS/nixpkgs/nixos-24.11#nixVersions.nix_2_18
error:
… while fetching the input 'github:NixOS/nixpkgs/nixos-24.11'
error: adding a file to a tree builder: failed to insert entry: invalid object specified - libvirtd.nix
Which is why I built the config on another machine (“yumi” in my configs but in short: very similar setup as “aelita”, same nix version, etc…) and then used nix copy to transfer it over to the machine encountering the error. That worked and it got updated. But even after that update, still same error…
Make sure the file is named nix, rename it if it isn’t, and mark it executable.
Then do something like export PATH="/newpath:$PATH" to temporarily add it to PATH. (where /newpath is the directory containing the file you downloaded).
Then continue with your nixos-rebuild.
That will be a waste of your time, it’s a nix bug, rebuilding the same config with the same nix will lead to the same result.
Thanks for the help on this one @waffle8946. But unfortunately nothing worked :(. Tried nix shell --impure… but same error.
Then I downloaded lix as you suggested, renamed it to nix, changed the path, but still same error. I then tried to do a nix build but using the lix executable:
So unfortunately, I just built the machine from scratch. Luckily it was a vm, so I set up a new vm, installed the flake onto it, copied files from the previous vm and now everything is working again (nixos-rebuild, nix-shell -p commands, etc…)
So really don’t know what happened here, but this was my only way to resolve it.