before i use flake and everything seems fine if i run sudo nixos-rebuild switch --flake .#xxx
, but now i can not run sudo nixos-rebuild switch
, it raised error:
[ogios@nixos:/etc/nixos]$ sudo nixos-rebuild switch
error:
… while evaluating the attribute 'config'
at /nix/store/y45vqv6pa8bhgag1dw86rvi6rk55xhxn-source/lib/modules.nix:322:9:
321| options = checked options;
322| config = checked (removeAttrs config [ "_module" ]);
| ^
323| _module = checked (config._module);
… while calling the 'seq' builtin
at /nix/store/y45vqv6pa8bhgag1dw86rvi6rk55xhxn-source/lib/modules.nix:322:18:
321| options = checked options;
322| config = checked (removeAttrs config [ "_module" ]);
| ^
323| _module = checked (config._module);
(stack trace truncated; use '--show-trace' to show the full trace)
error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
at «none»:0: (source not available)
building Nix...
error:
… while evaluating the attribute 'config'
at /nix/store/y45vqv6pa8bhgag1dw86rvi6rk55xhxn-source/lib/modules.nix:322:9:
321| options = checked options;
322| config = checked (removeAttrs config [ "_module" ]);
| ^
323| _module = checked (config._module);
… while calling the 'seq' builtin
at /nix/store/y45vqv6pa8bhgag1dw86rvi6rk55xhxn-source/lib/modules.nix:322:18:
321| options = checked options;
322| config = checked (removeAttrs config [ "_module" ]);
| ^
323| _module = checked (config._module);
(stack trace truncated; use '--show-trace' to show the full trace)
error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
at «none»:0: (source not available)
building the system configuration...
error:
… while evaluating the attribute 'config.system.build.toplevel'
at /nix/store/y45vqv6pa8bhgag1dw86rvi6rk55xhxn-source/lib/modules.nix:322:9:
321| options = checked options;
322| config = checked (removeAttrs config [ "_module" ]);
| ^
323| _module = checked (config._module);
… while calling the 'seq' builtin
at /nix/store/y45vqv6pa8bhgag1dw86rvi6rk55xhxn-source/lib/modules.nix:322:18:
321| options = checked options;
322| config = checked (removeAttrs config [ "_module" ]);
| ^
323| _module = checked (config._module);
(stack trace truncated; use '--show-trace' to show the full trace)
error: file 'nixos-config' was not found in the Nix search path (add it using $NIX_PATH or -I)
at «none»:0: (source not available)
and echo $NIX_PATH
returns nixpkgs=flake:nixpkgs:/nix/var/nix/profiles/per-user/root/channels
what should i do to remove flake usage and rebuild sucessfully