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

First rebuild on blank system (with network)

serpent213 opened this issue · comments

Thank you for the book!

I'm following Enabling NixOS with Flakes after setting up a server using nixos-anywhere (see also nix-community/nixos-anywhere#202). So maybe that's not the setup you are expecting in this guide.

After creating the configuration.nix as displayed, no flake.nix yet, and running nixos-rebuild test I get:

warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error:
       … <borked>

         at «none»:0: (source not available)

       … while calling the 'import' builtin

         at «string»:1:6:

            1| with import <nixpkgs/nixos> {}; config.system.build.nixos-rebuild
             |      ^

       (stack trace truncated; use '--show-trace' to show the full trace)

       error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
building Nix...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos/modules/installer/tools/nix-fallback-paths.nix' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)
/tmp/nixos-rebuild.JTnmBz/nix
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs' 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...
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels/nixos' does not exist, ignoring
warning: Nix search path entry '/nix/var/nix/profiles/per-user/root/channels' does not exist, ignoring
error: file 'nixpkgs/nixos' was not found in the Nix search path (add it using $NIX_PATH or -I)

       at «none»:0: (source not available)

...which is hard to decypher for me.

Also the target system is only reachable via network, so I need to have the network setup included before doing a rebuild, would be amazing if you could cover that case as well. Would also have expected the bootloader/filesystem config to go there to be able to perform a full rebuild.

I have not used nixos-anywhere, just read its documentation, it seems that it only supports flakes, and according to its documentation, you should already have a flake for deployment, nixos-anywhere gives a template code https://github.com/numtide/nixos-anywhere-examples/blob/main/flake.nix.

So the NixOS system deployed with nixos-anywhere should be directly enabled with flakes and does not support the traditional configuration, you can directly skip all the traditional configuration related content.

Closed, feel free to reopen.