about summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorNick Hu <me@nickhu.co.uk>2023-12-01 10:18:42 +0000
committerGitHub <noreply@github.com>2023-12-01 10:18:42 +0000
commit3fde91cc1311dd0e74226ca67aa32c15276cf622 (patch)
tree9d005d13b0e2e920ac0aba0c1ac3b89c87aad4b5 /pkgs/applications
parent791dbd64f818332a746ff66c926bc728215843d8 (diff)
downloadnixlib-3fde91cc1311dd0e74226ca67aa32c15276cf622.tar
nixlib-3fde91cc1311dd0e74226ca67aa32c15276cf622.tar.gz
nixlib-3fde91cc1311dd0e74226ca67aa32c15276cf622.tar.bz2
nixlib-3fde91cc1311dd0e74226ca67aa32c15276cf622.tar.lz
nixlib-3fde91cc1311dd0e74226ca67aa32c15276cf622.tar.xz
nixlib-3fde91cc1311dd0e74226ca67aa32c15276cf622.tar.zst
nixlib-3fde91cc1311dd0e74226ca67aa32c15276cf622.zip
sway-assign-cgroups: init at 0.4.0 (#268949)
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/window-managers/sway/assign-cgroups.nix43
1 files changed, 43 insertions, 0 deletions
diff --git a/pkgs/applications/window-managers/sway/assign-cgroups.nix b/pkgs/applications/window-managers/sway/assign-cgroups.nix
new file mode 100644
index 000000000000..c6029de3ee80
--- /dev/null
+++ b/pkgs/applications/window-managers/sway/assign-cgroups.nix
@@ -0,0 +1,43 @@
+{ lib
+, fetchFromGitHub
+, python3Packages
+}:
+
+python3Packages.buildPythonApplication rec {
+  pname = "assign-cgroups";
+  version = "0.4.0";
+  src = fetchFromGitHub {
+    owner = "alebastr";
+    repo = "sway-systemd";
+    rev = "v${version}";
+    sha256 = "sha256-wznYE1/lVJtvf5Nq96gbPYisxc2gWLahVydwcH1vwoQ=";
+  };
+  format = "other";
+
+  propagatedBuildInputs = with python3Packages; [ dbus-next i3ipc psutil tenacity xlib ];
+
+  installPhase = ''
+    runHook preInstall
+    mkdir -p $out/bin
+    cp src/assign-cgroups.py $out/bin/
+    runHook postInstall
+  '';
+
+  meta = with lib; {
+    description = "Place GUI applications into systemd scopes for systemd-oomd compatibility.";
+    longDescription = ''
+      Automatically assign a dedicated systemd scope to the GUI applications
+      launched in the same cgroup as the compositor. This could be helpful for
+      implementing cgroup-based resource management and would be necessary when
+      `systemd-oomd` is in use.
+
+      Limitations: The script is using i3ipc window:new event to detect application
+      launches and would fail to detect background apps or special surfaces.
+      Therefore it's recommended to supplement the script with use of systemd user
+      services for such background apps.
+    '';
+    license = licenses.mit;
+    platforms = platforms.linux;
+    maintainers = with maintainers; [ nickhu ];
+  };
+}