nixos-checkout: Add nixpkgs-channels as a remote

This way, you can do things like

git checkout channels/nixos-14.12

to get the latest tested and built version of NixOS.

Changed files
+15 -4
nixos
modules
installer
+15 -4
nixos/modules/installer/tools/nixos-checkout.nix
···
-
# This module generates the nixos-checkout script, which replaces the
-
# Nixpkgs source trees in /etc/nixos/nixpkgs with a Git checkout.
+
# This module generates the nixos-checkout script, which performs a
+
# checkout of the Nixpkgs Git repository.
{ config, lib, pkgs, ... }:
···
mv nixpkgs nixpkgs-$backupTimestamp
fi
-
# Check out the NixOS and Nixpkgs sources.
-
git clone git://github.com/NixOS/nixpkgs.git nixpkgs
+
# Check out the Nixpkgs sources.
+
if ! [ -e nixpkgs/.git ]; then
+
echo "Creating repository in $prefix/nixpkgs..."
+
git init --quiet nixpkgs
+
else
+
echo "Updating repository in $prefix/nixpkgs..."
+
fi
+
cd nixpkgs
+
git remote add origin git://github.com/NixOS/nixpkgs.git || true
+
git remote add channels git://github.com/NixOS/nixpkgs-channels.git || true
+
git remote set-url origin --push git@github.com:NixOS/nixpkgs.git
+
git remote update
+
git checkout master
'';
};