Author: shlevy
Date: Sat Oct 29 22:14:27 2011
New Revision: 30106
URL: https://nixos.org/websvn/nix/?rev=30106&sc=1
Log:
sed -i -e 's|/nix/var|@stateDir@|g' -e 's|/nix/store|@storeDir@|g'
modules/installer/tools/*.sh
Use configurable storeDir and stateDir in the installer tools
Modified:
nixos/trunk/modules/installer/tools/nixos-install.sh
nixos/trunk/modules/installer/tools/nixos-rebuild.sh
Modified: nixos/trunk/modules/installer/tools/nixos-install.sh
==============================================================================
--- nixos/trunk/modules/installer/tools/nixos-install.sh Sat Oct 29
22:00:25 2011 (r30105)
+++ nixos/trunk/modules/installer/tools/nixos-install.sh Sat Oct 29
22:14:27 2011 (r30106)
@@ -6,7 +6,7 @@
# - register validity
# - 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 @stateDir@/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 @@
# Create the necessary Nix directories on the target device, if they
# don't already exist.
mkdir -m 0755 -p \
- $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
+ $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
mkdir -m 1777 -p \
- $mountPoint/nix/store \
+ $mountPoint@storeDir@ \
# Get the store paths to copy from the references graph.
@@ -112,7 +112,7 @@
echo "copying Nix to $mountPoint...."
for i in $storePaths; do
echo " $i"
- rsync -a $i $mountPoint/nix/store/
+ rsync -a $i $mountPoint@storeDir@/
done
@@ -154,7 +154,7 @@
# it into the system configuration profile.
echo "building the system configuration..."
NIXPKGS=/mnt/etc/nixos/nixpkgs chroot $mountPoint @nix@/bin/nix-env \
- -p /nix/var/nix/profiles/system \
+ -p @stateDir@/nix/profiles/system \
-f "/mnt$NIXOS" \
--set -A system
@@ -196,4 +196,4 @@
# configuration.
echo "finalising the installation..."
NIXOS_INSTALL_GRUB=1 chroot $mountPoint \
- /nix/var/nix/profiles/system/bin/switch-to-configuration boot
+ @stateDir@/nix/profiles/system/bin/switch-to-configuration boot
Modified: nixos/trunk/modules/installer/tools/nixos-rebuild.sh
==============================================================================
--- nixos/trunk/modules/installer/tools/nixos-rebuild.sh Sat Oct 29
22:00:25 2011 (r30105)
+++ nixos/trunk/modules/installer/tools/nixos-rebuild.sh Sat Oct 29
22:14:27 2011 (r30106)
@@ -133,9 +133,9 @@
manifests=$(nix-instantiate --eval-only --xml --strict $NIXOS -A manifests
\
| grep '<string' | sed 's^.*"\(.*\)".*^\1^g')
- mkdir -p /nix/var/nix/channel-cache
+ mkdir -p @stateDir@/nix/channel-cache
for i in $manifests; do
- NIX_DOWNLOAD_CACHE=/nix/var/nix/channel-cache nix-pull $i || true
+ NIX_DOWNLOAD_CACHE=@stateDir@/nix/channel-cache nix-pull $i || true
done
fi
@@ -162,8 +162,8 @@
if test -z "$rollback"; then
echo "building the system configuration..." >&2
if test "$action" = switch -o "$action" = boot; then
- nix-env -p /nix/var/nix/profiles/system -f $NIXOS --set -A system
$extraBuildFlags
- pathToConfig=/nix/var/nix/profiles/system
+ nix-env -p @stateDir@/nix/profiles/system -f $NIXOS --set -A system
$extraBuildFlags
+ pathToConfig=@stateDir@/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 @@
fi
else # test -n "$rollback"
if test "$action" = switch -o "$action" = boot; then
- nix-env --rollback -p /nix/var/nix/profiles/system
- pathToConfig=/nix/var/nix/profiles/system
+ nix-env --rollback -p @stateDir@/nix/profiles/system
+ pathToConfig=@stateDir@/nix/profiles/system
elif test "$action" = test -o "$action" = build; then
systemNumber=$(
- nix-env -p /nix/var/nix/profiles/system --list-generations |
+ nix-env -p @stateDir@/nix/profiles/system --list-generations |
sed -n '/current/ {g; p;}; s/ *\([0-9]*\).*/\1/; h'
)
- ln -sT /nix/var/nix/profiles/system-${systemNumber}-link ./result
+ ln -sT @stateDir@/nix/profiles/system-${systemNumber}-link ./result
pathToConfig=./result
else
showSyntax
_______________________________________________
nix-commits mailing list
[email protected]
http://lists.science.uu.nl/mailman/listinfo/nix-commits