From 9c7344efb4e3d663d26ddb81699c6572bbcfd148 Mon Sep 17 00:00:00 2001 From: Franck Cuny Date: Sun, 28 May 2023 16:32:53 -0700 Subject: tools/waybar-systemd-units: get a list of failed systemd units Get a list of failed systemd units (both user and systems), and generate an output compatible to what waybar expects. Refer to https://github.com/Alexays/Waybar/wiki/Module:-Custom for more details about the format. --- tools/waybar-systemd-units/default.nix | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tools/waybar-systemd-units/default.nix (limited to 'tools/waybar-systemd-units/default.nix') diff --git a/tools/waybar-systemd-units/default.nix b/tools/waybar-systemd-units/default.nix new file mode 100644 index 0000000..70cac84 --- /dev/null +++ b/tools/waybar-systemd-units/default.nix @@ -0,0 +1,27 @@ +{ self, lib, python3, stdenvNoCC, pkgs }: + +stdenvNoCC.mkDerivation rec { + pname = "waybar-systemd-units"; + src = ./waybar-systemd.py; + version = "0.1.0"; + + buildInputs = [ (pkgs.python310.withPackages (ps: with ps; [ click ])) ]; + + propagatedBuildInputs = + [ (pkgs.python310.withPackages (ps: with ps; [ click ])) ]; + + dontUnpack = true; + dontBuild = true; + + installPhase = '' + mkdir -p $out/bin + cp $src $out/bin/${pname} + ''; + + meta = with lib; { + description = "Get a list of systemd units that have failed."; + license = with licenses; [ mit ]; + platforms = platforms.unix; + maintainers = with maintainers; [ fcuny ]; + }; +} -- cgit v1.2.3