2022-07-03 13:44:33 +02:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, fetchFromGitHub
|
|
|
|
, appstream-glib
|
2022-11-04 01:30:31 +01:00
|
|
|
, blueprint-compiler
|
2022-07-03 13:44:33 +02:00
|
|
|
, desktop-file-utils
|
|
|
|
, gobject-introspection
|
|
|
|
, meson
|
|
|
|
, ninja
|
|
|
|
, pkg-config
|
|
|
|
, wrapGAppsHook4
|
|
|
|
, gjs
|
|
|
|
, gtk4
|
|
|
|
, libadwaita
|
|
|
|
, libportal-gtk4
|
|
|
|
}:
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "junction";
|
2022-11-04 01:30:31 +01:00
|
|
|
version = "1.6";
|
2022-07-03 13:44:33 +02:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "sonnyp";
|
|
|
|
repo = "junction";
|
|
|
|
rev = "v${version}";
|
2022-11-04 01:30:31 +01:00
|
|
|
sha256 = "sha256-95lKap0VKLxX5Vax2tK0cAcJ/XgQddoN46tXHo+MtYc=";
|
|
|
|
fetchSubmodules = true;
|
2022-07-03 13:44:33 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
appstream-glib
|
2022-11-04 01:30:31 +01:00
|
|
|
blueprint-compiler
|
2022-07-03 13:44:33 +02:00
|
|
|
desktop-file-utils
|
|
|
|
gobject-introspection
|
|
|
|
meson
|
|
|
|
ninja
|
|
|
|
pkg-config
|
|
|
|
wrapGAppsHook4
|
|
|
|
];
|
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
gjs
|
|
|
|
gtk4
|
|
|
|
libadwaita
|
|
|
|
libportal-gtk4
|
|
|
|
];
|
|
|
|
|
2022-11-04 01:30:31 +01:00
|
|
|
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"
|
|
|
|
'';
|
|
|
|
|
2022-07-03 13:44:33 +02:00
|
|
|
postInstall = ''
|
2022-11-04 01:30:31 +01:00
|
|
|
# autoPatchShebangs does not like "/usr/bin/env -S <environment-setting> gjs -m"
|
|
|
|
sed -i "1s|.*|#!/usr/bin/gjs -m|" $out/bin/re.sonny.Junction
|
2022-07-03 13:44:33 +02:00
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
2022-11-04 01:30:31 +01:00
|
|
|
mainProgram = "re.sonny.Junction";
|
2022-07-03 13:44:33 +02:00
|
|
|
description = "Choose the application to open files and links";
|
|
|
|
homepage = "https://apps.gnome.org/en/app/re.sonny.Junction/";
|
|
|
|
license = licenses.gpl3Plus;
|
|
|
|
maintainers = with maintainers; [ hqurve ];
|
|
|
|
platforms = platforms.linux;
|
|
|
|
};
|
|
|
|
}
|