Commit 2c453c2c authored by LDprg's avatar LDprg Committed by github-actions[bot]
Browse files

nixos/preload: init

(cherry picked from commit a0f5d5e5)
parent 77edc9d8
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -152,6 +152,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}

- `services.postgresql.ensurePermissions` has been deprecated in favor of `services.postgresql.ensureUsers.*.ensureDBOwnership` which simplifies the setup of database owned by a certain system user
+1 −0
Original line number Diff line number Diff line
@@ -722,6 +722,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";
      };
    };
  };
}