depot/third_party/nixpkgs/pkgs/by-name/sw/sway-assign-cgroups/package.nix
Default email ae2dc6aea6 Project import generated by Copybara.
GitOrigin-RevId: 4c2fcb090b1f3e5b47eaa7bd33913b574a11e0a0
2024-10-11 07:15:48 +02:00

44 lines
1.4 KiB
Nix

{ lib
, fetchFromGitHub
, python3Packages
}:
python3Packages.buildPythonApplication rec {
pname = "sway-assign-cgroups";
version = "0.4.1";
src = fetchFromGitHub {
owner = "alebastr";
repo = "sway-systemd";
rev = "refs/tags/v${version}";
hash = "sha256-AJ87/sPy8IVJgb5YehfUfNTOFEDithLfiTxgZfZf238=";
};
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";
mainProgram = "assign-cgroups.py";
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 ];
};
}