limit app slice to less than all ram as well
This commit is contained in:
parent
b94a54ec98
commit
fd22fa23b7
|
@ -10,6 +10,7 @@
|
|||
name = "DanixLaptop";
|
||||
eth = "enp0s31f6";
|
||||
wlan = "wlp5s0";
|
||||
cores = 4;
|
||||
};
|
||||
profiles.base.enable = true;
|
||||
profiles.base.plus = true;
|
||||
|
|
|
@ -23,6 +23,10 @@ in
|
|||
name = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
};
|
||||
cores = lib.mkOption {
|
||||
type = lib.types.ints.positive;
|
||||
default = 1;
|
||||
};
|
||||
systemd = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
|
|
|
@ -4,7 +4,7 @@ let
|
|||
cfg = config.profiles.xsession;
|
||||
non-nixos = config.profiles.non-nixos;
|
||||
mkGL = program: "${lib.strings.optionalString non-nixos.enable "${pkgs.nixgl.auto.nixGLDefault}/bin/nixGL "}${program}";
|
||||
execScope = program: "exec bash -c \"systemd-run --user --scope --unit='app-i3-exec-$RANDOM' -p CollectMode=inactive-or-failed -p MemoryHigh=92% -p MemoryMax=98% \"${program}\"\"";
|
||||
execScope = program: "exec bash -c \"systemd-run --user --scope --unit='app-i3-exec-$RANDOM' -p CollectMode=inactive-or-failed -p MemoryHigh=85% -p MemoryMax=92% -p MemorySwapMax=5G -p MemoryAccounting=true \"${program}\"\"";
|
||||
in
|
||||
{
|
||||
imports = [ ./dunstrc.nix ./terminal.nix ./polybar.nix ];
|
||||
|
@ -17,6 +17,14 @@ in
|
|||
config = lib.mkIf cfg.enable {
|
||||
profiles.gui.enable = true;
|
||||
|
||||
systemd.user.slices.app.Slice = {
|
||||
MemoryHigh="90%";
|
||||
MemoryMax="94%";
|
||||
MemorySwapMax="8G";
|
||||
CPUQuota="${toString ((config.machine.cores - 1)*100)}%";
|
||||
MemoryAccounting = true;
|
||||
};
|
||||
|
||||
home.keyboard = {
|
||||
layout = "no";
|
||||
variant = "nodeadkeys";
|
||||
|
|
|
@ -115,8 +115,9 @@ declare -ga runargs=(
|
|||
--slice="app.slice" # run as part of `app.slice`
|
||||
--unit="${prefix}${name}-${rand}"
|
||||
|
||||
-p MemoryHigh=92%
|
||||
-p MemoryMax=98%
|
||||
-p MemoryHigh=85%
|
||||
-p MemoryMax=92%
|
||||
-p MemorySwapMax=5G
|
||||
# unit name
|
||||
--description="dmenu selection ${selection[*]@Q}"
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue