mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-13 05:05:29 +03:00
* Move nixos-checkout into its own module.
svn path=/nixos/branches/modular-nixos/; revision=15787
This commit is contained in:
parent
19e0f46b0e
commit
df96e5c456
6 changed files with 90 additions and 75 deletions
|
@ -9,12 +9,6 @@ let
|
||||||
isExecutable = true;
|
isExecutable = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
nixosCheckout = (import ./nixos-checkout.nix) {
|
|
||||||
inherit pkgs config makeProg;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
in
|
in
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -34,10 +28,7 @@ in
|
||||||
"cp refs $out";
|
"cp refs $out";
|
||||||
};
|
};
|
||||||
|
|
||||||
nixosRebuild = let inherit (nixosCheckout) repos defaultRepo;
|
nixosRebuild = makeProg {
|
||||||
in makeProg {
|
|
||||||
defaultNIXOS = (defaultRepo repos.nixos ).target;
|
|
||||||
defaultNIXPKGS = (defaultRepo repos.nixpkgs).target;
|
|
||||||
name = "nixos-rebuild";
|
name = "nixos-rebuild";
|
||||||
src = ./nixos-rebuild.sh;
|
src = ./nixos-rebuild.sh;
|
||||||
};
|
};
|
||||||
|
@ -47,8 +38,6 @@ in
|
||||||
src = ./nixos-gen-seccure-keys.sh;
|
src = ./nixos-gen-seccure-keys.sh;
|
||||||
};
|
};
|
||||||
|
|
||||||
inherit (nixosCheckout) nixosCheckout;
|
|
||||||
|
|
||||||
nixosHardwareScan = makeProg {
|
nixosHardwareScan = makeProg {
|
||||||
name = "nixos-hardware-scan";
|
name = "nixos-hardware-scan";
|
||||||
src = ./nixos-hardware-scan.pl;
|
src = ./nixos-hardware-scan.pl;
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
|
|
||||||
# Allow the location of NixOS sources and the system configuration
|
# Allow the location of NixOS sources and the system configuration
|
||||||
# file to be overridden.
|
# file to be overridden.
|
||||||
NIXOS=${NIXOS:-@defaultNIXOS@}
|
NIXOS=${NIXOS:-/etc/nixos/nixos}
|
||||||
NIXPKGS=${NIXPKGS:-@defaultNIXPKGS@}
|
NIXPKGS=${NIXPKGS:-/etc/nixos/nixpkgs}
|
||||||
NIXOS_CONFIG=${NIXOS_CONFIG:-/etc/nixos/configuration.nix}
|
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
|
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
|
config.environment.nix
|
||||||
nixosTools.nixosInstall
|
nixosTools.nixosInstall
|
||||||
nixosTools.nixosRebuild
|
nixosTools.nixosRebuild
|
||||||
nixosTools.nixosCheckout
|
|
||||||
nixosTools.nixosHardwareScan
|
nixosTools.nixosHardwareScan
|
||||||
nixosTools.nixosGenSeccureKeys
|
nixosTools.nixosGenSeccureKeys
|
||||||
pkgs.acl
|
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;
|
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
|
# prepareRepoAttrs adds svn defaults and preparse the repo attribute sets so that they
|
||||||
# returns in any case:
|
# returns in any case:
|
||||||
# { type = git/svn;
|
# { type = git/svn;
|
||||||
|
@ -54,9 +127,10 @@ rec {
|
||||||
++ list );
|
++ list );
|
||||||
|
|
||||||
# creates the nixos-checkout script
|
# creates the nixos-checkout script
|
||||||
nixosCheckout =
|
nixosCheckout = pkgs.substituteAll {
|
||||||
makeProg {
|
|
||||||
name = "nixos-checkout";
|
name = "nixos-checkout";
|
||||||
|
dir = "bin";
|
||||||
|
isExecutable = true;
|
||||||
src = pkgs.writeScript "nixos-checkout" (''
|
src = pkgs.writeScript "nixos-checkout" (''
|
||||||
#! @shell@ -e
|
#! @shell@ -e
|
||||||
# this file is automatically generated from nixos configuration file settings (installer.repos)
|
# this file is automatically generated from nixos configuration file settings (installer.repos)
|
||||||
|
@ -85,4 +159,12 @@ rec {
|
||||||
( concatLists (flattenAttrs repos) )
|
( concatLists (flattenAttrs repos) )
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
{
|
||||||
|
require = options;
|
||||||
|
|
||||||
|
environment.extraPackages = [nixosCheckout];
|
||||||
}
|
}
|
|
@ -10,6 +10,7 @@
|
||||||
./config/unix-odbc-drivers.nix
|
./config/unix-odbc-drivers.nix
|
||||||
./config/users-groups.nix
|
./config/users-groups.nix
|
||||||
./installer/grub/grub.nix
|
./installer/grub/grub.nix
|
||||||
|
./installer/nixos-checkout.nix
|
||||||
./legacy.nix
|
./legacy.nix
|
||||||
./misc/assertions.nix
|
./misc/assertions.nix
|
||||||
./programs/bash/bash.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 {
|
manifests = mkOption {
|
||||||
default = [http://nixos.org/releases/nixpkgs/channels/nixpkgs-unstable/MANIFEST];
|
default = [http://nixos.org/releases/nixpkgs/channels/nixpkgs-unstable/MANIFEST];
|
||||||
example =
|
example =
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue