diff --git a/installer/default.nix b/installer/default.nix
index f6f1f920574..214c5e0a164 100644
--- a/installer/default.nix
+++ b/installer/default.nix
@@ -9,12 +9,6 @@ let
isExecutable = true;
});
-
- nixosCheckout = (import ./nixos-checkout.nix) {
- inherit pkgs config makeProg;
- };
-
-
in
{
@@ -34,10 +28,7 @@ in
"cp refs $out";
};
- nixosRebuild = let inherit (nixosCheckout) repos defaultRepo;
- in makeProg {
- defaultNIXOS = (defaultRepo repos.nixos ).target;
- defaultNIXPKGS = (defaultRepo repos.nixpkgs).target;
+ nixosRebuild = makeProg {
name = "nixos-rebuild";
src = ./nixos-rebuild.sh;
};
@@ -47,8 +38,6 @@ in
src = ./nixos-gen-seccure-keys.sh;
};
- inherit (nixosCheckout) nixosCheckout;
-
nixosHardwareScan = makeProg {
name = "nixos-hardware-scan";
src = ./nixos-hardware-scan.pl;
diff --git a/installer/nixos-rebuild.sh b/installer/nixos-rebuild.sh
index 06a7a4d39fc..cd6a3569895 100644
--- a/installer/nixos-rebuild.sh
+++ b/installer/nixos-rebuild.sh
@@ -2,8 +2,8 @@
# Allow the location of NixOS sources and the system configuration
# file to be overridden.
-NIXOS=${NIXOS:-@defaultNIXOS@}
-NIXPKGS=${NIXPKGS:-@defaultNIXPKGS@}
+NIXOS=${NIXOS:-/etc/nixos/nixos}
+NIXPKGS=${NIXPKGS:-/etc/nixos/nixpkgs}
NIXOS_CONFIG=${NIXOS_CONFIG:-/etc/nixos/configuration.nix}
export NIXPKGS # must be exported so that a non default location is passed to nixos/default.nix
diff --git a/modules/config/system-path.nix b/modules/config/system-path.nix
index c5708a53062..c8f1f787993 100644
--- a/modules/config/system-path.nix
+++ b/modules/config/system-path.nix
@@ -19,7 +19,6 @@ let
config.environment.nix
nixosTools.nixosInstall
nixosTools.nixosRebuild
- nixosTools.nixosCheckout
nixosTools.nixosHardwareScan
nixosTools.nixosGenSeccureKeys
pkgs.acl
diff --git a/installer/nixos-checkout.nix b/modules/installer/nixos-checkout.nix
similarity index 52%
rename from installer/nixos-checkout.nix
rename to modules/installer/nixos-checkout.nix
index 08a7a829852..290a4d6b2eb 100644
--- a/installer/nixos-checkout.nix
+++ b/modules/installer/nixos-checkout.nix
@@ -1,8 +1,81 @@
-args : with args;
+# This module generates the nixos-checkout script, which replaces the
+# NixOS and Nixpkgs source trees in /etc/nixos/{nixos,nixpkgs} with
+# Subversion checkouts.
+
+{config, pkgs, ...}:
with pkgs.lib;
-rec {
+let
+
+ options = {
+
+ # !!! These option (and their implementation) seems
+ # over-engineering. nixos-checkout was never intended to be a
+ # generic, "check out anything that the user want to have from any
+ # version management system whatsoever", but merely a trivial
+ # convenience script to checkout the NixOS and Nixpkgs trees
+ # during or after a NixOS installation.
+ installer.repos.nixos = mkOption {
+ default = [ { type = "svn"; } ];
+ example =
+ [ { type = "svn"; url = "https://svn.nixos.org/repos/nix/nixos/branches/stdenv-updates"; target = "/etc/nixos/nixos-stdenv-updates"; }
+ { type = "git"; initialize = ''git clone git://mawercer.de/nixos $target''; update = "git pull origin"; target = "/etc/nixos/nixos-git"; }
+ ];
+ description = ''
+ The NixOS repository from which the system will be built.
+ nixos-checkout will update all working
+ copies of the given repositories,
+ nixos-rebuild will use the first item
+ which has the attribute default = true
+ falling back to the first item. The type defines the
+ repository tool added to the path. It also defines a "valid"
+ repository. If the target directory already exists and it's
+ not valid it will be moved to the backup location
+ dir-date.
+ For svn the default target and repositories are
+ /etc/nixos/nixos and
+ https://svn.nixos.org/repos/nix/nixos/trunk.
+ For git repositories update is called after initialization
+ when the repo is initialized. The initialize code is run
+ from working directory dirname
+ target and should create the
+ directory
+ dir. (git
+ clone url nixos/nixpkgs/services should do) For
+ the executables used see .
+ '';
+ };
+
+ installer.repos.nixpkgs = mkOption {
+ default = [ { type = "svn"; } ];
+ description = "same as ";
+ };
+
+ installer.repos.services = mkOption {
+ default = [ { type = "svn"; } ];
+ description = "same as ";
+ };
+
+ installer.repoTypes = mkOption {
+ default = {
+ svn = { valid = "[ -d .svn ]"; env = [ pkgs.coreutils pkgs.subversion ]; };
+ git = { valid = "[ -d .git ]"; env = [ pkgs.coreutils pkgs.git pkgs.gnused /* FIXME: use full path to sed in nix-pull */ ]; };
+ };
+ description = ''
+ Defines, for each supported version control system
+ (e.g. git), the dependencies for the
+ mechanism, as well as a test used to determine whether a
+ directory is a checkout created by that version control
+ system.
+ '';
+ };
+
+ };
+
+
+ ### implementation
+
# prepareRepoAttrs adds svn defaults and preparse the repo attribute sets so that they
# returns in any case:
# { type = git/svn;
@@ -54,9 +127,10 @@ rec {
++ list );
# creates the nixos-checkout script
- nixosCheckout =
- makeProg {
+ nixosCheckout = pkgs.substituteAll {
name = "nixos-checkout";
+ dir = "bin";
+ isExecutable = true;
src = pkgs.writeScript "nixos-checkout" (''
#! @shell@ -e
# this file is automatically generated from nixos configuration file settings (installer.repos)
@@ -85,4 +159,12 @@ rec {
( concatLists (flattenAttrs repos) )
);
};
+
+
+in
+
+{
+ require = options;
+
+ environment.extraPackages = [nixosCheckout];
}
diff --git a/modules/module-list.nix b/modules/module-list.nix
index 9d2fd9b6955..9319fd703d8 100644
--- a/modules/module-list.nix
+++ b/modules/module-list.nix
@@ -10,6 +10,7 @@
./config/unix-odbc-drivers.nix
./config/users-groups.nix
./installer/grub/grub.nix
+ ./installer/nixos-checkout.nix
./legacy.nix
./misc/assertions.nix
./programs/bash/bash.nix
diff --git a/system/nixos-installer.nix b/system/nixos-installer.nix
index b3d92e339d3..046a9343309 100644
--- a/system/nixos-installer.nix
+++ b/system/nixos-installer.nix
@@ -15,62 +15,6 @@ let
";
};
- repos = {
- nixos = mkOption {
- default = [ { type = "svn"; } ];
- example = [ { type = "svn"; url = "https://svn.nixos.org/repos/nix/nixos/branches/stdenv-updates"; target = "/etc/nixos/nixos-stdenv-updates"; }
- { type = "git"; initialize = ''git clone git://mawercer.de/nixos $target''; update = "git pull origin"; target = "/etc/nixos/nixos-git"; }
- ];
- description = ''
- The NixOS repository from which the system will be built.
- nixos-checkout will update all working
- copies of the given repositories,
- nixos-rebuild will use the first item
- which has the attribute default = true
- falling back to the first item. The type defines the
- repository tool added to the path. It also defines a "valid"
- repository. If the target directory already exists and it's
- not valid it will be moved to the backup location
- dir-date.
- For svn the default target and repositories are
- /etc/nixos/nixos and
- https://svn.nixos.org/repos/nix/nixos/trunk.
- For git repositories update is called after initialization
- when the repo is initialized. The initialize code is run
- from working directory dirname
- target and should create the
- directory
- dir. (git
- clone url nixos/nixpkgs/services should do) For
- the executables used see .
- '';
- };
-
- nixpkgs = mkOption {
- default = [ { type = "svn"; } ];
- description = "same as ";
- };
-
- services = mkOption {
- default = [ { type = "svn"; } ];
- description = "same as ";
- };
- };
-
- repoTypes = mkOption {
- default = {
- svn = { valid = "[ -d .svn ]"; env = [ pkgs.coreutils pkgs.subversion ]; };
- git = { valid = "[ -d .git ]"; env = [ pkgs.coreutils pkgs.git pkgs.gnused /* FIXME: use full path to sed in nix-pull */ ]; };
- };
- description = ''
- Defines, for each supported version control system
- (e.g. git), the dependencies for the
- mechanism, as well as a test used to determine whether a
- directory is a checkout created by that version control
- system.
- '';
- };
-
manifests = mkOption {
default = [http://nixos.org/releases/nixpkgs/channels/nixpkgs-unstable/MANIFEST];
example =