diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index e7f2f5ef0f96..984cb83e427a 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -10077,6 +10077,13 @@ githubId = 2472678; name = "Lucas Desgouilles"; }; + ldprg = { + email = "lukas_4dr@gmx.at"; + matrix = "@ldprg:matrix.org"; + github = "LDprg"; + githubId = 71488985; + name = "LDprg"; + }; league = { email = "league@contrapunctus.net"; github = "league"; diff --git a/nixos/doc/manual/release-notes/rl-2311.section.md b/nixos/doc/manual/release-notes/rl-2311.section.md index a6a3a946c7ba..e8dd5181de04 100644 --- a/nixos/doc/manual/release-notes/rl-2311.section.md +++ b/nixos/doc/manual/release-notes/rl-2311.section.md @@ -150,6 +150,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 diff --git a/nixos/modules/module-list.nix b/nixos/modules/module-list.nix index f881ccbe30aa..3017857ec645 100644 --- a/nixos/modules/module-list.nix +++ b/nixos/modules/module-list.nix @@ -723,6 +723,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 diff --git a/nixos/modules/services/misc/preload.nix b/nixos/modules/services/misc/preload.nix new file mode 100644 index 000000000000..19b2531087dd --- /dev/null +++ b/nixos/modules/services/misc/preload.nix @@ -0,0 +1,31 @@ +{ 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"; + }; + }; + }; +} diff --git a/pkgs/by-name/pr/preload/0001-prevent-building-to-var-directories.patch b/pkgs/by-name/pr/preload/0001-prevent-building-to-var-directories.patch new file mode 100644 index 000000000000..7538a387c944 --- /dev/null +++ b/pkgs/by-name/pr/preload/0001-prevent-building-to-var-directories.patch @@ -0,0 +1,54 @@ +diff --git a/Makefile.in b/Makefile.in +index e4072e4..4a6b069 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -327,23 +327,9 @@ installcheck-initdSCRIPTS: $(initd_SCRIPTS) + else echo "$$f does not support $$opt" 1>&2; bad=1; fi; \ + done; \ + done; rm -f c$${pid}_.???; exit $$bad +-install-logDATA: $(log_DATA) +- @$(NORMAL_INSTALL) +- test -z "$(logdir)" || $(MKDIR_P) "$(DESTDIR)$(logdir)" +- @list='$(log_DATA)'; for p in $$list; do \ +- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- f=$(am__strip_dir) \ +- echo " $(logDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(logdir)/$$f'"; \ +- $(logDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(logdir)/$$f"; \ +- done ++install-logDATA: + + uninstall-logDATA: +- @$(NORMAL_UNINSTALL) +- @list='$(log_DATA)'; for p in $$list; do \ +- f=$(am__strip_dir) \ +- echo " rm -f '$(DESTDIR)$(logdir)/$$f'"; \ +- rm -f "$(DESTDIR)$(logdir)/$$f"; \ +- done + install-logrotateDATA: $(logrotate_DATA) + @$(NORMAL_INSTALL) + test -z "$(logrotatedir)" || $(MKDIR_P) "$(DESTDIR)$(logrotatedir)" +@@ -361,23 +347,9 @@ uninstall-logrotateDATA: + echo " rm -f '$(DESTDIR)$(logrotatedir)/$$f'"; \ + rm -f "$(DESTDIR)$(logrotatedir)/$$f"; \ + done +-install-pkglocalstateDATA: $(pkglocalstate_DATA) +- @$(NORMAL_INSTALL) +- test -z "$(pkglocalstatedir)" || $(MKDIR_P) "$(DESTDIR)$(pkglocalstatedir)" +- @list='$(pkglocalstate_DATA)'; for p in $$list; do \ +- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ +- f=$(am__strip_dir) \ +- echo " $(pkglocalstateDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkglocalstatedir)/$$f'"; \ +- $(pkglocalstateDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkglocalstatedir)/$$f"; \ +- done ++install-pkglocalstateDATA: + + uninstall-pkglocalstateDATA: +- @$(NORMAL_UNINSTALL) +- @list='$(pkglocalstate_DATA)'; for p in $$list; do \ +- f=$(am__strip_dir) \ +- echo " rm -f '$(DESTDIR)$(pkglocalstatedir)/$$f'"; \ +- rm -f "$(DESTDIR)$(pkglocalstatedir)/$$f"; \ +- done + install-sysconfigDATA: $(sysconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(sysconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(sysconfigdir)" \ No newline at end of file diff --git a/pkgs/by-name/pr/preload/package.nix b/pkgs/by-name/pr/preload/package.nix new file mode 100644 index 000000000000..2240fa5a2cdb --- /dev/null +++ b/pkgs/by-name/pr/preload/package.nix @@ -0,0 +1,34 @@ +{ lib, stdenv, fetchzip, autoconf, automake, pkg-config, glib }: + +stdenv.mkDerivation rec { + pname = "preload"; + version = "0.6.4"; + + src = fetchzip { + url = "mirror://sourceforge/preload/preload-${version}.tar.gz"; + hash = "sha256-vAIaSwvbUFyTl6DflFhuSaMuX9jPVBah+Nl6c/fUbAM="; + }; + + patches = [ + # Prevents creation of /var directories on build + ./0001-prevent-building-to-var-directories.patch + ]; + + nativeBuildInputs = [ autoconf automake pkg-config ]; + buildInputs = [ glib ]; + + configureFlags = [ "--localstatedir=/var" ]; + + postInstall = '' + make sysconfigdir=$out/etc/conf.d install + ''; + + meta = with lib; { + description = "Makes applications run faster by prefetching binaries and shared objects"; + homepage = "https://sourceforge.net/projects/preload"; + license = licenses.gpl2Only; + platforms = lib.platforms.linux; + mainProgram = "preload"; + maintainers = with maintainers; [ ldprg ]; + }; +}