diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-21 21:25:01 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-21 21:25:01 +0200 |
commit | e41925f463af8e11881e94e286422582faefc5b1 (patch) | |
tree | dc4af5d6cb2d1a31c7ab5b482374d6e0a10b25db /custom | |
parent | 6e867ad68daf9dd934e87edac4ad61accf4a7fe6 (diff) | |
download | nixos-e41925f463af8e11881e94e286422582faefc5b1.tar nixos-e41925f463af8e11881e94e286422582faefc5b1.tar.gz nixos-e41925f463af8e11881e94e286422582faefc5b1.tar.bz2 nixos-e41925f463af8e11881e94e286422582faefc5b1.tar.xz nixos-e41925f463af8e11881e94e286422582faefc5b1.zip |
no shellmate
Diffstat (limited to 'custom')
-rw-r--r-- | custom/notify-user.nix | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/custom/notify-user.nix b/custom/notify-user.nix index 0b98d672..b8293e49 100644 --- a/custom/notify-user.nix +++ b/custom/notify-user.nix | |||
@@ -7,23 +7,23 @@ | |||
7 | stdenv.mkDerivation { | 7 | 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 Control.Shell | ||
11 | import System.FilePath.Glob (glob) | 10 | import System.FilePath.Glob (glob) |
12 | import System.Directory (setCurrentDirectory) | 11 | import System.Directory (setCurrentDirectory) |
12 | import System.Environment (setEnv, getArgs) | ||
13 | 13 | ||
14 | import Data.List (isPrefixOf) | 14 | import Data.List (isPrefixOf) |
15 | 15 | ||
16 | main = do | 16 | main = do |
17 | setCurrentDirectory "/" | 17 | setCurrentDirectory "/" |
18 | shell_ $ do | 18 | (envFile:_) <- glob "/home/${user}/.dbus/session-bus/*-0" |
19 | (envFile:_) <- liftIO $ glob "/home/${user}/.dbus/session-bus/*-0" | 19 | sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile |
20 | sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> input envFile | 20 | setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr |
21 | env <- getShellEnv | 21 | proc "${libnotify}/bin/notify-send" =<< getArgs |
22 | withEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr $ run "${libnotify}/bin/notify-send" cmdline | 22 | |
23 | ''; }; | 23 | ''; }; |
24 | phases = [ "buildPhase" "installPhase" ]; | 24 | phases = [ "buildPhase" "installPhase" ]; |
25 | buildPhase = '' | 25 | buildPhase = '' |
26 | ${ghcWithPackages (p: with p; [ shellmate Glob directory ])}/bin/ghc -odir . -hidir . $src -o notify-${user} | 26 | ${ghcWithPackages (p: with p; [ Glob directory process ])}/bin/ghc -odir . -hidir . $src -o notify-${user} |
27 | ''; | 27 | ''; |
28 | installPhase = '' | 28 | installPhase = '' |
29 | mkdir -p $out/bin | 29 | mkdir -p $out/bin |