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").
···11<literal>nixos-unstable</literal> channel (kept in
12<filename>/nix/var/nix/profiles/per-user/root/channels/nixos</filename>).
13To modify NixOS, however, you should check out the latest sources from
14-Git. This is done using the following command:
15-16-<screen>
17-$ nixos-checkout <replaceable>/my/sources</replaceable>
18-</screen>
19-20-or
2122<screen>
23-$ mkdir -p <replaceable>/my/sources</replaceable>
24-$ cd <replaceable>/my/sources</replaceable>
25-$ nix-env -i git
26$ git clone git://github.com/NixOS/nixpkgs.git
27$ cd nixpkgs
28$ git remote add channels git://github.com/NixOS/nixpkgs-channels.git
29$ git remote update channels
30</screen>
3132-This will check out the latest NixOS sources to
33-<filename><replaceable>/my/sources</replaceable>/nixpkgs/nixos</filename>
34-and the Nixpkgs sources to
35-<filename><replaceable>/my/sources</replaceable>/nixpkgs</filename>.
36-(The NixOS source tree lives in a subdirectory of the Nixpkgs
37-repository.) The remote <literal>channels</literal> refers to a
38-read-only repository that tracks the Nixpkgs/NixOS channels (see <xref
39-linkend="sec-upgrading"/> for more information about channels). Thus,
40-the Git branch <literal>channels/nixos-14.12</literal> will contain
41-the latest built and tested version available in the
42-<literal>nixos-14.12</literal> channel.</para>
4344<para>It’s often inconvenient to develop directly on the master
45branch, since if somebody has just committed (say) a change to GCC,
···11<literal>nixos-unstable</literal> channel (kept in
12<filename>/nix/var/nix/profiles/per-user/root/channels/nixos</filename>).
13To modify NixOS, however, you should check out the latest sources from
14+Git. This is as follows:
0000001516<screen>
00017$ git clone git://github.com/NixOS/nixpkgs.git
18$ cd nixpkgs
19$ git remote add channels git://github.com/NixOS/nixpkgs-channels.git
20$ git remote update channels
21</screen>
2223+This will check out the latest Nixpkgs sources to
24+<filename>./nixpkgs</filename> the NixOS sources to
25+<filename>./nixpkgs/nixos</filename>. (The NixOS source tree lives in
26+a subdirectory of the Nixpkgs repository.) The remote
27+<literal>channels</literal> refers to a read-only repository that
28+tracks the Nixpkgs/NixOS channels (see <xref linkend="sec-upgrading"/>
29+for more information about channels). Thus, the Git branch
30+<literal>channels/nixos-14.12</literal> will contain the latest built
31+and tested version available in the <literal>nixos-14.12</literal>
32+channel.</para>
03334<para>It’s often inconvenient to develop directly on the master
35branch, since if somebody has just committed (say) a change to GCC,
···52 # Include some utilities that are useful for installing or repairing
53 # the system.
54 environment.systemPackages =
55- [ pkgs.subversion # for nixos-checkout
56- pkgs.w3m # needed for the manual anyway
57 pkgs.testdisk # useful for repairing boot problems
58 pkgs.mssys # for writing Microsoft boot sectors / MBRs
59 pkgs.parted
···52 # Include some utilities that are useful for installing or repairing
53 # the system.
54 environment.systemPackages =
55+ [ pkgs.w3m # needed for the manual anyway
056 pkgs.testdisk # useful for repairing boot problems
57 pkgs.mssys # for writing Microsoft boot sectors / MBRs
58 pkgs.parted
···49 # Include some utilities that are useful for installing or repairing
50 # the system.
51 environment.systemPackages =
52- [ pkgs.subversion # for nixos-checkout
53- pkgs.w3m # needed for the manual anyway
54 pkgs.ddrescue
55 pkgs.ccrypt
56 pkgs.cryptsetup # needed for dm-crypt volumes
···49 # Include some utilities that are useful for installing or repairing
50 # the system.
51 environment.systemPackages =
52+ [ pkgs.w3m # needed for the manual anyway
053 pkgs.ddrescue
54 pkgs.ccrypt
55 pkgs.cryptsetup # needed for dm-crypt volumes
-60
nixos/modules/installer/tools/nixos-checkout.nix
···1-# This module generates the nixos-checkout script, which performs a
2-# checkout of the Nixpkgs Git repository.
3-4-{ config, lib, pkgs, ... }:
5-6-with lib;
7-8-let
9-10- nixosCheckout = pkgs.substituteAll {
11- name = "nixos-checkout";
12- dir = "bin";
13- isExecutable = true;
14- src = pkgs.writeScript "nixos-checkout"
15- ''
16- #! ${pkgs.stdenv.shell} -e
17-18- if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
19- echo "Usage: `basename $0` [PREFIX]. See NixOS Manual for more info."
20- exit 0
21- fi
22-23- prefix="$1"
24- if [ -z "$prefix" ]; then prefix=/etc/nixos; fi
25- mkdir -p "$prefix"
26- cd "$prefix"
27-28- if [ -z "$(type -P git)" ]; then
29- echo "installing Git..."
30- nix-env -iA nixos.git
31- fi
32-33- # Move any old nixpkgs directories out of the way.
34- backupTimestamp=$(date "+%Y%m%d%H%M%S")
35-36- if [ -e nixpkgs -a ! -e nixpkgs/.git ]; then
37- mv nixpkgs nixpkgs-$backupTimestamp
38- fi
39-40- # Check out the Nixpkgs sources.
41- if ! [ -e nixpkgs/.git ]; then
42- echo "Creating repository in $prefix/nixpkgs..."
43- git init --quiet nixpkgs
44- else
45- echo "Updating repository in $prefix/nixpkgs..."
46- fi
47- cd nixpkgs
48- git remote add origin git://github.com/NixOS/nixpkgs.git || true
49- git remote add channels git://github.com/NixOS/nixpkgs-channels.git || true
50- git remote set-url origin --push git@github.com:NixOS/nixpkgs.git
51- git remote update
52- git checkout master
53- '';
54- };
55-56-in
57-58-{
59- environment.systemPackages = [ nixosCheckout ];
60-}