summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--custom/notify-user.nix9
1 files changed, 4 insertions, 5 deletions
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 {
9 src = writeTextFile { name = ''notify-${user}.hs''; text = '' 9 src = writeTextFile { name = ''notify-${user}.hs''; text = ''
10 import Control.Shell 10 import Control.Shell
11 import System.FilePath.Glob (glob) 11 import System.FilePath.Glob (glob)
12 import System.Directory (setCurrentDirectory)
12 13
13 import Data.List (isPrefixOf) 14 import Data.List (isPrefixOf)
14 15
15 import Data.Either (either)
16
17 main = do 16 main = do
18 env <- shellEnv 17 setCurrentDirectory "/"
19 (either print return =<<) . runSh (env { envWorkDir = "/" } ) $ do 18 shell_ $ do
20 (envFile:_) <- liftIO $ glob "/home/${user}/.dbus/session-bus/*-0" 19 (envFile:_) <- liftIO $ glob "/home/${user}/.dbus/session-bus/*-0"
21 sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> input envFile 20 sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> input envFile
22 env <- getShellEnv 21 env <- getShellEnv
@@ -24,7 +23,7 @@ stdenv.mkDerivation {
24 ''; }; 23 ''; };
25 phases = [ "buildPhase" "installPhase" ]; 24 phases = [ "buildPhase" "installPhase" ];
26 buildPhase = '' 25 buildPhase = ''
27 ${ghcWithPackages (p: with p; [ shellmate Glob ])}/bin/ghc -odir . -hidir . $src -o notify-${user} 26 ${ghcWithPackages (p: with p; [ shellmate Glob directory ])}/bin/ghc -odir . -hidir . $src -o notify-${user}
28 ''; 27 '';
29 installPhase = '' 28 installPhase = ''
30 mkdir -p $out/bin 29 mkdir -p $out/bin