summary refs log tree commit diff
path: root/nixos/modules/installer
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2015-05-20 13:51:57 +0200
committerEelco Dolstra <eelco.dolstra@logicblox.com>2015-05-20 14:16:36 +0200
commite98da673e4d2f7e45dff25c280ea7c29915fb0eb (patch)
treea5a4c8bd265916421eb90881760678de5e306964 /nixos/modules/installer
parentfedfcdedae0567495118e999de74feccade19619 (diff)
downloadnixlib-e98da673e4d2f7e45dff25c280ea7c29915fb0eb.tar
nixlib-e98da673e4d2f7e45dff25c280ea7c29915fb0eb.tar.gz
nixlib-e98da673e4d2f7e45dff25c280ea7c29915fb0eb.tar.bz2
nixlib-e98da673e4d2f7e45dff25c280ea7c29915fb0eb.tar.lz
nixlib-e98da673e4d2f7e45dff25c280ea7c29915fb0eb.tar.xz
nixlib-e98da673e4d2f7e45dff25c280ea7c29915fb0eb.tar.zst
nixlib-e98da673e4d2f7e45dff25c280ea7c29915fb0eb.zip
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.
Diffstat (limited to 'nixos/modules/installer')
-rw-r--r--nixos/modules/installer/tools/nixos-checkout.nix19
1 files changed, 15 insertions, 4 deletions
diff --git a/nixos/modules/installer/tools/nixos-checkout.nix b/nixos/modules/installer/tools/nixos-checkout.nix
index 3338e5119acb..9cdd8a74a188 100644
--- a/nixos/modules/installer/tools/nixos-checkout.nix
+++ b/nixos/modules/installer/tools/nixos-checkout.nix
@@ -1,5 +1,5 @@
-# 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, ... }:
 
@@ -37,8 +37,19 @@ let
             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
       '';
    };