nixpkgs/pkgs/applications/misc/klayout/default.nix
stuebinm ff1a94e523 treewide: add meta.mainProgram to packages with a single binary
The nixpkgs-unstable channel's programs.sqlite was used to identify
packages producing exactly one binary, and these automatically added
to their package definitions wherever possible.
2024-03-19 03:14:51 +01:00

70 lines
1.7 KiB
Nix

{ lib, mkDerivation, fetchFromGitHub
, python3, ruby, qtbase, qtmultimedia, qttools, qtxmlpatterns
, which, perl
}:
mkDerivation rec {
pname = "klayout";
version = "0.28.12";
src = fetchFromGitHub {
owner = "KLayout";
repo = "klayout";
rev = "v${version}";
hash = "sha256-QvEoXKJ9sH5WIarYPsYEWwoFwA/pZa2etegA+AD8rPo=";
};
postPatch = ''
substituteInPlace src/klayout.pri --replace "-Wno-reserved-user-defined-literal" ""
patchShebangs .
'';
nativeBuildInputs = [
which
perl
python3
ruby
];
buildInputs = [
qtbase
qtmultimedia
qttools
qtxmlpatterns
];
buildPhase = ''
runHook preBuild
mkdir -p $out/lib
./build.sh -qt5 -prefix $out/lib -option -j$NIX_BUILD_CORES
runHook postBuild
'';
postBuild = ''
mkdir $out/bin
mv $out/lib/klayout $out/bin/
install -Dm444 etc/klayout.desktop -t $out/share/applications
install -Dm444 etc/logo.png $out/share/icons/hicolor/256x256/apps/klayout.png
'';
env.NIX_CFLAGS_COMPILE = toString [ "-Wno-parentheses" ];
dontInstall = true; # Installation already happens as part of "build.sh"
# Fix: "gsiDeclQMessageLogger.cc:126:42: error: format not a string literal
# and no format arguments [-Werror=format-security]"
hardeningDisable = [ "format" ];
meta = with lib; {
description = "High performance layout viewer and editor with support for GDS and OASIS";
mainProgram = "klayout";
license = with licenses; [ gpl2Plus ];
homepage = "https://www.klayout.de/";
changelog = "https://www.klayout.de/development.html#${version}";
platforms = platforms.linux;
maintainers = with maintainers; [ knedlsepp ];
};
}