-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
adaptivemm: init at unstable-20230116 #225782
base: master
Are you sure you want to change the base?
Conversation
There are proper release tags, but the latest one is from Feb 2022 and there are buffer overflow fixes since.
|
||
installPhase = '' | ||
mkdir -p $out/bin $out/etc/sysconfig $out/share/man/man8 | ||
cp adaptivemmd $out/bin/ | ||
cp $src/adaptivemmd.cfg $out/etc/sysconfig/adaptivemmd | ||
cp $src/adaptivemmd.8 $out/share/man/man8/ | ||
''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
installPhase = '' | |
mkdir -p $out/bin $out/etc/sysconfig $out/share/man/man8 | |
cp adaptivemmd $out/bin/ | |
cp $src/adaptivemmd.cfg $out/etc/sysconfig/adaptivemmd | |
cp $src/adaptivemmd.8 $out/share/man/man8/ | |
''; | |
nativeBuildInputs = [ installShellFiles ]; | |
installPhase = '' | |
runHook preInstall | |
install -Dm555 adaptivemmd $out/bin/adaptivemmd | |
install -Dm444 adaptivemmd.cfg $out/etc/sysconfig/adaptivemmd | |
installManPage adaptivemmd.8 | |
runHook postInstall | |
''; |
@@ -0,0 +1,31 @@ | |||
{ lib, stdenv, fetchFromGitHub }: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ lib, stdenv, fetchFromGitHub }: | |
{ lib, stdenv, fetchFromGitHub, installShellFiles }: |
meta = with lib; { | ||
description = "A userspace daemon for proactive free memory management"; | ||
license = licenses.gpl2; | ||
platforms = platforms.linux; | ||
maintainers = with maintainers; [ cmm ]; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
meta = with lib; { | |
description = "A userspace daemon for proactive free memory management"; | |
license = licenses.gpl2; | |
platforms = platforms.linux; | |
maintainers = with maintainers; [ cmm ]; | |
}; | |
meta = with lib; { | |
description = "A userspace daemon for proactive free memory management"; | |
homepage = "https://github.com/oracle/adaptivemm"; | |
license = licenses.gpl2; | |
platforms = platforms.linux; | |
maintainers = with maintainers; [ cmm ]; | |
mainProgram = "adaptivemmd"; | |
}; |
package = mkOption { | ||
type = types.package; | ||
default = pkgs.adaptivemm; | ||
defaultText = literalExpression "pkgs.adaptivemm"; | ||
description = lib.mdDoc '' | ||
Which adaptivemm package to use. | ||
''; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
package = mkOption { | |
type = types.package; | |
default = pkgs.adaptivemm; | |
defaultText = literalExpression "pkgs.adaptivemm"; | |
description = lib.mdDoc '' | |
Which adaptivemm package to use. | |
''; | |
}; | |
package = mkPackageOptionMD pkgs "adaptivemm" { }; |
}; | ||
|
||
verbosity = mkOption { | ||
type = types.int; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's some magic stuff in lib
that let's us avoid the nasty asserts.
type = types.int; | |
type = types.int.between 0 5; |
}; | ||
|
||
aggressiveness = mkOption { | ||
type = types.int; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type = types.int; | |
type = types.int.between 1 3; |
verboseFlag = assert (cfg.verbosity >= 0 && cfg.verbosity <= 5); | ||
if cfg.verbosity == 0 then "" | ||
else lib.concatStrings (["-"] ++ (lib.replicate cfg.verbosity "v")); | ||
aggressivenessFlag = assert (cfg.aggressiveness >= 1 && cfg.aggressiveness <= 3); | ||
"-a ${builtins.toString cfg.aggressiveness}"; | ||
gapFlag = "-m ${builtins.toString cfg.maxWatermarkGap}"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verboseFlag = assert (cfg.verbosity >= 0 && cfg.verbosity <= 5); | |
if cfg.verbosity == 0 then "" | |
else lib.concatStrings (["-"] ++ (lib.replicate cfg.verbosity "v")); | |
aggressivenessFlag = assert (cfg.aggressiveness >= 1 && cfg.aggressiveness <= 3); | |
"-a ${builtins.toString cfg.aggressiveness}"; | |
gapFlag = "-m ${builtins.toString cfg.maxWatermarkGap}"; | |
verboseFlag = if cfg.verbosity == 0 then "" | |
else "-${lib.concatStrings (lib.replicate cfg.verbosity "v")}"; | |
aggressivenessFlag = "-a ${toString cfg.aggressiveness}"; | |
gapFlag = "-m ${toString cfg.maxWatermarkGap}"; |
meta = { | ||
maintainers = with maintainers; [ cmm ]; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit
meta = { | |
maintainers = with maintainers; [ cmm ]; | |
}; | |
meta.maintainers = with maintainers; [ cmm ]; |
environment = { | ||
systemPackages = [ cfg.package ]; | ||
etc."sysconfig/adaptivemmd".source = "${cfg.package}/etc/sysconfig/adaptivemmd"; | ||
}; | ||
|
||
systemd.services.adaptivemmd = { | ||
serviceConfig = { | ||
Type = "forking"; | ||
EnvironmentFile = "/etc/sysconfig/adaptivemmd"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unless you have a strong suspicion that it would be beneficial to the average user to run this manually, I think I would just hide this file and keep the package away from the environment.
environment = { | |
systemPackages = [ cfg.package ]; | |
etc."sysconfig/adaptivemmd".source = "${cfg.package}/etc/sysconfig/adaptivemmd"; | |
}; | |
systemd.services.adaptivemmd = { | |
serviceConfig = { | |
Type = "forking"; | |
EnvironmentFile = "/etc/sysconfig/adaptivemmd"; | |
systemd.services.adaptivemmd = { | |
serviceConfig = { | |
Type = "forking"; | |
EnvironmentFile = "${cfg.package}/etc/sysconfig/adaptivemmd"; |
@h7x4 I packaged adaptivemm speculatively, hoping to solve some problem I don't even remember specifics of at this point (it was a kernel bug in the end, fixed since). should've just abandoned this PR but forgot, sorry! |
@@ -0,0 +1,86 @@ | |||
{ config, lib, pkgs, ... }: | |||
|
|||
with lib; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in { | ||
options = { | ||
services.adaptivemm = { | ||
enable = mkEnableOption (lib.mdDoc "Proactively tune kernel free memory configuration"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are proper release tags, but the latest one is from Feb 2022 and there are buffer overflow fixes since.
Description of changes
Things done
sandbox = true
set innix.conf
? (See Nix manual)nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)