From 6b374caa40dd3c5f23022f0ff092cd828e0418a8 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Thu, 21 Jul 2016 16:51:20 +0200 Subject: more lightweight notify-user --- custom/notify-user.nix | 29 ----------------------------- hel.nix | 10 +++++++++- 2 files changed, 9 insertions(+), 30 deletions(-) delete mode 100644 custom/notify-user.nix diff --git a/custom/notify-user.nix b/custom/notify-user.nix deleted file mode 100644 index ae8ea56c..00000000 --- a/custom/notify-user.nix +++ /dev/null @@ -1,29 +0,0 @@ -{ stdenv, writeTextFile -, ghcWithPackages -, user ? "gkleen" -, libnotify -}: - -stdenv.mkDerivation { - name = ''notify-${user}''; - src = writeTextFile { name = ''notify-${user}.hs''; text = '' - import Control.Shell - import System.FilePath.Glob (glob) - - import Data.List (isPrefixOf) - - main = shell_ $ do - (envFile:_) <- liftIO $ glob "/home/${user}/.dbus/session-bus/*-0" - sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> input envFile - env <- getShellEnv - withEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr $ run "${libnotify}/bin/notify-send" cmdline - ''; }; - phases = [ "buildPhase" "installPhase" ]; - buildPhase = '' - ${ghcWithPackages (p: with p; [ shellmate Glob ])}/bin/ghc -odir . -hidir . $src -o notify-${user} - ''; - installPhase = '' - mkdir -p $out/bin - install -m 755 notify-${user} $out/bin - ''; -} diff --git a/hel.nix b/hel.nix index f2147c3f..2a1b9736 100644 --- a/hel.nix +++ b/hel.nix @@ -254,7 +254,15 @@ program = "notify-gkleen"; setgid = true; setuid = true; - source = pkgs.callPackage ./custom/notify-user.nix { inherit (pkgs.haskellPackages) ghcWithPackages; user = "gkleen"; }; + source = pkgs.lib.writeTextFile { + name = "notify-gkleen"; + text = '' + #!${pkgs.zsh}/bin/zsh + + DBUS_ADDRESS=`grep "DBUS_SESSION_BUS_ADDRESS=" /home/gkleen/.dbus/session-bus/${"*"}-0 | cut -d "=" -f 2-` + exec env DBUS_SESSION_BUS_ADDRESS='${DBUS_ADDRESS} ${pkgs.libnotify}/notify-send '${(qq)@} + ''; + }; } ]; }; -- cgit v1.2.3