feat(fun/uggc): Install desktop handler in Nix derivation

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>
This commit is contained in:
Vincent Ambo 2020-06-15 19:29:19 +01:00 committed by tazjin
parent 2237a51d10
commit c26ee5a448
3 changed files with 21 additions and 15 deletions

View file

@ -1,14 +1,19 @@
{ depot, ... }@args: { depot, pkgs, ... }@args:
let let
gopkgs = depot.third_party.gopkgs; inherit (pkgs) gopkgs;
in uggc = depot.nix.buildGo.program {
depot.nix.buildGo.program { name = "uggc";
name = "uggc"; srcs = [
srcs = [ ./main.go
./main.go ];
]; deps = [
deps = [ gopkgs."github.com".pkg.browser.gopkg
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
'';
})

View file

@ -1,7 +1,7 @@
[Desktop Entry] [Desktop Entry]
Type=Application Type=Application
Name=Rot13 URL Handler Name=Rot13 URL Handler
Exec=uggc %u Exec=@out@/bin/uggc
StartupNotify=false StartupNotify=false
MimeType=x-scheme-handler/uggc; MimeType=x-scheme-handler/uggc;
MimeType=x-scheme-handler/uggcf; MimeType=x-scheme-handler/uggcf;

View file

@ -189,9 +189,10 @@ in depot.lib.fix(self: {
environment.systemPackages = environment.systemPackages =
# programs from the depot # programs from the depot
(with depot; [ (with depot; [
fun.idual.script
lieer
frogEmacs frogEmacs
fun.idual.script
fun.uggc
lieer
ops.kontemplate ops.kontemplate
third_party.ffmpeg third_party.ffmpeg
third_party.git third_party.git