about summary refs log tree commit diff
path: root/run
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-04-23 15:49:19 +0000
committerAlyssa Ross <hi@alyssa.is>2023-04-23 15:50:06 +0000
commit9ddd70ad09f3f3e5d4dc275aeee96c1f8ae5ba1a (patch)
tree6add9593e08f9c2cf2260b74e0696c818c973e77 /run
parentbc21630d437768e8ad85ddf05163ed5701c93ac3 (diff)
downloadinfra-9ddd70ad09f3f3e5d4dc275aeee96c1f8ae5ba1a.tar
infra-9ddd70ad09f3f3e5d4dc275aeee96c1f8ae5ba1a.tar.gz
infra-9ddd70ad09f3f3e5d4dc275aeee96c1f8ae5ba1a.tar.bz2
infra-9ddd70ad09f3f3e5d4dc275aeee96c1f8ae5ba1a.tar.lz
infra-9ddd70ad09f3f3e5d4dc275aeee96c1f8ae5ba1a.tar.xz
infra-9ddd70ad09f3f3e5d4dc275aeee96c1f8ae5ba1a.tar.zst
infra-9ddd70ad09f3f3e5d4dc275aeee96c1f8ae5ba1a.zip
run: use the entire block device as swap
This avoids having to copy the Nix store, and gives builds a lot more
memory to expand into.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'run')
-rw-r--r--run15
1 files changed, 5 insertions, 10 deletions
diff --git a/run b/run
index f8a93e0..47b05bf 100644
--- a/run
+++ b/run
@@ -1,16 +1,12 @@
 #!/run/current-system/sw/bin/bash
-# SPDX-FileCopyrightText: 2022 Alyssa Ross <hi@alyssa.is>
+# SPDX-FileCopyrightText: 2022-2023 Alyssa Ross <hi@alyssa.is>
 # SPDX-License-Identifier: EUPL-1.2+
 
 set -uexo pipefail
 export PATH=/run/wrappers/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin
 
-mkfs.ext4 /dev/vda
-mount /dev/vda /mnt
-mkdir /mnt/tmp
-
-cp -R /nix /mnt
-mount --bind /mnt/nix /nix
+mkswap /dev/vda
+swapon /dev/vda
 
 for o in $(</proc/cmdline); do
 	case $o in
@@ -27,8 +23,8 @@ done
 curl -fLsS --retry-all-errors --retry 5 "$userdata" | base64 -d --ignore-garbage > user-data.tar.zst
 tar -Pxvf user-data.tar.zst
 rm user-data.tar.zst
-curl -fLsSo /mnt/tmp/spectrum-main.tar.gz https://spectrum-os.org/git/spectrum/snapshot/spectrum-main.tar.gz
-tar -C /mnt/tmp -xf /mnt/tmp/spectrum-main.tar.gz
+curl -fLsSo /tmp/spectrum-main.tar.gz https://spectrum-os.org/git/spectrum/snapshot/spectrum-main.tar.gz
+tar -C /tmp -xf /tmp/spectrum-main.tar.gz
 
 curl -fLsSo /etc/nixos/configuration.nix "$configuration"
 systemctl start dbus.socket
@@ -38,7 +34,6 @@ nixos-rebuild switch -I nixos-config=/etc/nixos/configuration.nix \
 systemctl start --no-block multi-user.target systemd-journal-gatewayd.socket
 
 exec systemd-run --wait -u nix-build \
-	-p BindPaths=/mnt/tmp:/tmp \
 	-p Restart=on-failure \
 	-p StartLimitBurst=5 \
 	-p StartLimitIntervalSec=1d \