Use the binary cache in the installer
Also remove "nixos-rebuild pull".
This commit is contained in:
@@ -40,7 +40,6 @@ in
|
|||||||
|
|
||||||
# The following are used by nixos-rebuild.
|
# The following are used by nixos-rebuild.
|
||||||
nixFallback = pkgs.nixUnstable;
|
nixFallback = pkgs.nixUnstable;
|
||||||
manifests = config.installer.manifests;
|
|
||||||
|
|
||||||
tests = config.tests;
|
tests = config.tests;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,12 +25,10 @@
|
|||||||
<arg choice='plain'><option>dry-run</option></arg>
|
<arg choice='plain'><option>dry-run</option></arg>
|
||||||
<arg choice='plain'><option>build-vm</option></arg>
|
<arg choice='plain'><option>build-vm</option></arg>
|
||||||
<arg choice='plain'><option>build-vm-with-bootloader</option></arg>
|
<arg choice='plain'><option>build-vm-with-bootloader</option></arg>
|
||||||
<arg choice='plain'><option>pull</option></arg>
|
|
||||||
</group>
|
</group>
|
||||||
<sbr />
|
<sbr />
|
||||||
<arg><option>--upgrade</option></arg>
|
<arg><option>--upgrade</option></arg>
|
||||||
<arg><option>--install-grub</option></arg>
|
<arg><option>--install-grub</option></arg>
|
||||||
<arg><option>--no-pull</option></arg>
|
|
||||||
<arg><option>--no-build-nix</option></arg>
|
<arg><option>--no-build-nix</option></arg>
|
||||||
<arg><option>--fast</option></arg>
|
<arg><option>--fast</option></arg>
|
||||||
<arg><option>--rollback</option></arg>
|
<arg><option>--rollback</option></arg>
|
||||||
@@ -170,17 +168,6 @@ $ ./result/bin/run-*-vm
|
|||||||
partition, which is mounted read-only in the VM.</para>
|
partition, which is mounted read-only in the VM.</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
|
||||||
<term><option>pull</option></term>
|
|
||||||
<listitem>
|
|
||||||
<para>This operation fetches the latest manifest in the Nixpkgs
|
|
||||||
channel to speed up subsequent <command>nix-env</command>
|
|
||||||
operations. This is useful if you are not using
|
|
||||||
<command>nix-channel</command> but still want to use pre-built
|
|
||||||
binary packages. It doesn’t reconfigure the system</para>
|
|
||||||
</listitem>
|
|
||||||
</varlistentry>
|
|
||||||
|
|
||||||
</variablelist>
|
</variablelist>
|
||||||
|
|
||||||
|
|||||||
@@ -42,8 +42,6 @@ in
|
|||||||
|
|
||||||
isoImage.volumeID = "NIXOS_${config.system.nixosVersion}";
|
isoImage.volumeID = "NIXOS_${config.system.nixosVersion}";
|
||||||
|
|
||||||
installer.nixosURL = "http://nixos.org/releases/nixos/nixos-${config.system.nixosVersion}";
|
|
||||||
|
|
||||||
boot.postBootCommands =
|
boot.postBootCommands =
|
||||||
''
|
''
|
||||||
# Provide the NixOS/Nixpkgs sources in /etc/nixos. This is required
|
# Provide the NixOS/Nixpkgs sources in /etc/nixos. This is required
|
||||||
|
|||||||
@@ -5,7 +5,6 @@
|
|||||||
# - copy closure of Nix to target device
|
# - copy closure of Nix to target device
|
||||||
# - register validity
|
# - register validity
|
||||||
# - with a chroot to the target device:
|
# - with a chroot to the target device:
|
||||||
# * do a nix-pull
|
|
||||||
# * nix-env -p /nix/var/nix/profiles/system -i <nix-expr for the configuration>
|
# * nix-env -p /nix/var/nix/profiles/system -i <nix-expr for the configuration>
|
||||||
# * run the activation script of the configuration (also installs Grub)
|
# * run the activation script of the configuration (also installs Grub)
|
||||||
|
|
||||||
@@ -36,13 +35,6 @@ if ! test -e "$NIXOS_CONFIG"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Do a nix-pull to speed up building.
|
|
||||||
if test -n "@nixosURL@" -a ${NIXOS_PULL:-1} != 0; then
|
|
||||||
mkdir -p /nix/var/nix/channel-cache -m 0755
|
|
||||||
NIX_DOWNLOAD_CACHE=/nix/var/nix/channel-cache \
|
|
||||||
@nix@/bin/nix-pull @nixosURL@/MANIFEST || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Mount some stuff in the target root directory. We bind-mount /etc
|
# Mount some stuff in the target root directory. We bind-mount /etc
|
||||||
# into the chroot because we need networking and the nixbld user
|
# into the chroot because we need networking and the nixbld user
|
||||||
@@ -107,6 +99,7 @@ export LC_TIME=
|
|||||||
# Create a temporary Nix config file that causes the nixbld users to
|
# Create a temporary Nix config file that causes the nixbld users to
|
||||||
# be used.
|
# be used.
|
||||||
echo "build-users-group = nixbld" > $mountPoint/tmp/nix.conf
|
echo "build-users-group = nixbld" > $mountPoint/tmp/nix.conf
|
||||||
|
grep binary-caches /etc/nix/nix.conf >> $mountPoint/tmp/nix.conf
|
||||||
export NIX_CONF_DIR=/tmp
|
export NIX_CONF_DIR=/tmp
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -18,14 +18,11 @@ The operation is one of the following:
|
|||||||
build-vm-with-bootloader:
|
build-vm-with-bootloader:
|
||||||
like build-vm, but include a boot loader in the VM
|
like build-vm, but include a boot loader in the VM
|
||||||
dry-run: just show what store paths would be built/downloaded
|
dry-run: just show what store paths would be built/downloaded
|
||||||
pull: just pull the NixOS channel manifest and exit
|
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
|
|
||||||
--upgrade fetch the latest version of NixOS before rebuilding
|
--upgrade fetch the latest version of NixOS before rebuilding
|
||||||
--install-grub (re-)install the Grub bootloader
|
--install-grub (re-)install the Grub bootloader
|
||||||
--pull do a nix-pull to get the latest NixOS channel
|
|
||||||
manifest
|
|
||||||
--no-build-nix don't build the latest Nix from Nixpkgs before
|
--no-build-nix don't build the latest Nix from Nixpkgs before
|
||||||
building NixOS
|
building NixOS
|
||||||
--rollback restore the previous NixOS configuration (only
|
--rollback restore the previous NixOS configuration (only
|
||||||
@@ -49,7 +46,6 @@ EOF
|
|||||||
# Parse the command line.
|
# Parse the command line.
|
||||||
extraBuildFlags=
|
extraBuildFlags=
|
||||||
action=
|
action=
|
||||||
pullManifest=
|
|
||||||
buildNix=1
|
buildNix=1
|
||||||
rollback=
|
rollback=
|
||||||
upgrade=
|
upgrade=
|
||||||
@@ -60,15 +56,12 @@ while test "$#" -gt 0; do
|
|||||||
--help)
|
--help)
|
||||||
showSyntax
|
showSyntax
|
||||||
;;
|
;;
|
||||||
switch|boot|test|build|dry-run|build-vm|build-vm-with-bootloader|pull)
|
switch|boot|test|build|dry-run|build-vm|build-vm-with-bootloader)
|
||||||
action="$i"
|
action="$i"
|
||||||
;;
|
;;
|
||||||
--install-grub)
|
--install-grub)
|
||||||
export NIXOS_INSTALL_GRUB=1
|
export NIXOS_INSTALL_GRUB=1
|
||||||
;;
|
;;
|
||||||
--pull)
|
|
||||||
pullManifest=1
|
|
||||||
;;
|
|
||||||
--no-build-nix)
|
--no-build-nix)
|
||||||
buildNix=
|
buildNix=
|
||||||
;;
|
;;
|
||||||
@@ -127,24 +120,6 @@ if initctl status nix-daemon 2>&1 | grep -q 'running'; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# Pull the manifests defined in the configuration (the "manifests"
|
|
||||||
# attribute). Wonderfully hacky.
|
|
||||||
if [ -n "$pullManifest" -o "$action" = pull ]; then
|
|
||||||
set -o pipefail
|
|
||||||
manifests=$(nix-instantiate --eval-only --xml --strict '<nixos>' -A manifests \
|
|
||||||
| grep '<string' | sed 's^.*"\(.*\)".*^\1^g')
|
|
||||||
set +o pipefail
|
|
||||||
if [ $? -ne 0 ]; then exit 1; fi
|
|
||||||
|
|
||||||
mkdir -p /nix/var/nix/channel-cache
|
|
||||||
for i in $manifests; do
|
|
||||||
NIX_DOWNLOAD_CACHE=/nix/var/nix/channel-cache nix-pull $i || true
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$action" = pull ]; then exit 0; fi
|
|
||||||
|
|
||||||
|
|
||||||
# If ‘--upgrade’ is given, run ‘nix-channel --update nixos’.
|
# If ‘--upgrade’ is given, run ‘nix-channel --update nixos’.
|
||||||
if [ -n "$upgrade" ]; then
|
if [ -n "$upgrade" ]; then
|
||||||
nix-channel --update nixos
|
nix-channel --update nixos
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
# This module generates nixos-install, nixos-rebuild,
|
# This module generates nixos-install, nixos-rebuild,
|
||||||
# nixos-hardware-scan, etc.
|
# nixos-hardware-scan, etc.
|
||||||
|
|
||||||
{config, pkgs, modulesPath, ...}:
|
{ config, pkgs, modulesPath, ... }:
|
||||||
|
|
||||||
let
|
let
|
||||||
### implementation
|
### implementation
|
||||||
@@ -23,7 +23,6 @@ let
|
|||||||
|
|
||||||
inherit (pkgs) perl pathsFromGraph;
|
inherit (pkgs) perl pathsFromGraph;
|
||||||
nix = config.environment.nix;
|
nix = config.environment.nix;
|
||||||
nixosURL = cfg.nixosURL;
|
|
||||||
|
|
||||||
nixClosure = pkgs.runCommand "closure"
|
nixClosure = pkgs.runCommand "closure"
|
||||||
{ exportReferencesGraph = ["refs" config.environment.nix]; }
|
{ exportReferencesGraph = ["refs" config.environment.nix]; }
|
||||||
@@ -84,27 +83,6 @@ in
|
|||||||
{
|
{
|
||||||
options = {
|
options = {
|
||||||
|
|
||||||
installer.nixosURL = pkgs.lib.mkOption {
|
|
||||||
default = http://nixos.org/releases/nixos/channels/nixos-unstable;
|
|
||||||
example = http://nixos.org/releases/nixos/nixos-0.1pre1234;
|
|
||||||
description = ''
|
|
||||||
URL of the Nixpkgs distribution to use when building the
|
|
||||||
installation CD.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
installer.manifests = pkgs.lib.mkOption {
|
|
||||||
default = [ http://nixos.org/releases/nixos/channels/nixos-unstable/MANIFEST ];
|
|
||||||
example =
|
|
||||||
[ http://nixos.org/releases/nixpkgs/channels/nixpkgs-unstable/MANIFEST
|
|
||||||
http://nixos.org/releases/nixos/channels/nixos-stable/MANIFEST
|
|
||||||
];
|
|
||||||
description = ''
|
|
||||||
URLs of manifests to be downloaded when you run
|
|
||||||
<command>nixos-rebuild</command> to speed up builds.
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
installer.enableGraphicalTools = pkgs.lib.mkOption {
|
installer.enableGraphicalTools = pkgs.lib.mkOption {
|
||||||
default = false;
|
default = false;
|
||||||
type = with pkgs.lib.types; bool;
|
type = with pkgs.lib.types; bool;
|
||||||
|
|||||||
+1
-2
@@ -79,7 +79,7 @@ let
|
|||||||
{ services.httpd.enable = true;
|
{ services.httpd.enable = true;
|
||||||
services.httpd.adminAddr = "foo@example.org";
|
services.httpd.adminAddr = "foo@example.org";
|
||||||
services.httpd.servedDirs = singleton
|
services.httpd.servedDirs = singleton
|
||||||
{ urlPath = "/releases/nixos/channels/nixos-unstable";
|
{ urlPath = "/binary-cache";
|
||||||
dir = "/tmp/channel";
|
dir = "/tmp/channel";
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -129,7 +129,6 @@ let
|
|||||||
"rm /etc/hosts",
|
"rm /etc/hosts",
|
||||||
"echo 192.168.1.1 nixos.org > /etc/hosts",
|
"echo 192.168.1.1 nixos.org > /etc/hosts",
|
||||||
"ifconfig eth1 up 192.168.1.2",
|
"ifconfig eth1 up 192.168.1.2",
|
||||||
"nixos-rebuild pull",
|
|
||||||
);
|
);
|
||||||
|
|
||||||
# Test nix-env.
|
# Test nix-env.
|
||||||
|
|||||||
Reference in New Issue
Block a user