#l54 — Public Fediverse posts
Live and recent posts from across the Fediverse tagged #l54, aggregated by home.social.
-
CW: computering, nixos
Today in fun weird little bugs I inflicted upon myself with NixOS:
Flake containing configurations for all of my NixOS machines has configurations for hosts with different architectures (aarch64 and x86_64).
Probably because of that I added a line that explicitly set
colmena.meta.nodeNixpkgsfor all hosts - it ensured that the configured machines would use package definitions with the correct architecture set for them:nodeNixpkgs = builtins.mapAttrs (_: v: v.pkgs) self.nixosConfigurations;As a side effect, which I didn't notice initially, it also caused
nixpkgs.overlaysconfigurations to get duplicated, which didn't manifest itself as a problem until I added a configuration (based on Jovian Experiments) for my Steam Deck. Configs for all the other hosts still evaluated fine, but when I tried to deploy new configs on my steamdeck using colmena, I hit a fun error where it tried to rebuildgamescope, and failed.Why would this happen? Let's take a look at these two bits of code:
https://github.com/Jovian-Experiments/Jovian-NixOS/blob/ad708a479968eac4ed0aef9bc6dd7380cc6c15da/overlay.nix#L24-L26
https://github.com/Jovian-Experiments/Jovian-NixOS/blob/ad708a479968eac4ed0aef9bc6dd7380cc6c15da/pkgs/gamescope/default.nix#L54-L57What they essentially do, is that they take
gamescopepackage definition and add apostInstallscript. And if you evaluate the overlay twice, you get thepostInstallscript added twice. And because of how this one works (copies files from nix store, which are read only), next time it tries to overwrite the files, it errors out.And because it only happened when using colmena, it made looking for the cause of error easier. My dumb luck worked for me this time.
Removing the aforementioned
nodeNixpkgsdefinition fixed this issue, but caused another one: now my arm64 router config got built as x86-64. Good thing I noticed and didn't deploy it, because that sure would've been fun. Probably would've continued to work until reboot, because of binfmt misc emulation being enabled, but figuring out why things fail in weird way later on would probably be puzzling. And made more difficult by the fact that it's my router and I'd have no internet connection without it :ablobcatwink:The proper solution turned out to be explicitly setting the node architecture in
nixpkgs.systemfor every node.Now, this is also weird because I'm already passing
system =argument tonixosSystem, and that eventually gets passed along to: https://github.com/NixOS/nixpkgs/blob/master/nixos/lib/eval-config.nix#L50-L56 which, if I'm reading this correctly, should already definenixpkgs.systemcorrectly, but somehow doesn't. I would love to know why that doesn't happen, but I'll have to leave that one little mystery for another time.