nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 copyDesktopItems,
5 fetchFromGitHub,
6 makeDesktopItem,
7 pkg-config,
8 libpq,
9 cups,
10 libxml2,
11 qt6,
12}:
13
14stdenv.mkDerivation (finalAttrs: {
15 pname = "pgmodeler";
16 version = "1.2.2";
17
18 src = fetchFromGitHub {
19 owner = "pgmodeler";
20 repo = "pgmodeler";
21 rev = "v${finalAttrs.version}";
22 sha256 = "sha256-gDhH6b+8zFIsosdecUUkwAQMP1HME4EbJZsFyTzvGcE=";
23 };
24
25 nativeBuildInputs = [
26 pkg-config
27 qt6.qmake
28 qt6.wrapQtAppsHook
29 copyDesktopItems
30 ];
31
32 qmakeFlags = [
33 "pgmodeler.pro"
34 "CONFIG+=release"
35 ]
36 ++ lib.optionals stdenv.hostPlatform.isDarwin [
37 "PGSQL_INC=${lib.getDev libpq}/include"
38 "PGSQL_LIB=${lib.getLib libpq}/lib/libpq.dylib"
39 "XML_INC=${libxml2.dev}/include/libxml2"
40 "XML_LIB=${libxml2.out}/lib/libxml2.dylib"
41 "PREFIX=${placeholder "out"}/Applications/pgModeler.app/Contents"
42 ];
43
44 buildInputs = [
45 qt6.qtbase
46 qt6.qtsvg
47 libpq
48 ]
49 ++ lib.optionals stdenv.hostPlatform.isLinux [ qt6.qtwayland ]
50 ++ lib.optionals stdenv.hostPlatform.isDarwin [
51 cups
52 libxml2
53 ];
54
55 desktopItems = [
56 (makeDesktopItem {
57 name = "pgModeler";
58 exec = "pgmodeler";
59 icon = "pgmodeler";
60 desktopName = "PgModeler";
61 genericName = "PgModeler";
62 comment = finalAttrs.meta.description;
63 categories = [ "Development" ];
64 startupWMClass = "pgmodeler";
65 })
66 ];
67
68 postInstall = ''
69 install -Dm444 apps/pgmodeler/res/windows_ico.ico $out/share/icons/hicolor/256x256/apps/pgmodeler.ico
70 ''
71 + lib.optionalString stdenv.hostPlatform.isDarwin ''
72 mkdir -p $out/bin
73 for item in pgmodeler pgmodeler-{cli,se,ch}
74 do
75 ln -s $out/Applications/pgModeler.app/Contents/MacOS/$item $out/bin
76 done
77 '';
78
79 dontWrapQtApps = stdenv.hostPlatform.isDarwin;
80
81 meta = {
82 description = "Database modeling tool for PostgreSQL";
83 homepage = "https://pgmodeler.io/";
84 license = lib.licenses.gpl3;
85 maintainers = [ lib.maintainers.esclear ];
86 platforms = lib.platforms.unix;
87 };
88})