about summary refs log tree commit diff
path: root/run
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-04-24 21:21:10 +0000
committerAlyssa Ross <hi@alyssa.is>2023-04-24 21:21:57 +0000
commit0954f3aa9dbfdd81c290bd0cbcfc086ba6906b0f (patch)
treef077d1488ccbf00940b47aecf24ce9efc0cab016 /run
parent4aeb8d60010687c8c2c31dceb18f722b0e684e4e (diff)
downloadinfra-0954f3aa9dbfdd81c290bd0cbcfc086ba6906b0f.tar
infra-0954f3aa9dbfdd81c290bd0cbcfc086ba6906b0f.tar.gz
infra-0954f3aa9dbfdd81c290bd0cbcfc086ba6906b0f.tar.bz2
infra-0954f3aa9dbfdd81c290bd0cbcfc086ba6906b0f.tar.lz
infra-0954f3aa9dbfdd81c290bd0cbcfc086ba6906b0f.tar.xz
infra-0954f3aa9dbfdd81c290bd0cbcfc086ba6906b0f.tar.zst
infra-0954f3aa9dbfdd81c290bd0cbcfc086ba6906b0f.zip
run: increase size of / tmpfs
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Diffstat (limited to 'run')
-rw-r--r--run11
1 files changed, 11 insertions, 0 deletions
diff --git a/run b/run
index 83015b2..c64b83c 100644
--- a/run
+++ b/run
@@ -1,6 +1,12 @@
 #!/run/current-system/sw/bin/bash
 # SPDX-FileCopyrightText: 2022-2023 Alyssa Ross <hi@alyssa.is>
 # SPDX-License-Identifier: EUPL-1.2+
+#
+# Swap setup adapted from swap-to-disk.nix, from commit
+# 8796bc3006917c14b6c5e383d6ae706d08a5e48e of
+# <https://github.com/DeterminateSystems/nix-netboot-serve>:
+# SPDX-FileCopyrightText: Determinate Systems
+# SPDX-License-Identifier: MIT
 
 set -uexo pipefail
 export PATH=/run/wrappers/bin:/nix/var/nix/profiles/default/bin:/run/current-system/sw/bin
@@ -9,6 +15,11 @@ cryptsetup open -d /dev/random --type plain /dev/vda swap
 mkswap /dev/mapper/swap
 swapon /dev/mapper/swap
 
+size=$(lsblk --noheadings --bytes --output SIZE /dev/mapper/swap)
+pagesize=$(getconf PAGESIZE)
+inodes=$((size / pagesize))
+mount -o remount,size="$size",nr_inodes="$inodes" /
+
 for o in $(</proc/cmdline); do
 	case $o in
 		configuration=*)