The configuration builds when “yuki = nix…” is “nixos = nix…” even though I changed my hostname
in both cases,
sudo nixos-rebuild switch --flake ~/.nix#yuki
fails to build (and same with home manager)
safri@yuki:~/.nix/ > nh os switch ~/.nix#yuki
> Building NixOS configuration
warning: Git tree '/home/safri/.nix' is dirty
error: flake 'git+file:///home/safri/.nix' does not provide attribute 'packages.x86_64-linux.yuki.config.system.build.toplevel', 'legacyPackages.x86_64-linux.yuki.config.system.build.toplevel' or 'yuki.config.system.build.toplevel'
┏━ 1 Errors:
┃ error: flake 'git+file:///home/safri/.nix' does not provide attribute 'packages.x86_64-linux.yuki.config.system.build.toplevel', 'legacyPackages.x86_64-linux.yuki.config.system.build.toplevel' or 'yuki.config.system.build.toplevel'
┣━━━
┗━ ∑ ⚠ Exited with 1 errors reported by nix at 13:33:12 after 0s
Error:
0: Command exited with status Exited(1)
Location:
src/commands.rs:262
Hm, I’ve never used nh, but it doesn’t look like it’s working correctly. The error you should be getting is something like:
building the system configuration...
warning: Git tree '/home/tlater/.local/src/dotfiles' is dirty
error: flake 'git+file:///home/tlater/.local/src/dotfiles' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."aaaaa".config.system.build.toplevel', 'legacyPackages.x86_64-linux.nixosConfigurations."aaaaa".config.system.build.toplevel' or 'nixosConfigurations."aaaaa".config.system.build.toplevel'
The main difference being:
or 'yuki.config.system.build.toplevel'
vs
or 'nixosConfigurations."aaaaa".config.system.build.toplevel'
As such, I would guess nh just doesn’t implement this correctly. Try using nixos-rebuild.
safri@yuki:~/ > sudo nixos-rebuild switch --flake ~/.nix#yuki
[sudo] password for safri:
warning: Git tree '/home/safri/.nix' is dirty
error: flake 'git+file:///home/safri/.nix' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."yuki".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."yuki".config.system.build.nixos-rebuild' or 'nixosConfigurations."yuki".config.system.build.nixos-rebuild'
Everything is working now with this flake, I don’t think it had anything to do with the flake though, I think I just needed to add “nixosConfigurations.yuki” to the build command.
safri@yuki:~/ > nh os switch ~/.nix#nixosConfigurations.yuki
That is simply not the correct attribute to be building. if I were you I would check if the nixos-rebuild script is actually the same as upstream’s. I guess it’s possible you’ve grabbed a newer version of it than your actual nixpkgs version and the attribute is changing or such?
Yea I’m honestly not sure whats happening but its able to build when I preface “nixosConfigurations” and I’m able to specify which host I’m building from.
There was also a period when my server “kumokon” was able to run “nh os switch ~/.nix#$host” just fine but I can’t seem to reproduce that anymore over ssh.