mirror of
https://forge.katzen.cafe/schrottkatze/nix-configs.git
synced 2024-11-05 15:16:23 +01:00
swappidyswapswap
This commit is contained in:
parent
84bc51c573
commit
36b479e90d
|
@ -100,6 +100,29 @@
|
|||
|
||||
# i rly should put that important big comment back here
|
||||
system.stateVersion = "22.11"; # Did you read the comment?
|
||||
|
||||
systemd.services = {
|
||||
create-swapfile = {
|
||||
serviceConfig.Type = "oneshot";
|
||||
wantedBy = [ "swap-swapfile.swap" ];
|
||||
script = ''
|
||||
swapfile="/swap/swapfile"
|
||||
if [[ -f "$swapfile" ]]; then
|
||||
echo "Swap file $swapfile already exists, taking no action"
|
||||
else
|
||||
echo "Setting up swap file $swapfile"
|
||||
${pkgs.coreutils}/bin/truncate -s 0 "$swapfile"
|
||||
${pkgs.e2fsprogs}/bin/chattr +C "$swapfile"
|
||||
fi
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
#fileSystems."/swap" = {
|
||||
# device = "/dev/disk/by-uuid/f6d243ec-6be9-4551-8cbb-aefb7b691a62";
|
||||
# fsType = "btrfs";
|
||||
# options = [ "subvol=swap" "noatime" ];
|
||||
#};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -36,7 +36,10 @@
|
|||
fsType = "vfat";
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
swapDevices = [{
|
||||
device = "/swap/swapfile";
|
||||
size = (1024 * 12); # 12GB
|
||||
}];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
|
|
Loading…
Reference in a new issue