2023-08-04 22:07:22 +00:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
|
|
|
, fetchFromGitHub
|
|
|
|
, crystal
|
|
|
|
, wrapGAppsHook4
|
|
|
|
, gobject-introspection
|
|
|
|
, desktopToDarwinBundle
|
|
|
|
, webkitgtk_6_0
|
|
|
|
, sqlite
|
|
|
|
, libadwaita
|
|
|
|
, gtk4
|
|
|
|
, pango
|
2024-04-21 15:54:59 +00:00
|
|
|
, substituteAll
|
2023-08-04 22:07:22 +00:00
|
|
|
}:
|
|
|
|
let
|
|
|
|
gtk4' = gtk4.override { x11Support = true; };
|
|
|
|
pango' = pango.override { withIntrospection = true; };
|
|
|
|
in
|
|
|
|
crystal.buildCrystalPackage rec {
|
|
|
|
pname = "rtfm";
|
2024-07-01 15:47:52 +00:00
|
|
|
version = "0.5.0";
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "hugopl";
|
|
|
|
repo = "rtfm";
|
|
|
|
rev = "v${version}";
|
|
|
|
name = "rtfm";
|
2024-07-01 15:47:52 +00:00
|
|
|
hash = "sha256-+s7KXl3+j/BaneOBqVAMJJhmrG6xtcGaHhYnMvUfiVA=";
|
2023-08-04 22:07:22 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
patches = [
|
|
|
|
# 1) fixed gi-crystal binding generator command
|
2024-04-21 15:54:59 +00:00
|
|
|
# 2) fixed docset generator command
|
2023-08-04 22:07:22 +00:00
|
|
|
# 3) added commands to build gschemas and update icon-cache
|
2024-04-21 15:54:59 +00:00
|
|
|
(substituteAll {
|
|
|
|
src = ./make.patch;
|
|
|
|
inherit crystal;
|
|
|
|
})
|
2023-08-04 22:07:22 +00:00
|
|
|
# added chmod +w for copied docs to prevent error:
|
|
|
|
# `Error opening file with mode 'wb': '.../style.css': Permission denied`
|
2024-04-21 15:54:59 +00:00
|
|
|
./enable-write-permissions.patch
|
2023-08-04 22:07:22 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
2024-04-21 15:54:59 +00:00
|
|
|
substituteInPlace src/doc2dash/create_gtk_docset.cr \
|
|
|
|
--replace-fail 'basedir = Path.new("/usr/share/doc")' 'basedir = Path.new(ARGV[0]? || "gtk-docs")'
|
2023-08-04 22:07:22 +00:00
|
|
|
'';
|
|
|
|
|
|
|
|
shardsFile = ./shards.nix;
|
2024-04-21 15:54:59 +00:00
|
|
|
copyShardDeps = true;
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
wrapGAppsHook4
|
|
|
|
gobject-introspection
|
2024-01-02 11:29:13 +00:00
|
|
|
] ++ lib.optionals stdenv.isDarwin [ desktopToDarwinBundle ];
|
2023-08-04 22:07:22 +00:00
|
|
|
|
|
|
|
buildInputs = [
|
|
|
|
webkitgtk_6_0
|
|
|
|
sqlite
|
|
|
|
libadwaita
|
|
|
|
gtk4'
|
|
|
|
pango'
|
|
|
|
];
|
|
|
|
|
|
|
|
buildTargets = [ "configure" "rtfm" "docsets" ];
|
|
|
|
|
|
|
|
preBuild = ''
|
|
|
|
mkdir gtk-doc/
|
|
|
|
|
|
|
|
for file in "${gtk4'.devdoc}"/share/doc/*; do
|
|
|
|
ln -s "$file" "gtk-doc/$(basename "$file")"
|
|
|
|
done
|
|
|
|
|
|
|
|
for file in "${pango'.devdoc}"/share/doc/*; do
|
|
|
|
ln -s "$file" "gtk-doc/$(basename "$file")"
|
|
|
|
done
|
|
|
|
|
|
|
|
for file in "${libadwaita.devdoc}"/share/doc/*; do
|
|
|
|
ln -s "$file" "gtk-doc/$(basename "$file")"
|
|
|
|
done
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Dash/docset reader with built in documentation for Crystal and GTK APIs";
|
|
|
|
homepage = "https://github.com/hugopl/rtfm/";
|
|
|
|
license = licenses.mit;
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "rtfm";
|
2023-08-04 22:07:22 +00:00
|
|
|
maintainers = with maintainers; [ sund3RRR ];
|
|
|
|
};
|
|
|
|
}
|