* Move nixos-checkout into its own module.
svn path=/nixos/branches/modular-nixos/; revision=15787
This commit is contained in:
parent
19e0f46b0e
commit
df96e5c456
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -19,7 +19,6 @@ let
|
||||
config.environment.nix
|
||||
nixosTools.nixosInstall
|
||||
nixosTools.nixosRebuild
|
||||
nixosTools.nixosCheckout
|
||||
nixosTools.nixosHardwareScan
|
||||
nixosTools.nixosGenSeccureKeys
|
||||
pkgs.acl
|
||||
|
@ -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.
|
||||
<command>nixos-checkout</command> will update all working
|
||||
copies of the given repositories,
|
||||
<command>nixos-rebuild</command> will use the first item
|
||||
which has the attribute <literal>default = true</literal>
|
||||
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
|
||||
<filename><replaceable>dir</replaceable>-date</filename>.
|
||||
For svn the default target and repositories are
|
||||
<filename>/etc/nixos/nixos</filename> and
|
||||
<filename>https://svn.nixos.org/repos/nix/nixos/trunk</filename>.
|
||||
For git repositories update is called after initialization
|
||||
when the repo is initialized. The initialize code is run
|
||||
from working directory dirname
|
||||
<replaceable>target</replaceable> and should create the
|
||||
directory
|
||||
<filename><replaceable>dir</replaceable></filename>. (<command>git
|
||||
clone url nixos/nixpkgs/services</command> should do) For
|
||||
the executables used see <option>repoTypes</option>.
|
||||
'';
|
||||
};
|
||||
|
||||
installer.repos.nixpkgs = mkOption {
|
||||
default = [ { type = "svn"; } ];
|
||||
description = "same as <option>repos.nixos</option>";
|
||||
};
|
||||
|
||||
installer.repos.services = mkOption {
|
||||
default = [ { type = "svn"; } ];
|
||||
description = "same as <option>repos.nixos</option>";
|
||||
};
|
||||
|
||||
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. <literal>git</literal>), 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];
|
||||
}
|
@ -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
|
||||
|
@ -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.
|
||||
<command>nixos-checkout</command> will update all working
|
||||
copies of the given repositories,
|
||||
<command>nixos-rebuild</command> will use the first item
|
||||
which has the attribute <literal>default = true</literal>
|
||||
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
|
||||
<filename><replaceable>dir</replaceable>-date</filename>.
|
||||
For svn the default target and repositories are
|
||||
<filename>/etc/nixos/nixos</filename> and
|
||||
<filename>https://svn.nixos.org/repos/nix/nixos/trunk</filename>.
|
||||
For git repositories update is called after initialization
|
||||
when the repo is initialized. The initialize code is run
|
||||
from working directory dirname
|
||||
<replaceable>target</replaceable> and should create the
|
||||
directory
|
||||
<filename><replaceable>dir</replaceable></filename>. (<command>git
|
||||
clone url nixos/nixpkgs/services</command> should do) For
|
||||
the executables used see <option>repoTypes</option>.
|
||||
'';
|
||||
};
|
||||
|
||||
nixpkgs = mkOption {
|
||||
default = [ { type = "svn"; } ];
|
||||
description = "same as <option>repos.nixos</option>";
|
||||
};
|
||||
|
||||
services = mkOption {
|
||||
default = [ { type = "svn"; } ];
|
||||
description = "same as <option>repos.nixos</option>";
|
||||
};
|
||||
};
|
||||
|
||||
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. <literal>git</literal>), 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 =
|
||||
|
Loading…
Reference in New Issue
Block a user