Often I'm configuring a new service and having to run nixos-rebuild switch for the changes to take effect.

For example setting up a configuration for a webserver.

However the nixos-rebuild switch takes quite a few seconds to run. Is there a quicker alternative to rebuild just a subset of my Nixos configuration? I did notice a --fast parameter - however this does not seem to make much of any difference.


nixos-rebuild test - doesn't spend time in updating grub. Run nixos-rebuild switch or nixos-rebuild boot when configured to your heart's content

  • 1
    Is it possible to do nixos-rebuild without network access? Say all I want to do is a config change that shouldn't require any new packages.
    – Philippe
    Mar 11 '20 at 8:51
  • I'm not certain but I believe you can clone the main nixpkgs repository from Github, and then whenever you do a nixos-rebuild you can point it at your local nixpkgs instead of the remote. Explained in the manual here: nixos.org/manual/nixos/stable/index.html#sec-custom-packages
    – Kurtosis
    Sep 25 at 22:11
  • @Philippe I believe recent versions have something of a no-internet switch (or is it coming with nix 2.4?) but I never got it working :}
    – 0fnt
    Oct 26 at 21:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.