depot/third_party/nixpkgs/nixos/modules/services/misc/preload.nix
Default email 504525a148 Project import generated by Copybara.
GitOrigin-RevId: bd645e8668ec6612439a9ee7e71f7eac4099d4f6
2024-01-02 12:29:13 +01:00

31 lines
798 B
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.services.preload;
in {
meta = { maintainers = pkgs.preload.meta.maintainers; };
options.services.preload = {
enable = mkEnableOption "preload";
package = mkPackageOption pkgs "preload" { };
};
config = mkIf cfg.enable {
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 = "${getExe cfg.package} -l '' --foreground $PRELOAD_OPTS";
Type = "simple";
# Only preload data during CPU idle time
IOSchedulingClass = 3;
DynamicUser = true;
StateDirectory = "preload";
};
};
};
}