This commit is contained in:
iFargle 2024-02-01 20:40:57 +09:00
parent 59b0758b9b
commit e5c75c0f5e
2 changed files with 5 additions and 5 deletions

View file

@ -38,7 +38,7 @@ if [ ! -e "nixos/hosts/$TARGET_HOST/disks.nix" ]; then
fi fi
# Create a key for encrypted swap, if needed # Create a key for encrypted swap, if needed
sudo echo -n "$(head -c32 /dev/random | base64)" > /etc/swap.key echo -n "$(head -c32 /dev/random | base64)" > /tmp/swap.key
echo "WARNING! The disks in $TARGET_HOST are about to get wiped" echo "WARNING! The disks in $TARGET_HOST are about to get wiped"
echo " NixOS will be re-installed" echo " NixOS will be re-installed"
@ -66,8 +66,8 @@ if [[ $REPLY =~ ^[Yy]$ ]]; then
# If there is a keyfile for a data disk, put copy it to the root partition and # If there is a keyfile for a data disk, put copy it to the root partition and
# ensure the permissions are set appropriately. # ensure the permissions are set appropriately.
if [[ -f "/etc/swap.key" ]]; then if [[ -f "/tmp/swap.key" ]]; then
sudo cp /etc/swap.key /mnt/etc/swap.key sudo cp /tmp/swap.key /mnt/tmp/swap.key
sudo chmod 0400 /mnt/etc/swap.key sudo chmod 0400 /mnt/tmp/swap.key
fi fi
fi fi

View file

@ -72,7 +72,7 @@
type = "luks"; type = "luks";
name = "SWAP"; name = "SWAP";
settings = { settings = {
keyFile = "/etc/swap.key"; keyFile = "/tmp/swap.key";
allowDiscards = true; allowDiscards = true;
}; };
content = { content = {