summaryrefslogtreecommitdiff
path: root/custom/notify-user.nix
diff options
context:
space:
mode:
authorGregor Kleen <pngwjpgh@users.noreply.github.com>2016-07-21 21:19:54 +0200
committerGregor Kleen <pngwjpgh@users.noreply.github.com>2016-07-21 21:19:54 +0200
commit6e867ad68daf9dd934e87edac4ad61accf4a7fe6 (patch)
tree1e43bdf9091a04d283eeb6d075f10b04f38911b2 /custom/notify-user.nix
parent7024b348e2853c975ea9757ed36866dcacd8f24a (diff)
downloadnixos-6e867ad68daf9dd934e87edac4ad61accf4a7fe6.tar
nixos-6e867ad68daf9dd934e87edac4ad61accf4a7fe6.tar.gz
nixos-6e867ad68daf9dd934e87edac4ad61accf4a7fe6.tar.bz2
nixos-6e867ad68daf9dd934e87edac4ad61accf4a7fe6.tar.xz
nixos-6e867ad68daf9dd934e87edac4ad61accf4a7fe6.zip
Diffstat (limited to 'custom/notify-user.nix')
-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