Commit a0f5d5e5 authored by LDprg's avatar LDprg Committed by LDprg
Browse files

nixos/preload: init

parent a08e49d5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -131,6 +131,8 @@

- [c2FmZQ](https://github.com/c2FmZQ/c2FmZQ/), an application that can securely encrypt, store, and share files, including but not limited to pictures and videos. Available as [services.c2fmzq-server](#opt-services.c2fmzq-server.enable).

- [preload](http://sourceforge.net/projects/preload), a service that makes applications run faster by prefetching binaries and shared objects.  Available as [services.preload](#opt-services.preload.enable).

## Backward Incompatibilities {#sec-release-23.11-incompatibilities}

- `network-online.target` has been fixed to no longer time out for systems with `networking.useDHCP = true` and `networking.useNetworkd = true`.
+1 −0
Original line number Diff line number Diff line
@@ -719,6 +719,7 @@
  ./services/misc/podgrab.nix
  ./services/misc/polaris.nix
  ./services/misc/portunus.nix
  ./services/misc/preload.nix
  ./services/misc/prowlarr.nix
  ./services/misc/pufferpanel.nix
  ./services/misc/pykms.nix
+31 −0
Original line number Diff line number Diff line
{ 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} --foreground $PRELOAD_OPTS";
        Type = "simple";
        # Only preload data during CPU idle time
        IOSchedulingClass = 3;
        DynamicUser = true;
        StateDirectory = "preload";
      };
    };
  };
}