diff options
author | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-21 16:51:20 +0200 |
---|---|---|
committer | Gregor Kleen <pngwjpgh@users.noreply.github.com> | 2016-07-21 16:51:20 +0200 |
commit | 6b374caa40dd3c5f23022f0ff092cd828e0418a8 (patch) | |
tree | e3e3bb5d38a58691406f895600ad800ae7afe67e | |
parent | e8456f4cda4cf63c2e3564e540d2894492da1516 (diff) | |
download | nixos-6b374caa40dd3c5f23022f0ff092cd828e0418a8.tar nixos-6b374caa40dd3c5f23022f0ff092cd828e0418a8.tar.gz nixos-6b374caa40dd3c5f23022f0ff092cd828e0418a8.tar.bz2 nixos-6b374caa40dd3c5f23022f0ff092cd828e0418a8.tar.xz nixos-6b374caa40dd3c5f23022f0ff092cd828e0418a8.zip |
more lightweight notify-user
-rw-r--r-- | custom/notify-user.nix | 29 | ||||
-rw-r--r-- | hel.nix | 10 |
2 files changed, 9 insertions, 30 deletions
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 @@ | |||
1 | { stdenv, writeTextFile | ||
2 | , ghcWithPackages | ||
3 | , user ? "gkleen" | ||
4 | , libnotify | ||
5 | }: | ||
6 | |||
7 | stdenv.mkDerivation { | ||
8 | name = ''notify-${user}''; | ||
9 | src = writeTextFile { name = ''notify-${user}.hs''; text = '' | ||
10 | import Control.Shell | ||
11 | import System.FilePath.Glob (glob) | ||
12 | |||
13 | import Data.List (isPrefixOf) | ||
14 | |||
15 | main = shell_ $ do | ||
16 | (envFile:_) <- liftIO $ glob "/home/${user}/.dbus/session-bus/*-0" | ||
17 | sessionAddr <- snd . break (== '=') . head . filter ("DBUS_SESSION_BUS_ADDRESS=" `isPrefixOf`) . lines <$> input envFile | ||
18 | env <- getShellEnv | ||
19 | withEnv "DBUS_SESSION_BUS_ADDRESS" sessionAddr $ run "${libnotify}/bin/notify-send" cmdline | ||
20 | ''; }; | ||
21 | phases = [ "buildPhase" "installPhase" ]; | ||
22 | buildPhase = '' | ||
23 | ${ghcWithPackages (p: with p; [ shellmate Glob ])}/bin/ghc -odir . -hidir . $src -o notify-${user} | ||
24 | ''; | ||
25 | installPhase = '' | ||
26 | mkdir -p $out/bin | ||
27 | install -m 755 notify-${user} $out/bin | ||
28 | ''; | ||
29 | } | ||
@@ -254,7 +254,15 @@ | |||
254 | program = "notify-gkleen"; | 254 | program = "notify-gkleen"; |
255 | setgid = true; | 255 | setgid = true; |
256 | setuid = true; | 256 | setuid = true; |
257 | source = pkgs.callPackage ./custom/notify-user.nix { inherit (pkgs.haskellPackages) ghcWithPackages; user = "gkleen"; }; | 257 | source = pkgs.lib.writeTextFile { |
258 | name = "notify-gkleen"; | ||
259 | text = '' | ||
260 | #!${pkgs.zsh}/bin/zsh | ||
261 | |||
262 | DBUS_ADDRESS=`grep "DBUS_SESSION_BUS_ADDRESS=" /home/gkleen/.dbus/session-bus/${"*"}-0 | cut -d "=" -f 2-` | ||
263 | exec env DBUS_SESSION_BUS_ADDRESS='${DBUS_ADDRESS} ${pkgs.libnotify}/notify-send '${(qq)@} | ||
264 | ''; | ||
265 | }; | ||
258 | } | 266 | } |
259 | ]; | 267 | ]; |
260 | }; | 268 | }; |