From 26b1dc2dcd3409a922aae4702fb5853894389ebb Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 21 Jul 2016 21:27:52 +0200 Subject: go through all dbus files --- custom/notify-user.nix | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'custom') diff --git a/custom/notify-user.nix b/custom/notify-user.nix index 68e267d6..e3437ea7 100644 --- a/custom/notify-user.nix +++ b/custom/notify-user.nix @@ -8,23 +8,22 @@ stdenv.mkDerivation { name = ''notify-${user}''; src = writeTextFile { name = ''notify-${user}.hs''; text = '' import System.FilePath.Glob (glob) - import System.Directory (setCurrentDirectory) import System.Environment (setEnv, getArgs) import System.Process (callProcess) import Data.List (isPrefixOf) main = do - setCurrentDirectory "/" - (envFile:_) <- glob "/home/${user}/.dbus/session-bus/*" - sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile - setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr - callProcess "${libnotify}/bin/notify-send" =<< getArgs + envFiles <- glob "/home/${user}/.dbus/session-bus/*" + forM envFiles $ \envFile -> do + sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile + setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr + callProcess "${libnotify}/bin/notify-send" =<< getArgs ''; }; phases = [ "buildPhase" "installPhase" ]; buildPhase = '' - ${ghcWithPackages (p: with p; [ Glob directory process ])}/bin/ghc -odir . -hidir . $src -o notify-${user} + ${ghcWithPackages (p: with p; [ Glob process ])}/bin/ghc -odir . -hidir . $src -o notify-${user} ''; installPhase = '' mkdir -p $out/bin -- cgit v1.2.3