Development
-This chapter has some random notes on hacking on
+This chapter describes how you can modify and extend
NixOS.
@@ -11,7 +11,7 @@ NixOS.
-Hacking on NixOS
+Getting the sourcesBy default, NixOS’s nixos-rebuild command
uses the NixOS and Nixpkgs sources provided by the
@@ -34,12 +34,13 @@ $ git clone git://github.com/NixOS/nixpkgs.git
This will check out the latest NixOS sources to
-/my/sources/nixpkgs/nixos and
-the Nixpkgs sources to
+/my/sources/nixpkgs/nixos
+and the Nixpkgs sources to
/my/sources/nixpkgs.
-If you want to rebuild your system using your (modified) sources, you
-need to tell nixos-rebuild about them using the
- flag:
+(The NixOS source tree lives in a subdirectory of the Nixpkgs
+repository.) If you want to rebuild your system using your (modified)
+sources, you need to tell nixos-rebuild about them
+using the flag:
$ nixos-rebuild switch -I nixpkgs=/my/sources/nixpkgs
@@ -47,24 +48,26 @@ $ nixos-rebuild switch -I nixpkgs=/my/sources/nixpkgs
-nixos-rebuild affects only the system profile.
-To install packages to your user profile from expressions in
-/my/sources, use
-nix-env -f /my/sources/nixpkgs,
-or change the default by replacing the symlink in
+If you want nix-env to use the expressions in
+/my/sources, use nix-env -f
+/my/sources/nixpkgs, or change
+the default by adding a symlink in
~/.nix-defexpr:
-$ rm -f ~/.nix-defexpr/channels
$ ln -s /my/sources/nixpkgs ~/.nix-defexpr/nixpkgs
-
+You may want to delete the symlink
+~/.nix-defexpr/channels_root to prevent root’s
+NixOS channel from clashing with your own tree.
+