dotfiles/hm/frobar/default.nix

38 lines
1.1 KiB
Nix
Raw Normal View History

{ pkgs ? import <nixpkgs> { config = { }; overlays = [ ]; } }:
# Tried using pyproject.nix but mpd2 dependency wouldn't resolve,
# is called pyton-mpd2 on PyPi but mpd2 in nixpkgs.
let
frobar = pkgs.python3Packages.buildPythonApplication {
pname = "frobar";
version = "2.0";
propagatedBuildInputs = with pkgs.python3Packages; [
coloredlogs
notmuch
i3ipc
mpd2
psutil
pulsectl
pyinotify
];
src = ./.;
};
frobar_launcher = pkgs.writeShellApplication
{
name = "frobar_launcher";
runtimeInputs = with pkgs; [ lemonbar-xft wirelesstools ];
text = ''
pidfile=$XDG_RUNTIME_DIR/frobar/$DISPLAY.pid
${pkgs.coreutils}/bin/mkdir -p "$(${pkgs.coreutils}/bin/dirname "$pidfile")"
([ -f "$pidfile" ] && ${pkgs.procps}/bin/kill "$(<"$pidfile")") || true
${frobar}/bin/frobar & disown
echo $! > "$pidfile"
'';
};
in
frobar_launcher
# FIXME Doesn't kill the old bar
# FIXME Not using Nerdfont
# TODO Connection with i3 is lost sometimes, more often than with Arch?