diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-21 21:55:37 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-21 21:55:37 +0200 |
commit | d61f49772f4b7ad39dc2fcbd463ad8671e819a3a (patch) | |
tree | 8a3e8b8f3b1b595cfe051e1c34355e0a73f6698c /custom | |
parent | 6a770605760e6c0f8ce0b204a39b194267de4f55 (diff) | |
download | nixos-d61f49772f4b7ad39dc2fcbd463ad8671e819a3a.tar nixos-d61f49772f4b7ad39dc2fcbd463ad8671e819a3a.tar.gz nixos-d61f49772f4b7ad39dc2fcbd463ad8671e819a3a.tar.bz2 nixos-d61f49772f4b7ad39dc2fcbd463ad8671e819a3a.tar.xz nixos-d61f49772f4b7ad39dc2fcbd463ad8671e819a3a.zip |
escape summary
Diffstat (limited to 'custom')
-rw-r--r-- | custom/notify-user.nix | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/custom/notify-user.nix b/custom/notify-user.nix index 7eda86c9..d3e69bcd 100644 --- a/custom/notify-user.nix +++ b/custom/notify-user.nix | |||
@@ -10,6 +10,7 @@ stdenv.mkDerivation { | |||
10 | import System.FilePath.Glob (glob) | 10 | import System.FilePath.Glob (glob) |
11 | import System.Environment (setEnv, getArgs) | 11 | import System.Environment (setEnv, getArgs) |
12 | import System.Process (callProcess) | 12 | import System.Process (callProcess) |
13 | import System.Posix.Escape (escape) | ||
13 | 14 | ||
14 | import Data.List (isPrefixOf, dropWhileEnd) | 15 | import Data.List (isPrefixOf, dropWhileEnd) |
15 | import Data.Char (isSpace) | 16 | import Data.Char (isSpace) |
@@ -21,12 +22,12 @@ stdenv.mkDerivation { | |||
21 | forM_ envFiles $ \envFile -> do | 22 | forM_ envFiles $ \envFile -> do |
22 | sessionAddr <- tail . snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile | 23 | sessionAddr <- tail . snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile |
23 | setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr | 24 | setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr |
24 | callProcess "${libnotify}/bin/notify-send" =<< (++) <$> getArgs <*> (pure . dropWhileEnd isSpace <$> getContents) | 25 | callProcess "${libnotify}/bin/notify-send" =<< (++) <$> getArgs <*> (pure . escape . dropWhileEnd isSpace <$> getContents) |
25 | 26 | ||
26 | ''; }; | 27 | ''; }; |
27 | phases = [ "buildPhase" "installPhase" ]; | 28 | phases = [ "buildPhase" "installPhase" ]; |
28 | buildPhase = '' | 29 | buildPhase = '' |
29 | ${ghcWithPackages (p: with p; [ Glob process ])}/bin/ghc -odir . -hidir . $src -o notify-${user} | 30 | ${ghcWithPackages (p: with p; [ Glob process posix-escape ])}/bin/ghc -odir . -hidir . $src -o notify-${user} |
30 | ''; | 31 | ''; |
31 | installPhase = '' | 32 | installPhase = '' |
32 | mkdir -p $out/bin | 33 | mkdir -p $out/bin |