Reverting revisions 30103-30106: "always set nixpkgs.config.{state,store}Dir", etc.

After the change from revision 30103, nixos-rebuild suddenly consumed
freaky amounts of memory. I had to abort the process after it had
allocated well in excess of 30GB(!) of RAM. I'm not sure what is causing
this behavior, but undoing that assignment fixes the problem. The other
two commits needed to be revoked, too, because they depend on 30103.

svn path=/nixos/trunk/; revision=30127
This commit is contained in:
Peter Simons 2011-10-30 15:19:58 +00:00
parent fe045dc949
commit 20b364f4de
25 changed files with 77 additions and 80 deletions

View File

@ -50,8 +50,8 @@ let
"~/.nix-profile/lib/X11/fonts"
"~/.nix-profile/share/fonts"
# - the default profile
"${config.nixpkgs.config.nix.stateDir}/nix/profiles/default/lib/X11/fonts"
"${config.nixpkgs.config.nix.stateDir}/nix/profiles/default/share/fonts"
"/nix/var/nix/profiles/default/lib/X11/fonts"
"/nix/var/nix/profiles/default/share/fonts"
];
description = "
List of primary font paths.

View File

@ -69,7 +69,7 @@ let
automatically updated every time you rebuild the system
configuration. (The latter is the main difference with
installing them in the default profile,
<filename>${config.nixpkgs.config.nix.stateDir}/nix/profiles/default</filename>.
<filename>/nix/var/nix/profiles/default</filename>.
'';
};

View File

@ -143,7 +143,7 @@ in
[ { mountPoint = "/";
device = "/dev/root";
}
{ mountPoint = "${config.nixpkgs.config.nix.storeDir}";
{ mountPoint = "/nix/store";
fsType = "squashfs";
device = "/nix-store.squashfs";
options = "loop";
@ -169,7 +169,7 @@ in
boot.initrd.kernelModules = [ "loop" ];
# In stage 1, mount a tmpfs on top of / (the ISO image) and
# ${config.nixpkgs.config.nix.storeDir} (the squashfs image) to make this a live CD.
# /nix/store (the squashfs image) to make this a live CD.
boot.initrd.postMountCommands =
''
mkdir /mnt-root-tmpfs
@ -180,8 +180,8 @@ in
mkdir /mnt-store-tmpfs
mount -t tmpfs -o "mode=755" none /mnt-store-tmpfs
mkdir -p $targetRoot${config.nixpkgs.config.nix.storeDir}
mount -t aufs -o dirs=/mnt-store-tmpfs=rw:/mnt-root${config.nixpkgs.config.nix.storeDir}=ro none /mnt-root-union${config.nixpkgs.config.nix.storeDir}
mkdir -p $targetRoot/nix/store
mount -t aufs -o dirs=/mnt-store-tmpfs=rw:/mnt-root/nix/store=ro none /mnt-root-union/nix/store
'';
# Closures to be copied to the Nix store on the CD, namely the init
@ -223,7 +223,7 @@ in
}
{ # Quick hack: need a mount point for the store.
source = pkgs.runCommand "empty" {} "ensureDir $out";
target = "${config.nixpkgs.config.nix.storeDir}";
target = "/nix/store";
}
];
@ -257,11 +257,11 @@ in
''
# After booting, register the contents of the Nix store on the
# CD in the Nix database in the tmpfs.
${config.environment.nix}/bin/nix-store --load-db < ${config.nixpkgs.config.nix.storeDir}/nix-path-registration
${config.environment.nix}/bin/nix-store --load-db < /nix/store/nix-path-registration
# nixos-rebuild also requires a "system" profile and an
# /etc/NIXOS tag.
touch /etc/NIXOS
${config.environment.nix}/bin/nix-env -p ${config.nixpkgs.config.nix.stateDir}/nix/profiles/system --set /var/run/current-system
${config.environment.nix}/bin/nix-env -p /nix/var/nix/profiles/system --set /var/run/current-system
'';
}

View File

@ -87,6 +87,6 @@ in
# nixos-rebuild also requires a "system" profile and an
# /etc/NIXOS tag.
touch /etc/NIXOS
${config.environment.nix}/bin/nix-env -p ${config.nixpkgs.config.nix.stateDir}/nix/profiles/system --set /var/run/current-system
${config.environment.nix}/bin/nix-env -p /nix/var/nix/profiles/system --set /var/run/current-system
'';
}

View File

@ -31,7 +31,7 @@ let
default = false;
description = "
Whether copy the necessary boot files into /boot, so
${config.nixpkgs.config.nix.storeDir} is not needed by the boot loadear.
/nix/store is not needed by the boot loadear.
";
};
};

View File

@ -22,8 +22,8 @@ let
''
if [ "$rollback" != "$succeeded" ]
then
ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} nix-env -p ${config.nixpkgs.config.nix.stateDir}/nix/profiles/system --rollback
ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} ${config.nixpkgs.config.nix.stateDir}/nix/profiles/system/bin/switch-to-configuration switch
ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} nix-env -p /nix/var/nix/profiles/system --rollback
ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} /nix/var/nix/profiles/system/bin/switch-to-configuration switch
rollback=$((rollback + 1))
fi
@ -50,12 +50,12 @@ let
in
''
echo "=== activating system configuration on ${getAttr targetProperty (config.deployment)} ==="
ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} nix-env -p ${config.nixpkgs.config.nix.stateDir}/nix/profiles/system --set ${config.system.build.toplevel} ||
(ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} nix-env -p ${config.nixpkgs.config.nix.stateDir}/nix/profiles/system --rollback; rollbackSucceeded)
ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} nix-env -p /nix/var/nix/profiles/system --set ${config.system.build.toplevel} ||
(ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} nix-env -p /nix/var/nix/profiles/system --rollback; rollbackSucceeded)
ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} ${config.nixpkgs.config.nix.stateDir}/nix/profiles/system/bin/switch-to-configuration switch ||
( ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} nix-env -p ${config.nixpkgs.config.nix.stateDir}/nix/profiles/system --rollback
ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} ${config.nixpkgs.config.nix.stateDir}/nix/profiles/system/bin/switch-to-configuration switch
ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} /nix/var/nix/profiles/system/bin/switch-to-configuration switch ||
( ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} nix-env -p /nix/var/nix/profiles/system --rollback
ssh $NIX_SSHOPTS ${getAttr targetProperty (config.deployment)} /nix/var/nix/profiles/system/bin/switch-to-configuration switch
rollbackSucceeded
)

View File

@ -6,7 +6,7 @@
# - register validity
# - with a chroot to the target device:
# * do a nix-pull
# * nix-env -p @stateDir@/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)
set -e
@ -92,16 +92,16 @@ mkdir -m 0755 -p $mountPoint/var
# Create the necessary Nix directories on the target device, if they
# don't already exist.
mkdir -m 0755 -p \
$mountPoint@stateDir@/nix/gcroots \
$mountPoint@stateDir@/nix/temproots \
$mountPoint@stateDir@/nix/manifests \
$mountPoint@stateDir@/nix/userpool \
$mountPoint@stateDir@/nix/profiles \
$mountPoint@stateDir@/nix/db \
$mountPoint@stateDir@/log/nix/drvs
$mountPoint/nix/var/nix/gcroots \
$mountPoint/nix/var/nix/temproots \
$mountPoint/nix/var/nix/manifests \
$mountPoint/nix/var/nix/userpool \
$mountPoint/nix/var/nix/profiles \
$mountPoint/nix/var/nix/db \
$mountPoint/nix/var/log/nix/drvs
mkdir -m 1777 -p \
$mountPoint@storeDir@ \
$mountPoint/nix/store \
# Get the store paths to copy from the references graph.
@ -112,7 +112,7 @@ storePaths=$(@perl@/bin/perl @pathsFromGraph@ @nixClosure@)
echo "copying Nix to $mountPoint...."
for i in $storePaths; do
echo " $i"
rsync -a $i $mountPoint@storeDir@/
rsync -a $i $mountPoint/nix/store/
done
@ -154,7 +154,7 @@ fi
# it into the system configuration profile.
echo "building the system configuration..."
NIXPKGS=/mnt/etc/nixos/nixpkgs chroot $mountPoint @nix@/bin/nix-env \
-p @stateDir@/nix/profiles/system \
-p /nix/var/nix/profiles/system \
-f "/mnt$NIXOS" \
--set -A system
@ -196,4 +196,4 @@ touch $mountPoint/etc/NIXOS
# configuration.
echo "finalising the installation..."
NIXOS_INSTALL_GRUB=1 chroot $mountPoint \
@stateDir@/nix/profiles/system/bin/switch-to-configuration boot
/nix/var/nix/profiles/system/bin/switch-to-configuration boot

View File

@ -133,9 +133,9 @@ if test -n "$pullManifest"; then
manifests=$(nix-instantiate --eval-only --xml --strict $NIXOS -A manifests \
| grep '<string' | sed 's^.*"\(.*\)".*^\1^g')
mkdir -p @stateDir@/nix/channel-cache
mkdir -p /nix/var/nix/channel-cache
for i in $manifests; do
NIX_DOWNLOAD_CACHE=@stateDir@/nix/channel-cache nix-pull $i || true
NIX_DOWNLOAD_CACHE=/nix/var/nix/channel-cache nix-pull $i || true
done
fi
@ -162,8 +162,8 @@ fi
if test -z "$rollback"; then
echo "building the system configuration..." >&2
if test "$action" = switch -o "$action" = boot; then
nix-env -p @stateDir@/nix/profiles/system -f $NIXOS --set -A system $extraBuildFlags
pathToConfig=@stateDir@/nix/profiles/system
nix-env -p /nix/var/nix/profiles/system -f $NIXOS --set -A system $extraBuildFlags
pathToConfig=/nix/var/nix/profiles/system
elif test "$action" = test -o "$action" = build -o "$action" = dry-run; then
nix-build $NIXOS -A system -K -k $extraBuildFlags > /dev/null
pathToConfig=./result
@ -178,14 +178,14 @@ if test -z "$rollback"; then
fi
else # test -n "$rollback"
if test "$action" = switch -o "$action" = boot; then
nix-env --rollback -p @stateDir@/nix/profiles/system
pathToConfig=@stateDir@/nix/profiles/system
nix-env --rollback -p /nix/var/nix/profiles/system
pathToConfig=/nix/var/nix/profiles/system
elif test "$action" = test -o "$action" = build; then
systemNumber=$(
nix-env -p @stateDir@/nix/profiles/system --list-generations |
nix-env -p /nix/var/nix/profiles/system --list-generations |
sed -n '/current/ {g; p;}; s/ *\([0-9]*\).*/\1/; h'
)
ln -sT @stateDir@/nix/profiles/system-${systemNumber}-link ./result
ln -sT /nix/var/nix/profiles/system-${systemNumber}-link ./result
pathToConfig=./result
else
showSyntax

View File

@ -10,7 +10,6 @@ let
makeProg = args: pkgs.substituteAll (args // {
dir = "bin";
isExecutable = true;
inherit (config.nixpkgs.config.nix) storeDir stateDir;
});
nixosBuildVMS = makeProg {

View File

@ -70,6 +70,4 @@ in
};
};
config.nixpkgs.config.nix = { storeDir = /nix/store; stateDir = /nix/var; };
}

View File

@ -100,7 +100,7 @@ in
if test -z "$source"; then
# If we can't find the program, fall back to the
# system profile.
source=${config.nixpkgs.config.nix.stateDir}/nix/profiles/default/bin/${program}
source=/nix/var/nix/profiles/default/bin/${program}
fi
cp ${setuidWrapper}/bin/setuid-wrapper ${wrapperDir}/${program}

View File

@ -308,26 +308,26 @@ in
# Set up Nix.
mkdir -p /nix/etc/nix
ln -sfn /etc/nix.conf /nix/etc/nix/nix.conf
chown root.nixbld ${config.nixpkgs.config.nix.storeDir}
chmod 1775 ${config.nixpkgs.config.nix.storeDir}
chown root.nixbld /nix/store
chmod 1775 /nix/store
# Nix initialisation.
mkdir -m 0755 -p \
${config.nixpkgs.config.nix.stateDir}/nix/gcroots \
${config.nixpkgs.config.nix.stateDir}/nix/temproots \
${config.nixpkgs.config.nix.stateDir}/nix/manifests \
${config.nixpkgs.config.nix.stateDir}/nix/userpool \
${config.nixpkgs.config.nix.stateDir}/nix/profiles \
${config.nixpkgs.config.nix.stateDir}/nix/db \
${config.nixpkgs.config.nix.stateDir}/log/nix/drvs \
${config.nixpkgs.config.nix.stateDir}/nix/channel-cache \
${config.nixpkgs.config.nix.stateDir}/nix/chroots
mkdir -m 1777 -p ${config.nixpkgs.config.nix.stateDir}/nix/gcroots/per-user
mkdir -m 1777 -p ${config.nixpkgs.config.nix.stateDir}/nix/profiles/per-user
mkdir -m 1777 -p ${config.nixpkgs.config.nix.stateDir}/nix/gcroots/tmp
/nix/var/nix/gcroots \
/nix/var/nix/temproots \
/nix/var/nix/manifests \
/nix/var/nix/userpool \
/nix/var/nix/profiles \
/nix/var/nix/db \
/nix/var/log/nix/drvs \
/nix/var/nix/channel-cache \
/nix/var/nix/chroots
mkdir -m 1777 -p /nix/var/nix/gcroots/per-user
mkdir -m 1777 -p /nix/var/nix/profiles/per-user
mkdir -m 1777 -p /nix/var/nix/gcroots/tmp
ln -sf ${config.nixpkgs.config.nix.stateDir}/nix/profiles ${config.nixpkgs.config.nix.stateDir}/nix/gcroots/
ln -sf ${config.nixpkgs.config.nix.stateDir}/nix/manifests ${config.nixpkgs.config.nix.stateDir}/nix/gcroots/
ln -sf /nix/var/nix/profiles /nix/var/nix/gcroots/
ln -sf /nix/var/nix/manifests /nix/var/nix/gcroots/
'';
};

View File

@ -13,7 +13,7 @@ let
{
options = {
# This can be infered from the UPS model by looking at
# ${config.nixpkgs.config.nix.storeDir}/nut/share/driver.list
# /nix/store/nut/share/driver.list
driver = mkOption {
type = types.uniq types.string;
description = ''

View File

@ -133,7 +133,7 @@ in
Additionally you can specify the up/ down scripts by setting
the up down properties.
Config lines up=${config.nixpkgs.config.nix.storeDir}/xxx-up-script down=...
Config lines up=/nix/store/xxx-up-script down=...
will be appended to your configuration file automatically
If you define at least one of up/down "script-security 2" will be

View File

@ -78,7 +78,7 @@ in
If non-null, override the default login shell with the
specified value.
'';
example = "${config.nixpkgs.config.nix.storeDir}/xyz-bash-10.0/bin/bash10";
example = "/nix/store/xyz-bash-10.0/bin/bash10";
};
srpKeyExchange = mkOption {

View File

@ -155,7 +155,7 @@ in
};
services.dbus.packages =
[ "${config.nixpkgs.config.nix.stateDir}/nix/profiles/default"
[ "/nix/var/nix/profiles/default"
config.system.path
];

View File

@ -339,7 +339,7 @@ let
# But do allow access to files in the store so that we don't have
# to generate <Directory> clauses for every generated file that we
# want to serve.
<Directory ${config.nixpkgs.config.nix.storeDir}>
<Directory /nix/store>
Order allow,deny
Allow from all
</Directory>

View File

@ -45,11 +45,11 @@ in
deployDir = mkOption {
description = "Location of the deployment files";
default = "${config.nixpkgs.config.nix.stateDir}/nix/profiles/default/server/default/deploy/";
default = "/nix/var/nix/profiles/default/server/default/deploy/";
};
libUrl = mkOption {
default = "file://${config.nixpkgs.config.nix.stateDir}/nix/profiles/default/server/default/lib";
default = "file:///nix/var/nix/profiles/default/server/default/lib";
description = "Location where the shared library JARs are stored";
};

View File

@ -76,7 +76,7 @@ in
ln -sfn "$(readlink -f "$systemConfig")" /var/run/current-system
# Prevent the current configuration from being garbage-collected.
ln -sfn /var/run/current-system ${config.nixpkgs.config.nix.stateDir}/nix/gcroots/current-system
ln -sfn /var/run/current-system /nix/var/nix/gcroots/current-system
'';
};

View File

@ -217,7 +217,7 @@ let
# The initrd only has to mount / or any FS marked as necessary for
# booting (such as the FS containing ${config.nixpkgs.config.nix.storeDir}, or an FS needed for
# booting (such as the FS containing /nix/store, or an FS needed for
# mounting /, like / on a loopback).
fileSystems = filter
(fs: fs.mountPoint == "/" || fs.neededForBoot)

View File

@ -10,7 +10,7 @@ let
environment.etc = mkOption {
default = [];
example = [
{ source = "${config.nixpkgs.config.nix.storeDir}/.../etc/dir/file.conf.example";
{ source = "/nix/store/.../etc/dir/file.conf.example";
target = "dir/file.conf";
mode = "0440";
}

View File

@ -112,7 +112,7 @@ with pkgs.lib;
# (For instance, when applied to a bind-mount it
# unmounts the target of the bind-mount.) !!! But
# we should use `-f' for NFS.
if [ "$mp" != / -a "$mp" != /nix -a "$mp" != ${config.nixpkgs.config.nix.storeDir} ]; then
if [ "$mp" != / -a "$mp" != /nix -a "$mp" != /nix/store ]; then
if umount -n "$mp"; then success=1; tryAgain=1; fi
fi

View File

@ -34,9 +34,9 @@ with pkgs.lib;
# Copy all paths in the closure to the filesystem.
storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
mkdir -p /mnt${config.nixpkgs.config.nix.storeDir}
mkdir -p /mnt/nix/store
echo "copying everything (will take a while)..."
cp -prd $storePaths /mnt${config.nixpkgs.config.nix.storeDir}/
cp -prd $storePaths /mnt/nix/store/
# Register the paths in the Nix database.
printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
@ -44,7 +44,7 @@ with pkgs.lib;
# Create the system profile to allow nixos-rebuild to work.
chroot /mnt ${config.environment.nix}/bin/nix-env \
-p ${config.nixpkgs.config.nix.stateDir}/nix/profiles/system --set ${config.system.build.toplevel}
-p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
# `nixos-rebuild' requires an /etc/NIXOS.
mkdir -p /mnt/etc

View File

@ -41,8 +41,8 @@ with pkgs.lib;
# Copy all paths in the closure to the filesystem.
storePaths=$(perl ${pkgs.pathsFromGraph} /tmp/xchg/closure)
mkdir -p /mnt${config.nixpkgs.config.nix.storeDir}
${pkgs.rsync}/bin/rsync -av $storePaths /mnt${config.nixpkgs.config.nix.storeDir}/
mkdir -p /mnt/nix/store
${pkgs.rsync}/bin/rsync -av $storePaths /mnt/nix/store/
# Register the paths in the Nix database.
printRegistration=1 perl ${pkgs.pathsFromGraph} /tmp/xchg/closure | \
@ -50,7 +50,7 @@ with pkgs.lib;
# Create the system profile to allow nixos-rebuild to work.
chroot /mnt ${config.environment.nix}/bin/nix-env \
-p ${config.nixpkgs.config.nix.stateDir}/nix/profiles/system --set ${config.system.build.toplevel}
-p /nix/var/nix/profiles/system --set ${config.system.build.toplevel}
# `nixos-rebuild' requires an /etc/NIXOS.
mkdir -p /mnt/etc

View File

@ -222,7 +222,7 @@ let
# Install GRUB and generate the GRUB boot menu.
touch /etc/NIXOS
mkdir -p ${config.nixpkgs.config.nix.stateDir}/nix/profiles
mkdir -p /nix/var/nix/profiles
${config.system.build.toplevel}/bin/switch-to-configuration boot
umount /boot
@ -276,11 +276,11 @@ in
chmod 1777 $targetRoot/tmp
mkdir -p $targetRoot/boot
mount -o remount,ro $targetRoot${config.nixpkgs.config.nix.storeDir}
mount -o remount,ro $targetRoot/nix/store
${optionalString cfg.writableStore ''
mkdir /mnt-store-tmpfs
mount -t tmpfs -o "mode=755" none /mnt-store-tmpfs
mount -t aufs -o dirs=/mnt-store-tmpfs=rw:$targetRoot${config.nixpkgs.config.nix.storeDir}=rr none $targetRoot${config.nixpkgs.config.nix.storeDir}
mount -t aufs -o dirs=/mnt-store-tmpfs=rw:$targetRoot/nix/store=rr none $targetRoot/nix/store
''}
'';
@ -314,7 +314,7 @@ in
[ { mountPoint = "/";
device = "/dev/vda";
}
{ mountPoint = "${config.nixpkgs.config.nix.storeDir}";
{ mountPoint = "/nix/store";
device = "//10.0.2.4/store";
fsType = "cifs";
options = "guest,sec=none,noperm,noacl";