From 6e867ad68daf9dd934e87edac4ad61accf4a7fe6 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 21 Jul 2016 21:19:54 +0200 Subject: =?UTF-8?q?=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- custom/notify-user.nix | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'custom') diff --git a/custom/notify-user.nix b/custom/notify-user.nix index 30a844bd..0b98d672 100644 --- a/custom/notify-user.nix +++ b/custom/notify-user.nix @@ -9,14 +9,13 @@ stdenv.mkDerivation { src = writeTextFile { name = ''notify-${user}.hs''; text = '' import Control.Shell import System.FilePath.Glob (glob) + import System.Directory (setCurrentDirectory) import Data.List (isPrefixOf) - import Data.Either (either) - main = do - env <- shellEnv - (either print return =<<) . runSh (env { envWorkDir = "/" } ) $ do + setCurrentDirectory "/" + 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 @@ -24,7 +23,7 @@ stdenv.mkDerivation { ''; }; phases = [ "buildPhase" "installPhase" ]; buildPhase = '' - ${ghcWithPackages (p: with p; [ shellmate Glob ])}/bin/ghc -odir . -hidir . $src -o notify-${user} + ${ghcWithPackages (p: with p; [ shellmate Glob directory ])}/bin/ghc -odir . -hidir . $src -o notify-${user} ''; installPhase = '' mkdir -p $out/bin -- cgit v1.2.3