summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--custom/notify-user.nix14
1 files changed, 7 insertions, 7 deletions
diff --git a/custom/notify-user.nix b/custom/notify-user.nix
index 0b98d672..b8293e49 100644
--- a/custom/notify-user.nix
+++ b/custom/notify-user.nix
@@ -7,23 +7,23 @@
7stdenv.mkDerivation { 7stdenv.mkDerivation {
8 name = ''notify-${user}''; 8 name = ''notify-${user}'';
9 src = writeTextFile { name = ''notify-${user}.hs''; text = '' 9 src = writeTextFile { name = ''notify-${user}.hs''; text = ''
10 import Control.Shell
11 import System.FilePath.Glob (glob) 10 import System.FilePath.Glob (glob)
12 import System.Directory (setCurrentDirectory) 11 import System.Directory (setCurrentDirectory)
12 import System.Environment (setEnv, getArgs)
13 13
14 import Data.List (isPrefixOf) 14 import Data.List (isPrefixOf)
15 15
16 main = do 16 main = do
17 setCurrentDirectory "/" 17 setCurrentDirectory "/"
18 shell_ $ do 18 (envFile:_) <- glob "/home/${user}/.dbus/session-bus/*-0"
19 (envFile:_) <- liftIO $ glob "/home/${user}/.dbus/session-bus/*-0" 19 sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile
20 sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> input envFile 20 setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr
21 env <- getShellEnv 21 proc "${libnotify}/bin/notify-send" =<< getArgs
22 withEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr $ run "${libnotify}/bin/notify-send" cmdline 22
23 ''; }; 23 ''; };
24 phases = [ "buildPhase" "installPhase" ]; 24 phases = [ "buildPhase" "installPhase" ];
25 buildPhase = '' 25 buildPhase = ''
26 ${ghcWithPackages (p: with p; [ shellmate Glob directory ])}/bin/ghc -odir . -hidir . $src -o notify-${user} 26 ${ghcWithPackages (p: with p; [ Glob directory process ])}/bin/ghc -odir . -hidir . $src -o notify-${user}
27 ''; 27 '';
28 installPhase = '' 28 installPhase = ''
29 mkdir -p $out/bin 29 mkdir -p $out/bin