2023-12-08 22:44:21 +01:00
|
|
|
{ pkgs ? import <nixpkgs> { config = { }; overlays = [ ]; }, ... }:
|
2023-11-19 20:51:05 +01:00
|
|
|
# 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";
|
|
|
|
|
2023-12-08 22:44:21 +01:00
|
|
|
runtimeInputs = with pkgs; [ lemonbar-xft wirelesstools ];
|
2023-11-19 20:51:05 +01:00
|
|
|
propagatedBuildInputs = with pkgs.python3Packages; [
|
|
|
|
coloredlogs
|
|
|
|
notmuch
|
|
|
|
i3ipc
|
|
|
|
mpd2
|
|
|
|
psutil
|
|
|
|
pulsectl
|
|
|
|
pyinotify
|
|
|
|
];
|
2023-12-08 22:44:21 +01:00
|
|
|
makeWrapperArgs = [ "--prefix PATH : ${pkgs.lib.makeBinPath (with pkgs; [ lemonbar-xft wirelesstools ])}" ];
|
2023-11-19 20:51:05 +01:00
|
|
|
|
|
|
|
src = ./.;
|
|
|
|
};
|
|
|
|
in
|
2023-12-08 22:44:21 +01:00
|
|
|
{
|
|
|
|
config = {
|
|
|
|
xsession.windowManager.i3.config.bars = [ ];
|
|
|
|
programs.autorandr.hooks.postswitch = {
|
|
|
|
frobar = "${pkgs.systemd}/bin/systemctl --user restart frobar";
|
|
|
|
};
|
|
|
|
systemd.user.services.frobar = {
|
|
|
|
Unit = {
|
|
|
|
Description = "frobar";
|
|
|
|
After = [ "graphical-session-pre.target" ];
|
|
|
|
PartOf = [ "graphical-session.target" ];
|
|
|
|
};
|
|
|
|
|
|
|
|
Service = {
|
|
|
|
# Wait for i3 to start. Can't use ExecStartPre because otherwise it blocks graphical-session.target, and there's nothing i3/systemd
|
|
|
|
# TODO Do that better
|
|
|
|
ExecStart = ''${pkgs.bash}/bin/bash -c "while ! ${pkgs.i3}/bin/i3-msg; do ${pkgs.coreutils}/bin/sleep 1; done; ${frobar}/bin/frobar"'';
|
|
|
|
};
|
|
|
|
|
|
|
|
Install = { WantedBy = [ "graphical-session.target" ]; };
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
# TODO Connection with i3 is lost on start sometimes, more often than with Arch?
|
|
|
|
# TODO Restore ability to build frobar with nix-build
|