all repos — char/flake @ c8ebe782d87af66a0528afd4cdfe59e115949b83

nixos flake

packages/deskflow/libs/libportal.nix (view raw)

 1{
 2  stdenv,
 3  lib,
 4  fetchFromGitHub,
 5  meson,
 6  ninja,
 7  pkg-config,
 8  gobject-introspection,
 9  vala,
10  gi-docgen,
11  glib,
12  gtk3,
13  gtk4,
14  libsForQt5,
15  qt6Packages,
16  variant ? null,
17}:
18
19assert
20  variant == null || variant == "gtk3" || variant == "gtk4" || variant == "qt5" || variant == "qt6";
21
22stdenv.mkDerivation rec {
23  pname = "libportal" + lib.optionalString (variant != null) "-${variant}";
24  version = "0.8.1";
25
26  outputs = [
27    "out"
28    "dev"
29  ] ++ lib.optional (variant != "qt5") "devdoc";
30
31  src = fetchFromGitHub {
32    owner = "flatpak";
33    repo = "libportal";
34    rev = version;
35    sha256 = "sha256-NAkD5pAQpmAtVxsFZt74PwURv+RbGBfqENIwyxEEUSc=";
36  };
37
38  depsBuildBuild = [
39    pkg-config
40  ];
41
42  nativeBuildInputs =
43    [
44      meson
45      ninja
46      pkg-config
47      gi-docgen
48    ]
49    ++ lib.optionals (variant != "qt5") [
50      gobject-introspection
51      vala
52    ];
53
54  propagatedBuildInputs =
55    [
56      glib
57    ]
58    ++ lib.optionals (variant == "gtk3") [
59      gtk3
60    ]
61    ++ lib.optionals (variant == "gtk4") [
62      gtk4
63    ]
64    ++ lib.optionals (variant == "qt5") [
65      libsForQt5.qtbase
66      libsForQt5.qtx11extras
67    ]
68    ++ lib.optionals (variant == "qt6") [
69      qt6Packages.qtbase
70    ];
71
72  mesonFlags = [
73    (lib.mesonEnable "backend-gtk3" (variant == "gtk3"))
74    (lib.mesonEnable "backend-gtk4" (variant == "gtk4"))
75    (lib.mesonEnable "backend-qt5" (variant == "qt5"))
76    (lib.mesonEnable "backend-qt6" (variant == "qt6"))
77    (lib.mesonBool "vapi" (variant != "qt5"))
78    (lib.mesonBool "introspection" (variant != "qt5"))
79    (lib.mesonBool "docs" (variant != "qt5")) # requires introspection=true
80  ];
81
82  postFixup = ''
83    # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back.
84    moveToOutput "share/doc" "$devdoc"
85  '';
86
87  # we don't have any binaries
88  dontWrapQtApps = true;
89
90  meta = with lib; {
91    description = "Flatpak portal library";
92    homepage = "https://github.com/flatpak/libportal";
93    license = licenses.lgpl3Plus;
94    maintainers = with maintainers; [ jtojnar ];
95    platforms = platforms.unix;
96  };
97}