This command was useful when NixOS was spread across multiple repositories, but now it's pretty pointless (and obfuscates what happens, i.e. "git clone git://github.com/NixOS/nixpkgs.git").
···1111<literal>nixos-unstable</literal> channel (kept in
1212<filename>/nix/var/nix/profiles/per-user/root/channels/nixos</filename>).
1313To modify NixOS, however, you should check out the latest sources from
1414-Git. This is done using the following command:
1515-1616-<screen>
1717-$ nixos-checkout <replaceable>/my/sources</replaceable>
1818-</screen>
1919-2020-or
1414+Git. This is as follows:
21152216<screen>
2323-$ mkdir -p <replaceable>/my/sources</replaceable>
2424-$ cd <replaceable>/my/sources</replaceable>
2525-$ nix-env -i git
2617$ git clone git://github.com/NixOS/nixpkgs.git
2718$ cd nixpkgs
2819$ git remote add channels git://github.com/NixOS/nixpkgs-channels.git
2920$ git remote update channels
3021</screen>
31223232-This will check out the latest NixOS sources to
3333-<filename><replaceable>/my/sources</replaceable>/nixpkgs/nixos</filename>
3434-and the Nixpkgs sources to
3535-<filename><replaceable>/my/sources</replaceable>/nixpkgs</filename>.
3636-(The NixOS source tree lives in a subdirectory of the Nixpkgs
3737-repository.) The remote <literal>channels</literal> refers to a
3838-read-only repository that tracks the Nixpkgs/NixOS channels (see <xref
3939-linkend="sec-upgrading"/> for more information about channels). Thus,
4040-the Git branch <literal>channels/nixos-14.12</literal> will contain
4141-the latest built and tested version available in the
4242-<literal>nixos-14.12</literal> channel.</para>
2323+This will check out the latest Nixpkgs sources to
2424+<filename>./nixpkgs</filename> the NixOS sources to
2525+<filename>./nixpkgs/nixos</filename>. (The NixOS source tree lives in
2626+a subdirectory of the Nixpkgs repository.) The remote
2727+<literal>channels</literal> refers to a read-only repository that
2828+tracks the Nixpkgs/NixOS channels (see <xref linkend="sec-upgrading"/>
2929+for more information about channels). Thus, the Git branch
3030+<literal>channels/nixos-14.12</literal> will contain the latest built
3131+and tested version available in the <literal>nixos-14.12</literal>
3232+channel.</para>
43334434<para>It’s often inconvenient to develop directly on the master
4535branch, since if somebody has just committed (say) a change to GCC,
···5252 # Include some utilities that are useful for installing or repairing
5353 # the system.
5454 environment.systemPackages =
5555- [ pkgs.subversion # for nixos-checkout
5656- pkgs.w3m # needed for the manual anyway
5555+ [ pkgs.w3m # needed for the manual anyway
5756 pkgs.testdisk # useful for repairing boot problems
5857 pkgs.mssys # for writing Microsoft boot sectors / MBRs
5958 pkgs.parted
···4949 # Include some utilities that are useful for installing or repairing
5050 # the system.
5151 environment.systemPackages =
5252- [ pkgs.subversion # for nixos-checkout
5353- pkgs.w3m # needed for the manual anyway
5252+ [ pkgs.w3m # needed for the manual anyway
5453 pkgs.ddrescue
5554 pkgs.ccrypt
5655 pkgs.cryptsetup # needed for dm-crypt volumes
-60
nixos/modules/installer/tools/nixos-checkout.nix
···11-# This module generates the nixos-checkout script, which performs a
22-# checkout of the Nixpkgs Git repository.
33-44-{ config, lib, pkgs, ... }:
55-66-with lib;
77-88-let
99-1010- nixosCheckout = pkgs.substituteAll {
1111- name = "nixos-checkout";
1212- dir = "bin";
1313- isExecutable = true;
1414- src = pkgs.writeScript "nixos-checkout"
1515- ''
1616- #! ${pkgs.stdenv.shell} -e
1717-1818- if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
1919- echo "Usage: `basename $0` [PREFIX]. See NixOS Manual for more info."
2020- exit 0
2121- fi
2222-2323- prefix="$1"
2424- if [ -z "$prefix" ]; then prefix=/etc/nixos; fi
2525- mkdir -p "$prefix"
2626- cd "$prefix"
2727-2828- if [ -z "$(type -P git)" ]; then
2929- echo "installing Git..."
3030- nix-env -iA nixos.git
3131- fi
3232-3333- # Move any old nixpkgs directories out of the way.
3434- backupTimestamp=$(date "+%Y%m%d%H%M%S")
3535-3636- if [ -e nixpkgs -a ! -e nixpkgs/.git ]; then
3737- mv nixpkgs nixpkgs-$backupTimestamp
3838- fi
3939-4040- # Check out the Nixpkgs sources.
4141- if ! [ -e nixpkgs/.git ]; then
4242- echo "Creating repository in $prefix/nixpkgs..."
4343- git init --quiet nixpkgs
4444- else
4545- echo "Updating repository in $prefix/nixpkgs..."
4646- fi
4747- cd nixpkgs
4848- git remote add origin git://github.com/NixOS/nixpkgs.git || true
4949- git remote add channels git://github.com/NixOS/nixpkgs-channels.git || true
5050- git remote set-url origin --push git@github.com:NixOS/nixpkgs.git
5151- git remote update
5252- git checkout master
5353- '';
5454- };
5555-5656-in
5757-5858-{
5959- environment.systemPackages = [ nixosCheckout ];
6060-}