about summary refs log tree commit diff
path: root/pkgs/applications/misc/junction
diff options
context:
space:
mode:
authorhqurve <hqurve@outlook.com>2022-11-03 20:30:31 -0400
committerhqurve <hqurve@outlook.com>2022-11-05 16:32:00 -0400
commit01b794ca75db6a964201c92659f2c04d159cf4a7 (patch)
treec6fbe3763beafb006b6791576f98687aedf3f084 /pkgs/applications/misc/junction
parent19bf0264bb4d732fe0a4c9ce664b3deb562aeb2e (diff)
junction: 1.5.0 -> 1.6
Diffstat (limited to 'pkgs/applications/misc/junction')
-rw-r--r--pkgs/applications/misc/junction/default.nix24
1 files changed, 20 insertions, 4 deletions
diff --git a/pkgs/applications/misc/junction/default.nix b/pkgs/applications/misc/junction/default.nix
index 34002c547162e..c1d3ff263c0d3 100644
--- a/pkgs/applications/misc/junction/default.nix
+++ b/pkgs/applications/misc/junction/default.nix
@@ -2,6 +2,7 @@
 , stdenv
 , fetchFromGitHub
 , appstream-glib
+, blueprint-compiler
 , desktop-file-utils
 , gobject-introspection
 , meson
@@ -16,17 +17,19 @@
 
 stdenv.mkDerivation rec {
   pname = "junction";
-  version = "1.5.0";
+  version = "1.6";
 
   src = fetchFromGitHub {
     owner = "sonnyp";
     repo = "junction";
     rev = "v${version}";
-    sha256 = "sha256-jS4SHh1BB8jk/4EP070X44C4n3GjyCz8ozgK8v5lbqc=";
+    sha256 = "sha256-95lKap0VKLxX5Vax2tK0cAcJ/XgQddoN46tXHo+MtYc=";
+    fetchSubmodules = true;
   };
 
   nativeBuildInputs = [
     appstream-glib
+    blueprint-compiler
     desktop-file-utils
     gobject-introspection
     meson
@@ -42,12 +45,25 @@ stdenv.mkDerivation rec {
     libportal-gtk4
   ];
 
+  postPatch = ''
+    # gjs uses the invocation name to add gresource files
+    # - https://gitlab.gnome.org/GNOME/gjs/-/blob/6aca7b50785fa1638f144b17060870d721e3f65a/modules/script/package.js#L159
+    # - https://gitlab.gnome.org/GNOME/gjs/-/blob/6aca7b50785fa1638f144b17060870d721e3f65a/modules/script/package.js#L37
+    # To work around this, we manually set the the name as done in foliate
+    # - https://github.com/NixOS/nixpkgs/blob/3bacde6273b09a21a8ccfba15586fb165078fb62/pkgs/applications/office/foliate/default.nix#L23
+    sed -i "1 a imports.package._findEffectiveEntryPointName = () => 're.sonny.Junction';" src/bin.js
+
+    # /usr/bin/env is not accessible in build environment
+    substituteInPlace troll/gjspack/bin/gjspack --replace "/usr/bin/env -S gjs" "${gjs}/bin/gjs"
+  '';
+
   postInstall = ''
-    # autoPatchShebangs does not like "/usr/bin/env -S gjs"
-    substituteInPlace $out/bin/re.sonny.Junction --replace "/usr/bin/env -S gjs" "/usr/bin/gjs"
+    # autoPatchShebangs does not like "/usr/bin/env -S <environment-setting> gjs -m"
+    sed -i "1s|.*|#!/usr/bin/gjs -m|" $out/bin/re.sonny.Junction
   '';
 
   meta = with lib; {
+    mainProgram = "re.sonny.Junction";
     description = "Choose the application to open files and links";
     homepage = "https://apps.gnome.org/en/app/re.sonny.Junction/";
     license = licenses.gpl3Plus;