summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--custom/notify-user.nix5
1 files changed, 3 insertions, 2 deletions
diff --git a/custom/notify-user.nix b/custom/notify-user.nix
index 7eda86c9..d3e69bcd 100644
--- a/custom/notify-user.nix
+++ b/custom/notify-user.nix
@@ -10,6 +10,7 @@ stdenv.mkDerivation {
10 import System.FilePath.Glob (glob) 10 import System.FilePath.Glob (glob)
11 import System.Environment (setEnv, getArgs) 11 import System.Environment (setEnv, getArgs)
12 import System.Process (callProcess) 12 import System.Process (callProcess)
13 import System.Posix.Escape (escape)
13 14
14 import Data.List (isPrefixOf, dropWhileEnd) 15 import Data.List (isPrefixOf, dropWhileEnd)
15 import Data.Char (isSpace) 16 import Data.Char (isSpace)
@@ -21,12 +22,12 @@ stdenv.mkDerivation {
21 forM_ envFiles $ \envFile -> do 22 forM_ envFiles $ \envFile -> do
22 sessionAddr <- tail . snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile 23 sessionAddr <- tail . snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile
23 setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr 24 setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr
24 callProcess "${libnotify}/bin/notify-send" =<< (++) <$> getArgs <*> (pure . dropWhileEnd isSpace <$> getContents) 25 callProcess "${libnotify}/bin/notify-send" =<< (++) <$> getArgs <*> (pure . escape . dropWhileEnd isSpace <$> getContents)
25 26
26 ''; }; 27 ''; };
27 phases = [ "buildPhase" "installPhase" ]; 28 phases = [ "buildPhase" "installPhase" ];
28 buildPhase = '' 29 buildPhase = ''
29 ${ghcWithPackages (p: with p; [ Glob process ])}/bin/ghc -odir . -hidir . $src -o notify-${user} 30 ${ghcWithPackages (p: with p; [ Glob process posix-escape ])}/bin/ghc -odir . -hidir . $src -o notify-${user}
30 ''; 31 '';
31 installPhase = '' 32 installPhase = ''
32 mkdir -p $out/bin 33 mkdir -p $out/bin