mirror of
https://github.com/buckley310/nixos-config.git
synced 2024-11-09 18:47:02 +00:00
add swapspace module
This commit is contained in:
parent
aa7c7749ed
commit
0fbf2573cc
1 changed files with 20 additions and 0 deletions
20
modules/swapspace.nix
Normal file
20
modules/swapspace.nix
Normal file
|
@ -0,0 +1,20 @@
|
|||
{ config, lib, pkgs, ... }:
|
||||
let
|
||||
cfg = config.sconfig.swapspace;
|
||||
in
|
||||
{
|
||||
options.sconfig.swapspace = {
|
||||
enable = lib.mkEnableOption "swapspace";
|
||||
swapPath = lib.mkOption { type = lib.types.path; };
|
||||
};
|
||||
config = lib.mkIf cfg.enable {
|
||||
systemd.tmpfiles.rules = [ "d ${cfg.swapPath} 0700 root root" ];
|
||||
systemd.services.swapspace = {
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
serviceConfig = {
|
||||
Restart = "always";
|
||||
ExecStart = "${pkgs.swapspace}/bin/swapspace --swappath='${cfg.swapPath}'";
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Loading…
Reference in a new issue