summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--custom/notify-user.nix12
1 files changed, 8 insertions, 4 deletions
diff --git a/custom/notify-user.nix b/custom/notify-user.nix
index 917c2b7f..623c78bf 100644
--- a/custom/notify-user.nix
+++ b/custom/notify-user.nix
@@ -1,7 +1,7 @@
1{ stdenv, writeTextFile 1{ stdenv, writeTextFile
2, ghcWithPackages 2, ghcWithPackages
3, user ? "gkleen" 3, user ? "gkleen"
4, libnotify 4# , libnotify
5}: 5}:
6 6
7stdenv.mkDerivation { 7stdenv.mkDerivation {
@@ -19,6 +19,8 @@ stdenv.mkDerivation {
19 19
20 import Control.Monad (forM_, void) 20 import Control.Monad (forM_, void)
21 21
22 import qualified Libnotify as Notify
23
22 main = do 24 main = do
23 envFiles <- glob "/home/${user}/.dbus/session-bus/*" 25 envFiles <- glob "/home/${user}/.dbus/session-bus/*"
24 forM_ envFiles $ \envFile -> do 26 forM_ envFiles $ \envFile -> do
@@ -27,15 +29,17 @@ stdenv.mkDerivation {
27 lines <- lines <$> getContents 29 lines <- lines <$> getContents
28 case lines of 30 case lines of
29 [] -> exitWith ExitSuccess 31 [] -> exitWith ExitSuccess
32 # ((trim -> summary):(trim . unlines -> contents)) -> do
33 # ph <- spawnProcess "${libnotify}/bin/notify-send" =<< (++ [summary, contents]) <$> getArgs
34 # void $ waitForProcess ph
30 ((trim -> summary):(trim . unlines -> contents)) -> do 35 ((trim -> summary):(trim . unlines -> contents)) -> do
31 ph <- spawnProcess "${libnotify}/bin/notify-send" =<< (++ [summary, contents]) <$> getArgs 36 Notify.display_ $ Notify.appName "notify-${user}" <> Notify.summary summary <> Notify.body contents
32 void $ waitForProcess ph
33 where 37 where
34 trim = dropWhileEnd isSpace . dropWhile isSpace 38 trim = dropWhileEnd isSpace . dropWhile isSpace
35 ''; }; 39 ''; };
36 phases = [ "buildPhase" "installPhase" ]; 40 phases = [ "buildPhase" "installPhase" ];
37 buildPhase = '' 41 buildPhase = ''
38 ${ghcWithPackages (p: with p; [ Glob process ])}/bin/ghc -odir . -hidir . $src -o notify-${user} 42 ${ghcWithPackages (p: with p; [ Glob process libnotify ])}/bin/ghc -odir . -hidir . $src -o notify-${user}
39 ''; 43 '';
40 installPhase = '' 44 installPhase = ''
41 mkdir -p $out/bin 45 mkdir -p $out/bin