1
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-06-19 16:09:19 +03:00
nixpkgs/nixos/modules/services/misc/preload.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
816 B
Nix
Raw Permalink Normal View History

2023-11-09 09:16:01 +01:00
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.preload;
in
{
meta = {
maintainers = pkgs.preload.meta.maintainers;
};
options.services.preload = {
enable = lib.mkEnableOption "preload";
package = lib.mkPackageOption pkgs "preload" { };
2023-11-09 09:16:01 +01:00
};
config = lib.mkIf cfg.enable {
2023-11-09 09:16:01 +01:00
systemd.services.preload = {
description = "Loads data into ram during idle time of CPU.";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
EnvironmentFile = "${cfg.package}/etc/conf.d/preload";
ExecStart = "${lib.getExe cfg.package} -l '' --foreground $PRELOAD_OPTS";
2023-11-09 09:16:01 +01:00
Type = "simple";
# Only preload data during CPU idle time
IOSchedulingClass = 3;
DynamicUser = true;
StateDirectory = "preload";
};
};
};
}