"Flake does not provide attribute

I’m newbie to NixOS and I want to use a simple config that I got from github and here’s the output

[nix-shell:~/Documents]$ sudo nixos-rebuild switch --flake .#pango
error: flake 'path:/home/pango/Documents' does not provide attribute 'packages.x86_64-linux.nixosConfigurations."pango".config.system.build.nixos-rebuild', 'legacyPackages.x86_64-linux.nixosConfigurations."pango".config.system.build.nixos-rebuild' or 'nixosConfigurations."pango".config.system.build.nixos-rebuild'

I also adding this command to nix conf file but it still says that I have to use --experimental-features command everytime I use nix-command / nix flake command

nix.settings.experimental-features = [ "nix-command" "flakes" ];

  nix.extraOptions = ''
    experimental-features = nix-command
    '';

I don’t understand what did I miss and why this happpen can you help me? Thank you.

1 Like

can you post the outputs of these commands from the same ~/Documents directory

nix --extra-experimental-features nix-command --extra-experimental-features flakes flake show

nix-shell -p nix-info --run "nix-info -m"

.# means “use the flake from the directory I’m in”, I’m guessing your config isn’t in ~/Documents?

As for enabling experimental features permanently, you shouldn’t duplicate it like that, but it looks correct. It will only take effect after you’ve successfully deployed it.

if the config isn’t in ~/Documents the error will be different

path '/home/pango/Documents' does not contain a 'flake.nix', searching up
error: could not find a flake.nix file
1 Like

Ah, of course, maybe @pango created an empty flake.nix in there accidentally? Will be interesting to see :slight_smile: