ryan4yin / nixos-and-flakes-book

:hammer_and_wrench: :heart: Want to know NixOS & Flakes in detail? Looking for a beginner-friendly tutorial? Then you've come to the right place! 想要学习使用 NixOS 与 Flakes 吗?在寻找一份新手友好的教程?那你可来对地方了!

Home Page:https://nixos-and-flakes.thiscute.world

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Getting error "does not provide attribute" when following your book

t1endat opened this issue · comments

I'm trying go through your tutorial about enabling Flakes in NixOS, and unfortunately, i get this error when try to run command : sudo nixos-rebuild switch

Error details:

error: flake 'path:/etc/nixos' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."nixos".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."nixos".config.system.build.nixos-rebuild' or 'nixosConfigurations."nixos".config.system.build.nixos-rebuild'

I'm not trying to change anything beyond your instructions to avoid errors, what am I missing?

So do you have /etc/nixos/configuration.nix and /etc/nixos/flake.nix on your NixOS host, and what're their contents?

I just figure out the solution based on your comment, instead run sudo nixos-rebuild switch, i have to run sudo nixos-rebuild switch --flake /etc/nixos#nixos-test

Oh got it, your hostname isn't nixos-test, I overlooked that.

Fixed, thanks for your feedback!