mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 08:23:09 +00:00
b30852ed41
Currently NixOS creates the swapfile (with the specified size) only if it doesn't already exist. Changing the swapfile size afterwards will not have any effect. This commit changes that so the swapfile will be recreated whenever swapDevices.*.size is changed (or more precisely, whenever the actual file size differs from the configured one), allowing both growing and shrinking the swapfile. The service unit has "restartIfChanged = false", so we don't have to worry about the swapfile being in use at the time this code is run (you have to reboot for swapfile changes). fallocate doesn't shrink files, use truncate for that. truncate can also be used to grow files, but it creates "holes" in the file which doesn't work with swapfiles. |
||
---|---|---|
.. | ||
fonts | ||
debug-info.nix | ||
gnu.nix | ||
i18n.nix | ||
krb5.nix | ||
ldap.nix | ||
networking.nix | ||
no-x-libs.nix | ||
nsswitch.nix | ||
power-management.nix | ||
pulseaudio.nix | ||
shells-environment.nix | ||
swap.nix | ||
sysctl.nix | ||
system-environment.nix | ||
system-path.nix | ||
timezone.nix | ||
unix-odbc-drivers.nix | ||
update-users-groups.pl | ||
users-groups.nix | ||
vpnc.nix | ||
zram.nix |