1
0
Fork 0

Remove a lot of eventd, fix mako

This commit is contained in:
Malte Brandy 2019-12-16 14:28:48 +01:00
parent b1140900bc
commit 60458fbcf3
No known key found for this signature in database
GPG key ID: 226A2D41EF5378C9
8 changed files with 9 additions and 188 deletions

View file

@ -1,6 +1,5 @@
{ lib, pkgs, config, ... }:
let
inherit (import ../pkgs) eventd;
battery-watch = pkgs.writeScript "battery-watch" ''
#!${pkgs.stdenv.shell}
@ -13,9 +12,9 @@ let
if [ "$(${pkgs.acpi}/bin/acpi -a | grep -o off)" == "off" ]; then
battery_level=`${pkgs.acpi}/bin/acpi -b | sed 's/.*[dg], //g;s/\%,.*//g'`
if [ $battery_level -le $critical_level ]; then
${eventd}/bin/eventc critical battery -d "title='Battery level is low!'" -d "message='Only $battery_level% of the charge remains.'"
${pkgs.libnotify}/bin/notify-send 'Battery level is low!' "Only $battery_level% of the charge remains."
else
${eventd}/bin/eventc notification battery -d "title='Battery is discharging!'" -d "message='Only $battery_level% of the charge remains.'"
${pkgs.libnotify}/bin/notify-send 'Battery level is discharging!' "Only $battery_level% of the charge remains."
sleep 18m
fi
fi

View file

@ -3,14 +3,8 @@ let
inherit (import ../../pkgs) desktop-pkgs;
inherit (import ../../lib) colors;
in {
imports = [
./sway.nix
./wallpaper.nix
./rofi.nix
./ssh-agent.nix
./eventd.nix
./sleep-nag.nix
];
imports =
[ ./sway.nix ./wallpaper.nix ./rofi.nix ./ssh-agent.nix ./sleep-nag.nix ];
m-0 = {
workspaces = [
"tasks"

View file

@ -1,130 +0,0 @@
{ pkgs, lib, config, ... }:
let
colors = config.m-0.colors;
inherit (import ../../pkgs) eventd;
in {
home.packages = [ eventd ];
systemd.user = {
services = {
eventd = {
Unit = {
Description = "eventd";
After = [ "graphical-session-pre.target" ];
PartOf = [ "graphical-session.target" ];
};
Install = { WantedBy = [ "default.target" ]; };
Service = {
Type = "notify";
Sockets = "eventd-control.socket eventd.socket";
ExecStart = "${eventd}/bin/eventd --listen systemd";
ExecReload = "${eventd}/bin/eventdctl reload";
};
};
};
sockets = {
eventd-control = {
Unit = { Description = "eventd control socket"; };
Socket = {
Service = "eventd.service";
SocketMode = "0600";
ListenStream = "%t/eventd/private";
};
};
eventd = {
Unit = { Description = "eventd sockets"; };
Socket = {
SocketMode = "0660";
ListenStream = "%t/eventd/evp";
};
};
};
};
xdg = {
configFile = {
"eventd/eventd.conf".text = lib.generators.toINI { } {
"Queue default" = {
Margin = 10;
Spacing = 2;
Limit = 10;
};
"Queue command" = {
Anchor = "bottom-right";
Margin = 10;
Spacing = 2;
Limit = 10;
};
"Queue critical" = {
Anchor = "top";
Margin = 450;
Spacing = 2;
Limit = 10;
};
"Queue tasks" = {
Anchor = "bottom";
Margin = 0;
Spacing = 1;
Limit = 20;
};
Notification = { Text = "\${message}"; };
NotificationBubble = {
Padding = 10;
Radius = 0;
Border = 4;
BorderBlur = 4;
Timeout = 5000;
Colour = colors.background;
};
NotificationText = {
Font = "Linux Libertine 12";
Colour = colors.foreground;
};
};
"eventd/notification.event".text = lib.generators.toINI { } {
"Event notification *" = { Actions = "notification"; };
"Event notification kassandra" = { Actions = "kassandra"; };
"Event command success" = { Actions = "command-success"; };
"Event command failure" = { Actions = "command-failure"; };
"Event critical *" = { Actions = "critical"; };
};
"eventd/command-success.action".text = lib.generators.toINI { } {
Action = { Name = "command-success"; };
Notification = {
Text = "<b>\${command}</b>\\nsucceeded after \${time} @ \${host}";
};
NotificationBubble = {
Colour = colors.black;
Queue = "command";
};
};
"eventd/command-failure.action".text = lib.generators.toINI { } {
Action = { Name = "command-failure"; };
Notification = {
Text = "<b>\${command}</b>\\nfailed after \${time} @ \${host}";
};
NotificationBubble = {
Queue = "critical";
Colour = colors.red;
};
};
"eventd/critical.action".text = lib.generators.toINI { } {
Action = { Name = "critical"; };
Notification = { Text = "<b>\${title}</b>\${message/^/\\n}"; };
NotificationBubble = {
Queue = "critical";
Colour = colors.red;
};
};
"eventd/kassandra.action".text = lib.generators.toINI { } {
Action = { Name = "kassandra"; };
Notification = { Text = "<b>\${title}</b>\${message/^/\\n}"; };
NotificationBubble = { Queue = "critical"; };
};
"eventd/notification.action".text = lib.generators.toINI { } {
Action = { Name = "notification"; };
Notification = { Text = "<b>\${title}</b>\${message/^/\\n}"; };
};
};
};
}

View file

@ -1,7 +1,6 @@
{ lib, pkgs, config, ... }:
let
inherit (import ../../lib) writeHaskellScript;
inherit (import ../../pkgs) eventd;
sleep-nag = writeHaskellScript {
name = "sleep-nag";
imports = [
@ -11,7 +10,7 @@ let
"Control.Concurrent"
"Data.Functor"
];
bins = [ eventd ];
bins = [ pkgs.libnotify ];
} ''
main = forever $ do
time <- getZonedTime
@ -21,7 +20,7 @@ let
diff = diffUTCTime (zonedTimeToUTC time{zonedTimeToLocalTime = (zonedTimeToLocalTime time){localTimeOfDay = TimeOfDay 23 0 0}}) (zonedTimeToUTC time)
delay = toRational diff
if night then (do
eventc "notification" "kassandra" "-d" ([i|title='Es ist #{formatTime defaultTimeLocale "%H:%M" time} Uhr: Zeit ins Bett zu gehen!'|]::String) "-d" "message='Du kannst das hier auch morgen tun!'"
notify_send ([i|title='Es ist #{formatTime defaultTimeLocale "%H:%M" time} Uhr: Zeit ins Bett zu gehen!'|]::String) "Du kannst das hier auch morgen tun!"
threadDelay 600000000)
else
threadDelay (floor $ delay * 1000000)

View file

@ -1,12 +1,10 @@
{ config, lib, pkgs, ... }:
let inherit (import ../pkgs) eventd;
in {
{ config, lib, pkgs, ... }: {
systemd.user = {
services.update_tasks = {
Unit = { Description = "Update taskwarrior tasks"; };
Service = {
Type = "oneshot";
Environment = "PATH=${pkgs.taskwarrior}/bin:${eventd}/bin";
Environment = "PATH=${pkgs.taskwarrior}/bin";
ExecStart = "${config.home.homeDirectory}/.cargo/bin/update_tasks";
};
};

View file

@ -14,7 +14,7 @@
# If running from tty1 start sway
if [ "$(tty)" = "/dev/tty1" ]; then
. ${my-pkgs.start-ssh-agent}/bin/start-ssh-agent
exec ${pkgs.sway}/bin/sway
exec ${pkgs.sway}/bin/sway >> ~/tmp/sway.log
fi
${builtins.readFile ./zshrc}

View file

@ -235,6 +235,5 @@ in rec {
inherit (my-lib) home-manager;
};
foreign-home-pkgs = extra-system-pkgs;
eventd = pkgs.callPackage ./eventd { };
email2matrix = pkgs.callPackage ./email2matrix { };
}

View file

@ -1,38 +0,0 @@
{ fetchFromGitHub, stdenv, ninja, meson, pkgconfig, glib, cairo, gdk_pixbuf
, glib_networking, pango, libudev, xorg, libxslt, docbook_xml_xslt, git, libuuid
, dbus, libsoup, docbook_xml_dtd_45, docbook5_xsl, gettext, autoconf, libtool
, utillinux, libxkbcommon }:
stdenv.mkDerivation rec {
name = "eventd";
version = "d7c7ba59aa6b225b3e2b8aebdd853137c05d8445";
src = fetchFromGitHub {
owner = "sardemff7";
repo = "eventd";
rev = version;
sha256 = "0b32dwx2ngdm57pdhq1wr7h7i12lnhnm81bs9bbs60dqc01ry6jq";
fetchSubmodules = true;
};
buildInputs = [
ninja
meson
pkgconfig
glib
cairo
gdk_pixbuf
glib_networking
pango
libudev
xorg.libxcb
xorg.xcbutil
xorg.xcbutilwm
libxkbcommon
libxslt
docbook_xml_xslt
docbook_xml_dtd_45
libuuid
dbus
];
preConfigure = ''
export mesonFlags="-Dsystemd=true -Dintrospection=false -Dnd-wayland=false -Dim=false -Dsound=false -Ddbussessionservicedir=$prefix/share/dbus-1/services -Dsystemduserunitdir=$prefix/lib/systemd/user -Dsystemdsystemunitdir=$prefix/lib/systemd/system"
'';
}