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

svn path=/nixos/trunk/; revision=30106
This commit is contained in:
Shea Levy 2011-10-29 22:14:27 +00:00
parent a16d43a8ac
commit fe045dc949
2 changed files with 20 additions and 20 deletions

View File

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

View File

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