3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/nixos/modules/config
Bjørn Forsman b30852ed41 nixos/swap: support for resizing swapfile
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.
2016-07-06 16:04:27 +02:00
..
fonts config.fonts.fontdir: use runCommand instead of builderDefs 2016-05-26 22:39:01 +02:00
debug-info.nix treewide: rename extraOutputs{ToLink,ToInstall} 2016-04-07 15:59:44 +02:00
gnu.nix services.xserver.startGnuPGAgent: remove obsolete NixOS option 2016-03-18 11:06:31 +01:00
i18n.nix Revert "Add the tool "nixos-typecheck" that can check an option declaration to:" 2016-03-01 20:52:06 +01:00
krb5.nix Add kerberos mappings for MIT exchange server 2016-05-11 09:09:24 -04:00
ldap.nix ldap module: fix activationScripts declaration 2016-05-23 22:54:15 +02:00
networking.nix networking config: specify resolv.conf options as list of strings 2016-05-28 14:28:13 +02:00
no-x-libs.nix
nsswitch.nix
power-management.nix Remove default scsiLinkPolicy 2015-12-17 16:40:35 +01:00
pulseaudio.nix Revert "pulseaudio: select correct outputs" 2016-04-28 17:06:09 +03:00
shells-environment.nix Use shell packages to select the user's shell 2016-06-12 20:35:34 +01:00
swap.nix nixos/swap: support for resizing swapfile 2016-07-06 16:04:27 +02:00
sysctl.nix Revert "Add the tool "nixos-typecheck" that can check an option declaration to:" 2016-03-01 20:52:06 +01:00
system-environment.nix nixos,lib: move environment generation related copy-paste to lib 2015-09-18 18:48:49 +00:00
system-path.nix Merge branch 'master' into staging 2016-05-12 04:53:38 +02:00
timezone.nix nixos: let's not forget types in the timezone module 2015-07-31 01:57:47 +00:00
unix-odbc-drivers.nix unix-odbc-drivers module: update for new unixODBCDrivers 2016-04-26 23:58:11 +03:00
update-users-groups.pl nixos/update-users-groups.pl: print UIDs and GIDs 2016-07-01 13:13:46 +02:00
users-groups.nix modules/users-groups: add shell example 2016-06-25 19:41:24 +02:00
vpnc.nix nixos/vpnc: fix formatting of example 2016-02-27 22:25:39 +13:00
zram.nix zram: simplified totalmem calculation for zram.nix 2016-01-29 22:41:20 +11:00