nixpkgs-suyu/pkgs/applications/misc/gpsbabel/gui.nix
Profpatsch 4a7f99d55d treewide: with stdenv.lib; in meta -> with lib;
Part of: https://github.com/NixOS/nixpkgs/issues/108938

meta = with stdenv.lib;

is a widely used pattern. We want to slowly remove
the `stdenv.lib` indirection and encourage people
to use `lib` directly. Thus let’s start with the meta
field.

This used a rewriting script to mostly automatically
replace all occurances of this pattern, and add the
`lib` argument to the package header if it doesn’t
exist yet.

The script in its current form is available at
https://cs.tvl.fyi/depot@2f807d7f141068d2d60676a89213eaa5353ca6e0/-/blob/users/Profpatsch/nixpkgs-rewriter/default.nix
2021-01-11 10:38:22 +01:00

49 lines
1.6 KiB
Nix

{ lib, stdenv, mkDerivation, qmake, qttools, qtwebkit, qttranslations, gpsbabel }:
mkDerivation {
pname = "gpsbabel-gui";
inherit (gpsbabel) src version;
sourceRoot = "source/gui";
nativeBuildInputs = [ qmake qttools ];
buildInputs = [ qtwebkit ];
postPatch = ''
substituteInPlace mainwindow.cc \
--replace "QApplication::applicationDirPath() + \"/" "\"" \
--replace "QApplication::applicationDirPath() + '/' + " "" \
--replace "translator.load(full_filename)" "translator.load(filename)" \
--replace "gpsbabelfe_%1.qm" "$out/share/gpsbabel/translations/gpsbabelfe_%1.qm" \
--replace "gpsbabel_%1.qm" "$out/share/gpsbabel/translations/gpsbabel_%1.qm" \
--replace "qt_%1.qm" "${qttranslations}/translations/qt_%1.qm"
substituteInPlace formatload.cc \
--replace "QApplication::applicationDirPath() + \"/" "\""
substituteInPlace gpsbabel.desktop \
--replace "gpsbabelfe-bin" "gpsbabelfe"
'';
preConfigure = ''
lrelease *.ts coretool/*.ts
'';
qtWrapperArgs = [
"--prefix PATH : ${stdenv.lib.makeBinPath [ gpsbabel ]}"
];
postInstall = ''
install -Dm755 objects/gpsbabelfe -t $out/bin
install -Dm644 gpsbabel.desktop -t $out/share/applications
install -Dm644 images/appicon.png $out/share/icons/hicolor/512x512/apps/gpsbabel.png
install -Dm644 *.qm coretool/*.qm -t $out/share/gpsbabel/translations
'';
meta = with lib; {
description = "Qt-based GUI for gpsbabel";
homepage = "http://www.gpsbabel.org/";
license = licenses.gpl2;
maintainers = with maintainers; [ sikmir ];
platforms = with platforms; linux;
};
}