summaryrefslogtreecommitdiff
path: root/custom
diff options
context:
space:
mode:
authorGregor Kleen <pngwjpgh@users.noreply.github.com>2016-07-21 21:27:52 +0200
committerGregor Kleen <pngwjpgh@users.noreply.github.com>2016-07-21 21:27:52 +0200
commit26b1dc2dcd3409a922aae4702fb5853894389ebb (patch)
treec0318ce0d3cf932ddb9f4840d7a179313b3ab954 /custom
parentc8825be34e061698d0081a3a2301085bc2c88e2a (diff)
downloadnixos-26b1dc2dcd3409a922aae4702fb5853894389ebb.tar
nixos-26b1dc2dcd3409a922aae4702fb5853894389ebb.tar.gz
nixos-26b1dc2dcd3409a922aae4702fb5853894389ebb.tar.bz2
nixos-26b1dc2dcd3409a922aae4702fb5853894389ebb.tar.xz
nixos-26b1dc2dcd3409a922aae4702fb5853894389ebb.zip
go through all dbus files
Diffstat (limited to 'custom')
-rw-r--r--custom/notify-user.nix13
1 files changed, 6 insertions, 7 deletions
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 {
8 name = ''notify-${user}''; 8 name = ''notify-${user}'';
9 src = writeTextFile { name = ''notify-${user}.hs''; text = '' 9 src = writeTextFile { name = ''notify-${user}.hs''; text = ''
10 import System.FilePath.Glob (glob) 10 import System.FilePath.Glob (glob)
11 import System.Directory (setCurrentDirectory)
12 import System.Environment (setEnv, getArgs) 11 import System.Environment (setEnv, getArgs)
13 import System.Process (callProcess) 12 import System.Process (callProcess)
14 13
15 import Data.List (isPrefixOf) 14 import Data.List (isPrefixOf)
16 15
17 main = do 16 main = do
18 setCurrentDirectory "/" 17 envFiles <- glob "/home/${user}/.dbus/session-bus/*"
19 (envFile:_) <- glob "/home/${user}/.dbus/session-bus/*" 18 forM envFiles $ \envFile -> do
20 sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile 19 sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile
21 setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr 20 setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr
22 callProcess "${libnotify}/bin/notify-send" =<< getArgs 21 callProcess "${libnotify}/bin/notify-send" =<< getArgs
23 22
24 ''; }; 23 ''; };
25 phases = [ "buildPhase" "installPhase" ]; 24 phases = [ "buildPhase" "installPhase" ];
26 buildPhase = '' 25 buildPhase = ''
27 ${ghcWithPackages (p: with p; [ Glob directory process ])}/bin/ghc -odir . -hidir . $src -o notify-${user} 26 ${ghcWithPackages (p: with p; [ Glob process ])}/bin/ghc -odir . -hidir . $src -o notify-${user}
28 ''; 27 '';
29 installPhase = '' 28 installPhase = ''
30 mkdir -p $out/bin 29 mkdir -p $out/bin