Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running with 24.11 get build error after add flake.nix #203

Open
mwoodpatrick opened this issue Dec 2, 2024 · 2 comments
Open

Running with 24.11 get build error after add flake.nix #203

mwoodpatrick opened this issue Dec 2, 2024 · 2 comments

Comments

@mwoodpatrick
Copy link

Describe the bug
Running with 24.11 and adding the simple flake.nix as /etc/nixos/flake.nix running:

sudo nixos-rebuild switch

I get:

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'

Removing the flake, system build completes normally

To Reproduce

See above

Expected behavior
System should build with no changes

Screenshots
Not applicable.

Environment (please complete the following information):

  • NixOS Version: 24.11
  • Nix version: 2.25.2

Additional context
NixOS is running on WSL-2:

wsl --version
WSL version: 2.4.4.0
Kernel version: 5.15.167.4-1
WSLg version: 1.0.65
MSRDC version: 1.2.5620
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26100.1-240331-1435.ge-release
Windows version: 10.0.22635.4515

@ryan4yin
Copy link
Owner

ryan4yin commented Dec 4, 2024

Please note the comment in flake.nix:

Please replace my-nixos with your hostname

The error indicates that your hostname is currently set to nixos. However, it appears that nixosConfigurations."nixos" is not defined in your `flake.nix.

To resolve this, you can attempt to replace my-nixos with nixos in the flake.nix file and then nixos-rebuild again.

@peppergrayxyz
Copy link

I had the same issue on NixOS. After following the command the host name was still the old name. After a reboot the host name was changed and then it worked. Maybe a new shell would have been sufficient too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants