From 9f173f3e4449b5ddd94fbfbbfbf76678289c849c Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 21 Jul 2016 21:13:46 +0200 Subject: fix working directory problems --- custom/notify-user.nix | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'custom') diff --git a/custom/notify-user.nix b/custom/notify-user.nix index f433f4a7..f95bc43d 100644 --- a/custom/notify-user.nix +++ b/custom/notify-user.nix @@ -12,11 +12,15 @@ stdenv.mkDerivation { import Data.List (isPrefixOf) - main = shell_ $ do - (envFile:_) <- liftIO $ glob "/home/${user}/.dbus/session-bus/*-0" - sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> input envFile - env <- getShellEnv - withEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr $ run "${libnotify}/bin/notify-send" cmdline + import Data.Either (either) + + main = do + env <- shellEnv + either print return =<< runSh (env { envWorkDir = "/" } ) $ do + (envFile:_) <- liftIO $ glob "/home/${user}/.dbus/session-bus/*-0" + sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> input envFile + env <- getShellEnv + withEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr $ run "${libnotify}/bin/notify-send" cmdline ''; }; phases = [ "buildPhase" "installPhase" ]; buildPhase = '' -- cgit v1.2.3