33 lines
548 B
Nix
33 lines
548 B
Nix
{
|
|
pkgs,
|
|
lib,
|
|
config,
|
|
...
|
|
}:
|
|
with lib;
|
|
let
|
|
cfg = config.global.lowmem;
|
|
in
|
|
{
|
|
options.global.lowmem = {
|
|
enable = mkEnableOption "low memory optimisations";
|
|
swapsize = mkOption {
|
|
type = with types; int;
|
|
default = 8 * 1024;
|
|
description = "automatic swap file size";
|
|
};
|
|
};
|
|
|
|
config = mkIf cfg.enable {
|
|
# enables remote nixos-rebuild
|
|
nix.settings.trusted-users = [ "koishi" ];
|
|
|
|
swapDevices = [
|
|
{
|
|
device = "/nix/persist/secret/swap";
|
|
size = cfg.swapsize;
|
|
}
|
|
];
|
|
};
|
|
}
|