1 { config, lib, pkgs, ... }:
6 cfg = config.services.preload;
8 meta = { maintainers = pkgs.preload.meta.maintainers; };
10 options.services.preload = {
11 enable = mkEnableOption "preload";
12 package = mkPackageOption pkgs "preload" { };
15 config = mkIf cfg.enable {
16 systemd.services.preload = {
17 description = "Loads data into ram during idle time of CPU.";
18 wantedBy = [ "multi-user.target" ];
21 EnvironmentFile = "${cfg.package}/etc/conf.d/preload";
22 ExecStart = "${getExe cfg.package} --foreground $PRELOAD_OPTS";
24 # Only preload data during CPU idle time
25 IOSchedulingClass = 3;
27 StateDirectory = "preload";