Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

    To edit it, you must edit your system Nix configuration in /etc/nixos/configuration.nix and then rebuild your system, which —get this — requires a network connection to complete! So somehow, to connect to the Internet, you must be able to connect to the Internet.
I'll be pedantic and say that this isn't true, it's not required for you to be connected to the internet to rebuild your system when you're only changing /etc/hosts. However, the fact that it's not immediately obvious _how_ to do this is a rather bad problem with NixOS's tooling.

For what it's worth, the following worked for me, though there appear to be other ways as well:

    cd /etc/nixos # Or wherever you store your configuration.
    nixos-rebuild build
    sudo nix-env -p /nix/var/nix/profiles/system/ --set ./result
    sudo ./result/bin/switch-to-configuration switch
And finally, for a neat report from a few years ago on using NixOS without an internet connection: https://discourse.nixos.org/t/using-nixos-in-an-isolated-env...


Thanks for the comment, that's very interesting! I'm not sure why, but my experience was different -- I think I was running `nixos-unstable` which wanted to query upstream for updates, which I felt necessary because Zoom on the `nixos-stable` was outdated and I needed to join a colleague's video calls.

Thanks for the link, I'll also post two that I saw when I was trying to work this out: - https://discourse.nixos.org/t/rebuild-nixos-offline/3679/4 - https://superuser.com/questions/1688845/nixos-how-to-fix-net...




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: