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:
parent
a16d43a8ac
commit
fe045dc949
@ -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 @@ 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/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 @@ storePaths=$(@perl@/bin/perl @pathsFromGraph@ @nixClosure@)
|
||||
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 @@ fi
|
||||
# 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 @@ touch $mountPoint/etc/NIXOS
|
||||
# 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
|
||||
|
@ -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 /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 @@ fi
|
||||
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 @@ if test -z "$rollback"; then
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user