Merge pull request #304527 from atorres1985-contrib/earlyoom
earlyoom: 1.7 -> 1.8
This commit is contained in:
commit
20e0c45c7a
|
@ -4,15 +4,29 @@ let
|
||||||
cfg = config.services.earlyoom;
|
cfg = config.services.earlyoom;
|
||||||
|
|
||||||
inherit (lib)
|
inherit (lib)
|
||||||
mkDefault mkEnableOption mkIf mkOption types
|
concatStringsSep
|
||||||
mkRemovedOptionModule literalExpression
|
escapeShellArg
|
||||||
escapeShellArg concatStringsSep optional optionalString;
|
literalExpression
|
||||||
|
mkDefault
|
||||||
|
mkEnableOption
|
||||||
|
mkIf
|
||||||
|
mkOption
|
||||||
|
mkPackageOption
|
||||||
|
mkRemovedOptionModule
|
||||||
|
optionalString
|
||||||
|
optionals
|
||||||
|
types;
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
|
meta = {
|
||||||
|
maintainers = with lib.maintainers; [ AndersonTorres ];
|
||||||
|
};
|
||||||
|
|
||||||
options.services.earlyoom = {
|
options.services.earlyoom = {
|
||||||
enable = mkEnableOption "early out of memory killing";
|
enable = mkEnableOption "early out of memory killing";
|
||||||
|
|
||||||
|
package = mkPackageOption pkgs "earlyoom" { };
|
||||||
|
|
||||||
freeMemThreshold = mkOption {
|
freeMemThreshold = mkOption {
|
||||||
type = types.ints.between 1 100;
|
type = types.ints.between 1 100;
|
||||||
default = 10;
|
default = 10;
|
||||||
|
@ -138,22 +152,21 @@ in
|
||||||
systemd.services.earlyoom = {
|
systemd.services.earlyoom = {
|
||||||
description = "Early OOM Daemon for Linux";
|
description = "Early OOM Daemon for Linux";
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
path = optional cfg.enableNotifications pkgs.dbus;
|
path = optionals cfg.enableNotifications [ pkgs.dbus ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
StandardError = "journal";
|
StandardError = "journal";
|
||||||
ExecStart = concatStringsSep " " ([
|
ExecStart = concatStringsSep " " ([
|
||||||
"${pkgs.earlyoom}/bin/earlyoom"
|
"${lib.getExe cfg.package}"
|
||||||
("-m ${toString cfg.freeMemThreshold}"
|
("-m ${toString cfg.freeMemThreshold}"
|
||||||
+ optionalString (cfg.freeMemKillThreshold != null) ",${toString cfg.freeMemKillThreshold}")
|
+ optionalString (cfg.freeMemKillThreshold != null) ",${toString cfg.freeMemKillThreshold}")
|
||||||
("-s ${toString cfg.freeSwapThreshold}"
|
("-s ${toString cfg.freeSwapThreshold}"
|
||||||
+ optionalString (cfg.freeSwapKillThreshold != null) ",${toString cfg.freeSwapKillThreshold}")
|
+ optionalString (cfg.freeSwapKillThreshold != null) ",${toString cfg.freeSwapKillThreshold}")
|
||||||
"-r ${toString cfg.reportInterval}"
|
"-r ${toString cfg.reportInterval}"
|
||||||
]
|
]
|
||||||
++ optional cfg.enableDebugInfo "-d"
|
++ optionals cfg.enableDebugInfo [ "-d" ]
|
||||||
++ optional cfg.enableNotifications "-n"
|
++ optionals cfg.enableNotifications [ "-n" ]
|
||||||
++ optional (cfg.killHook != null) "-N ${escapeShellArg cfg.killHook}"
|
++ optionals (cfg.killHook != null) [ "-N ${escapeShellArg cfg.killHook}" ]
|
||||||
++ cfg.extraArgs
|
++ cfg.extraArgs);
|
||||||
);
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import ./make-test-python.nix ({ lib, ... }: {
|
import ./make-test-python.nix ({ lib, ... }: {
|
||||||
name = "earlyoom";
|
name = "earlyoom";
|
||||||
meta = {
|
meta = {
|
||||||
maintainers = with lib.maintainers; [ ncfavier ];
|
maintainers = with lib.maintainers; [ ncfavier AndersonTorres ];
|
||||||
};
|
};
|
||||||
|
|
||||||
machine = {
|
machine = {
|
||||||
|
|
64
pkgs/by-name/ea/earlyoom/package.nix
Normal file
64
pkgs/by-name/ea/earlyoom/package.nix
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
fetchFromGitHub,
|
||||||
|
installShellFiles,
|
||||||
|
pandoc,
|
||||||
|
stdenv,
|
||||||
|
nixosTests,
|
||||||
|
# Boolean flags
|
||||||
|
withManpage ? true,
|
||||||
|
}:
|
||||||
|
|
||||||
|
stdenv.mkDerivation (finalAttrs: {
|
||||||
|
pname = "earlyoom";
|
||||||
|
version = "1.8";
|
||||||
|
|
||||||
|
src = fetchFromGitHub {
|
||||||
|
owner = "rfjakob";
|
||||||
|
repo = "earlyoom";
|
||||||
|
rev = "v${finalAttrs.version}";
|
||||||
|
hash = "sha256-jgNoYOGor2i3ngDuU3It238n5ky+AppzlRKdkwXb2AI=";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = [ "out" ] ++ lib.optionals withManpage [ "man" ];
|
||||||
|
|
||||||
|
patches = [ ./0000-fix-dbus-path.patch ];
|
||||||
|
|
||||||
|
nativeBuildInputs = lib.optionals withManpage [
|
||||||
|
installShellFiles
|
||||||
|
pandoc
|
||||||
|
];
|
||||||
|
|
||||||
|
makeFlags = [
|
||||||
|
"VERSION=${finalAttrs.version}"
|
||||||
|
];
|
||||||
|
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstall
|
||||||
|
install -D earlyoom $out/bin/earlyoom
|
||||||
|
'' + lib.optionalString withManpage ''
|
||||||
|
installManPage earlyoom.1
|
||||||
|
'' + ''
|
||||||
|
runHook postInstall
|
||||||
|
'';
|
||||||
|
|
||||||
|
passthru.tests = {
|
||||||
|
inherit (nixosTests) earlyoom;
|
||||||
|
};
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
homepage = "https://github.com/rfjakob/earlyoom";
|
||||||
|
description = "Early OOM Daemon for Linux";
|
||||||
|
longDescription = ''
|
||||||
|
earlyoom checks the amount of available memory and free swap up to 10
|
||||||
|
times a second (less often if there is a lot of free memory). By default
|
||||||
|
if both are below 10%, it will kill the largest process (highest
|
||||||
|
oom_score). The percentage value is configurable via command line
|
||||||
|
arguments.
|
||||||
|
'';
|
||||||
|
license = lib.licenses.mit;
|
||||||
|
mainProgram = "earlyoom";
|
||||||
|
maintainers = with lib.maintainers; [ AndersonTorres ];
|
||||||
|
platforms = lib.platforms.linux;
|
||||||
|
};
|
||||||
|
})
|
|
@ -1,38 +0,0 @@
|
||||||
{ lib, stdenv, fetchFromGitHub, pandoc, installShellFiles, withManpage ? false, nixosTests }:
|
|
||||||
|
|
||||||
stdenv.mkDerivation rec {
|
|
||||||
pname = "earlyoom";
|
|
||||||
version = "1.7";
|
|
||||||
|
|
||||||
src = fetchFromGitHub {
|
|
||||||
owner = "rfjakob";
|
|
||||||
repo = "earlyoom";
|
|
||||||
rev = "v${version}";
|
|
||||||
sha256 = "sha256-8YcT1TTlAet7F1U9Ginda4IApNqkudegOXqm8rnRGfc=";
|
|
||||||
};
|
|
||||||
|
|
||||||
nativeBuildInputs = lib.optionals withManpage [ pandoc installShellFiles ];
|
|
||||||
|
|
||||||
patches = [ ./fix-dbus-path.patch ];
|
|
||||||
|
|
||||||
makeFlags = [ "VERSION=${version}" ];
|
|
||||||
|
|
||||||
installPhase = ''
|
|
||||||
install -D earlyoom $out/bin/earlyoom
|
|
||||||
'' + lib.optionalString withManpage ''
|
|
||||||
installManPage earlyoom.1
|
|
||||||
'';
|
|
||||||
|
|
||||||
passthru.tests = {
|
|
||||||
inherit (nixosTests) earlyoom;
|
|
||||||
};
|
|
||||||
|
|
||||||
meta = with lib; {
|
|
||||||
description = "Early OOM Daemon for Linux";
|
|
||||||
mainProgram = "earlyoom";
|
|
||||||
homepage = "https://github.com/rfjakob/earlyoom";
|
|
||||||
license = licenses.mit;
|
|
||||||
platforms = platforms.linux;
|
|
||||||
maintainers = with maintainers; [];
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -5130,8 +5130,6 @@ with pkgs;
|
||||||
|
|
||||||
earlybird = callPackage ../tools/security/earlybird { };
|
earlybird = callPackage ../tools/security/earlybird { };
|
||||||
|
|
||||||
earlyoom = callPackage ../os-specific/linux/earlyoom { };
|
|
||||||
|
|
||||||
easyabc = callPackage ../applications/audio/easyabc { };
|
easyabc = callPackage ../applications/audio/easyabc { };
|
||||||
|
|
||||||
easycrypt = callPackage ../applications/science/logic/easycrypt {
|
easycrypt = callPackage ../applications/science/logic/easycrypt {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user