nixpkgs/pkgs/by-name/rt/rtfm/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

91 lines
2.1 KiB
Nix

{ stdenv
, lib
, fetchFromGitHub
, crystal
, wrapGAppsHook4
, gobject-introspection
, desktopToDarwinBundle
, webkitgtk_6_0
, sqlite
, libadwaita
, gtk4
, pango
, substituteAll
}:
let
gtk4' = gtk4.override { x11Support = true; };
pango' = pango.override { withIntrospection = true; };
in
crystal.buildCrystalPackage rec {
pname = "rtfm";
version = "0.5.0";
src = fetchFromGitHub {
owner = "hugopl";
repo = "rtfm";
rev = "v${version}";
name = "rtfm";
hash = "sha256-+s7KXl3+j/BaneOBqVAMJJhmrG6xtcGaHhYnMvUfiVA=";
};
patches = [
# 1) fixed gi-crystal binding generator command
# 2) fixed docset generator command
# 3) added commands to build gschemas and update icon-cache
(substituteAll {
src = ./make.patch;
inherit crystal;
})
# added chmod +w for copied docs to prevent error:
# `Error opening file with mode 'wb': '.../style.css': Permission denied`
./enable-write-permissions.patch
];
postPatch = ''
substituteInPlace src/doc2dash/create_gtk_docset.cr \
--replace-fail 'basedir = Path.new("/usr/share/doc")' 'basedir = Path.new(ARGV[0]? || "gtk-docs")'
'';
shardsFile = ./shards.nix;
copyShardDeps = true;
nativeBuildInputs = [
wrapGAppsHook4
gobject-introspection
] ++ lib.optionals stdenv.hostPlatform.isDarwin [ desktopToDarwinBundle ];
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;
mainProgram = "rtfm";
maintainers = with maintainers; [ sund3RRR ];
};
}