about summary refs log tree commit diff
path: root/fun
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-06-15T18·29+0100
committertazjin <mail@tazj.in>2020-06-15T18·39+0000
commitc26ee5a448b0b2f509ee704ebffaa665400a2216 (patch)
tree2bed4aa4faa80d8d9d7dd27ef2bafc361af52283 /fun
parent2237a51d10c7ffd30ca3ef08762212f271fee01e (diff)
feat(fun/uggc): Install desktop handler in Nix derivation r/969
This actually registers the desktop entry, so xdg-open etc. start
working:

tazjin@frog /depot> xdg-open 'uggcf://gjvggre.pbz/alnabgrpu/fgnghf/1272363652679524352'
Opening in existing browser session.

Change-Id: Ia754cb87470fce2f8d3340d1147f3f01b9914858
Reviewed-on: https://cl.tvl.fyi/c/depot/+/387
Reviewed-by: riking <rikingcoding@gmail.com>
Diffstat (limited to 'fun')
-rw-r--r--fun/uggc/default.nix29
-rw-r--r--fun/uggc/uggc.desktop2
2 files changed, 18 insertions, 13 deletions
diff --git a/fun/uggc/default.nix b/fun/uggc/default.nix
index 398e7b6ffe..49160071f5 100644
--- a/fun/uggc/default.nix
+++ b/fun/uggc/default.nix
@@ -1,14 +1,19 @@
-{ depot, ... }@args:
+{ depot, pkgs, ... }@args:
 
 let
-  gopkgs = depot.third_party.gopkgs;
-in
-depot.nix.buildGo.program {
-  name = "uggc";
-  srcs = [
-    ./main.go
-  ];
-  deps = [
-    gopkgs."github.com".pkg.browser.gopkg
-  ];
-}
+  inherit (pkgs) gopkgs;
+  uggc = depot.nix.buildGo.program {
+    name = "uggc";
+    srcs = [
+      ./main.go
+    ];
+    deps = [
+      gopkgs."github.com".pkg.browser.gopkg
+    ];
+  };
+in uggc.overrideAttrs(old: {
+  buildCommand = old.buildCommand + ''
+    install -D ${./uggc.desktop} $out/share/applications/uggc.desktop
+    sed "s|@out@|$out|g" -i $out/share/applications/uggc.desktop
+  '';
+})
diff --git a/fun/uggc/uggc.desktop b/fun/uggc/uggc.desktop
index 5203277f4a..c4eeff7f58 100644
--- a/fun/uggc/uggc.desktop
+++ b/fun/uggc/uggc.desktop
@@ -1,7 +1,7 @@
 [Desktop Entry]
 Type=Application
 Name=Rot13 URL Handler
-Exec=uggc %u
+Exec=@out@/bin/uggc
 StartupNotify=false
 MimeType=x-scheme-handler/uggc;
 MimeType=x-scheme-handler/uggcf;