Skip to content

Commit

Permalink
biblioteca: init at 1.5 (#357841)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aleksanaa authored Nov 23, 2024
2 parents ccd7474 + 4c1bfb8 commit fc094ec
Show file tree
Hide file tree
Showing 3 changed files with 146 additions and 0 deletions.
38 changes: 38 additions & 0 deletions pkgs/by-name/bi/biblioteca/dont-use-flatpak.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From 46a92740dde0372fbe3e75a9a334ea79b6f53da1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <[email protected]>
Date: Fri, 8 Nov 2024 00:04:01 +0100
Subject: [PATCH] Don't check if running under Flatpak

---
src/bin.js | 8 --------
1 file changed, 8 deletions(-)

diff --git a/src/bin.js b/src/bin.js
index 5dcc3eb..362ce67 100755
--- a/src/bin.js
+++ b/src/bin.js
@@ -3,7 +3,6 @@
import { exit, programArgs } from "system";
import GLib from "gi://GLib";
import { setConsoleLogDomain } from "console";
-import Xdp from "gi://Xdp";

// eslint-disable-next-line no-restricted-globals
imports.package.init({
@@ -16,13 +15,6 @@ imports.package.init({
setConsoleLogDomain(pkg.name);
GLib.set_application_name("Biblioteca");

-if (!Xdp.Portal.running_under_flatpak()) {
- console.error(
- "Flatpak required\nBiblioteca is only meant to be run sandboxed in a specific target environment.\nBypassing this will exposes users to arbitrary code breakage.",
- );
- exit(1);
-}
-
globalThis.__DEV__ = pkg.name.endsWith(".Devel");
if (__DEV__) {
pkg.sourcedir = "@sourcedir@";
--
2.47.0

104 changes: 104 additions & 0 deletions pkgs/by-name/bi/biblioteca/package.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
{
stdenv,
lib,
fetchFromGitHub,
meson,
ninja,
desktop-file-utils,
glib,
gjs,
blueprint-compiler,
pkg-config,
gtk4,
gobject-introspection,
libadwaita,
webkitgtk,
coreutils,
makeShellWrapper,
wrapGAppsHook4,
glib-networking,
symlinkJoin,
extraDocsPackage ? [ ],
}:

stdenv.mkDerivation (finalAttrs: {
pname = "biblioteca";
version = "1.5";

src = fetchFromGitHub {
owner = "workbenchdev";
repo = "Biblioteca";
rev = "refs/tags/v${finalAttrs.version}";
fetchSubmodules = true;
hash = "sha256-zrrI3u4ukGN6eb/eK/aZG4gi/xtXciyRS+JX9Js9KEw=";
};

patches = [
./dont-use-flatpak.patch # From https://gitlab.archlinux.org/archlinux/packaging/packages/biblioteca/-/blob/main/biblioteca-no-flatpak.patch?ref_type=heads
];

nativeBuildInputs = [
meson
ninja
desktop-file-utils
makeShellWrapper
gjs
wrapGAppsHook4
pkg-config
];

buildInputs = [
glib
gtk4
gobject-introspection
libadwaita
webkitgtk
glib-networking
];

docPath = symlinkJoin {
name = "biblioteca-docs";
paths = [
gtk4.devdoc
glib.devdoc
libadwaita.devdoc
webkitgtk.devdoc
gobject-introspection.devdoc
] ++ extraDocsPackage;
};

postPatch = ''
substituteInPlace src/meson.build \
--replace-fail "/app/bin/blueprint-compiler" "${lib.getExe blueprint-compiler}" \
patchShebangs .
substituteInPlace build-aux/build-index.js \
--replace-fail "/usr/bin/env -S gjs -m" "${coreutils}/bin/env -S ${gjs}/bin/gjs -m" \
--replace-fail "/app/share/doc" "${finalAttrs.docPath}/share/doc"
substituteInPlace src/Shortcuts.js \
--replace-fail "/app/share/doc" "${finalAttrs.docPath}/share/doc"
substituteInPlace src/window.blp \
--replace-fail "/app/share/doc" "${finalAttrs.docPath}/share/doc"
substituteInPlace src/window.js \
--replace-fail "/app/share/doc" "${finalAttrs.docPath}/share/doc"
'';

postInstall = ''
mv $out/bin/app.drey.Biblioteca $out/share/app.drey.Biblioteca/app.drey.Biblioteca
substituteInPlace $out/bin/biblioteca \
--replace-fail app.drey.Biblioteca $out/share/app.drey.Biblioteca/app.drey.Biblioteca
'';

doCheck = true;

meta = {
homepage = "https://apps.gnome.org/Biblioteca/";
platforms = lib.platforms.linux;
maintainers = with lib.maintainers; [ bot-wxt1221 ];
license = lib.licenses.gpl3Only;
description = "Documentation viewer for GNOME";
mainProgram = "biblioteca";
};
})
4 changes: 4 additions & 0 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19143,4 +19143,8 @@ with pkgs;
tree-from-tags = callPackage ../by-name/tr/tree-from-tags/package.nix {
ruby = ruby_3_1;
};

biblioteca = callPackage ../by-name/bi/biblioteca/package.nix {
webkitgtk = webkitgtk_6_0;
};
}

0 comments on commit fc094ec

Please sign in to comment.