personal/dotfiles

services.nix in master
Repositories | Summary | Log | Files | README.md | LICENSE

services.nix (3076B) download


  1{ writeScript, ... }:
  2
  3
  4let
  5  stw-background = "#4d4d4d";
  6  stw-foreground = "#eeeeee";
  7  stw-font = "Monaco:size=9";
  8
  9in [
 10  {
 11    name = "9wm";
 12    enable = false;
 13    setup = "";
 14    run = writeScript "9wm-run" ''
 15      #!/bin/sh
 16
 17      SVDIR=.. sv check xserver > /dev/null || exit 1
 18
 19      cd $HOMEs
 20      exec 9wm
 21    '';
 22  }
 23  {
 24    name = "blueman-applet";
 25    enable = true;
 26    setup = "";
 27    run = writeScript "blueman-applet-run" ''
 28      #!/bin/sh
 29
 30      exec blueman-applet
 31    '';
 32  }
 33  {
 34    name = "dbus-session";
 35    enable = true;
 36    setup = "";
 37    run = writeScript "dbus-session-run" ''
 38      #!/bin/sh
 39
 40      exec dbus-daemon --nofork --session
 41    '';
 42  }
 43  {
 44    name = "dwm";
 45    enable = true;
 46    setup = "";
 47    run = writeScript "dwm-run" ''
 48      #!/bin/sh
 49
 50      cd $HOME
 51      exec dwm
 52    '';
 53  }
 54  {
 55    name = "nm-applet";
 56    enable = true;
 57    setup = "";
 58    run = writeScript "nm-applet-run" ''
 59      #!/bin/sh
 60
 61      exec nm-applet
 62    '';
 63  }
 64  {
 65    name = "pa-applet";
 66    enable = true;
 67    setup = "";
 68    run = writeScript "pa-applet-run" ''
 69      #!/bin/sh
 70
 71      exec pa-applet
 72    '';
 73  }
 74  {
 75    name = "battery-applet";
 76    enable = true;
 77    setup = "";
 78    run = writeScript "battery-applet-run" ''
 79      #!/bin/sh
 80
 81      exec cbatticon
 82    '';
 83  }
 84  {
 85    name = "slstatus";
 86    enable = true;
 87    setup = "";
 88    run = writeScript "slstatus-run" ''
 89      #!/bin/sh
 90
 91      FIFO=/tmp/slstatus.fifo
 92
 93      [ -p $FIFO ] || rm -f $FIFO
 94      mkfifo $FIFO
 95
 96      exec slstatus -p $FIFO 
 97    '';
 98  }
 99  {
100    name = "slstatus-xbps";
101    enable = true;
102    setup = "";
103    run = writeScript "slstatus-xbps-run" ''
104      #!/bin/bash
105
106      OUTPUT=/tmp/xbps-updates.txt
107
108      while true; do
109          updates=$(xbps-install -Mun | wc -l)
110
111          if [ $updates -ne 0 ]; then
112              echo $updates > $OUTPUT
113          else
114              echo up-to-date > $OUTPUT
115          fi
116          sleep 120
117      done
118    '';
119  }
120  {
121    name = "stw-service";
122    enable = true;
123    setup = "";
124    run = writeScript "stw-service-run" ''
125      #!/bin/sh
126
127      exec stw -b '${stw-background}' -f '${stw-foreground}' -F '${stw-font}' -p 1 -B 10 -y 20 sh -c 'echo -- services -- ; psv /var/service/* ~/.xservice/* 2> /dev/null | sort -k2,2 -k1,1'
128    '';
129  }
130  {
131    name = "stw-xbps";
132    enable = true;
133    setup = "";
134    run = writeScript "stw-xbps-run" ''
135      #!/bin/sh
136
137      exec stw -b '${stw-background}' -f '${stw-foreground}' -F '${stw-font}' -B 10 -p 120 -y 100% -Y -100% sh -c 'echo -- updates -- && xbps-install -Mun | cut -d" " -f1'
138    '';
139  }
140  {
141    name = "tiramisu";
142    enable = true;
143    setup = "";
144    run = writeScript "tiramisu-run" ''
145      #!/bin/sh
146
147      SVDIR=.. sv check slstatus > /dev/null || exit 1
148
149      exec tiramisu -o '\\x04#source\\x05#summary: #body\\n' | xargs -i printf '%b' '{}' > /tmp/slstatus.fifo
150    '';
151  }
152  {
153    name = "xfce-polkit";
154    enable = true;
155    setup = "";
156    run = writeScript "xfce-polkit-run" ''
157      #!/bin/sh
158
159      exec /usr/libexec/xfce-polkit
160    '';
161  }
162]