From 1ed7d0e6298f4466151f9b08df2d37ee77c44310 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sandro=20J=C3=A4ckel?= <sandro.jaeckel@gmail.com>
Date: Tue, 20 Oct 2020 17:01:09 +0200
Subject: [PATCH] gitAndTools.lab: wrap xdg-open to fix `lab mr browse`

---
 .../version-management/git-and-tools/lab/default.nix       | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pkgs/applications/version-management/git-and-tools/lab/default.nix b/pkgs/applications/version-management/git-and-tools/lab/default.nix
index 2413019ebc7b..3459f5099c97 100644
--- a/pkgs/applications/version-management/git-and-tools/lab/default.nix
+++ b/pkgs/applications/version-management/git-and-tools/lab/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, buildGoModule, fetchFromGitHub }:
+{ lib, buildGoModule, fetchFromGitHub, makeWrapper, xdg_utils }:
 
 buildGoModule rec {
   pname = "lab";
@@ -17,6 +17,8 @@ buildGoModule rec {
 
   doCheck = false;
 
+  buildInputs = [ makeWrapper ];
+
   buildFlagsArray = [ "-ldflags=-s -w -X main.version=${version}" ];
 
   postInstall = ''
@@ -24,9 +26,10 @@ buildGoModule rec {
     export LAB_CORE_HOST=a LAB_CORE_USER=b LAB_CORE_TOKEN=c
     $out/bin/lab completion bash > $out/share/bash-completion/completions/lab
     $out/bin/lab completion zsh > $out/share/zsh/site-functions/_lab
+    wrapProgram $out/bin/lab --prefix PATH ":" "${lib.makeBinPath [ xdg_utils ]}";
   '';
 
-  meta = with stdenv.lib; {
+  meta = with lib; {
     description = "Lab wraps Git or Hub, making it simple to clone, fork, and interact with repositories on GitLab";
     homepage = "https://zaquestion.github.io/lab";
     license = licenses.cc0;