From 95fefb100bdd9d4c4c70f532a68ed08b559676b8 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 2 Oct 2016 16:37:44 +0200 Subject: heuristic to strip quotes --- custom/notify-user.nix | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/custom/notify-user.nix b/custom/notify-user.nix index 58beebf7..ddf78db0 100644 --- a/custom/notify-user.nix +++ b/custom/notify-user.nix @@ -14,7 +14,7 @@ stdenv.mkDerivation { import System.Process (spawnProcess, waitForProcess) import System.Exit (exitWith, ExitCode(..)) - import Data.List (isPrefixOf, dropWhile, dropWhileEnd) + import Data.List (isPrefixOf, dropWhile, dropWhileEnd, init) import Data.Char (isSpace) import Control.Monad (forM_, void) @@ -25,7 +25,7 @@ stdenv.mkDerivation { main = do envFiles <- glob "/home/${user}/.dbus/session-bus/*" forM_ envFiles $ \envFile -> do - sessionAddr <- tail . snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile + sessionAddr <- unQuote . tail . snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> readFile envFile setEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr lines <- lines <$> getContents case lines of @@ -34,6 +34,9 @@ stdenv.mkDerivation { Notify.display_ $ Notify.appName "notify-${user}" <> Notify.summary summary <> Notify.body contents where trim = dropWhileEnd isSpace . dropWhile isSpace + unQuote ('\'':xs) = init xs + unQuote ('"':xs) = init xs + unQuote xs = xs ''; }; phases = [ "buildPhase" "installPhase" ]; buildPhase = '' -- cgit v1.2.3