1{ lib, stdenv
2, fetchurl
3, substituteAll
4, nixosTests
5
6, docbook_xml_dtd_45
7, docbook_xsl
8, gettext
9, libxml2
10, libxslt
11, pkg-config
12, xmlto
13, meson
14, ninja
15
16, acl
17, appstream
18, breezy
19, binutils
20, bzip2
21, coreutils
22, cpio
23, curl
24, debugedit
25, elfutils
26, flatpak
27, gitMinimal
28, glib
29, glibcLocales
30, gnumake
31, gnupg
32, gnutar
33, json-glib
34, libcap
35, libsoup
36, libyaml
37, ostree
38, patch
39, rpm
40, unzip
41, attr
42}:
43
44stdenv.mkDerivation (finalAttrs: {
45 pname = "flatpak-builder";
46 version = "1.4.4";
47
48 outputs = [ "out" "doc" "man" "installedTests" ];
49
50 # fetchFromGitHub fetches an archive which does not contain the full source (https://github.com/flatpak/flatpak-builder/issues/558)
51 src = fetchurl {
52 url = "https://github.com/flatpak/flatpak-builder/releases/download/${finalAttrs.version}/flatpak-builder-${finalAttrs.version}.tar.xz";
53 hash = "sha256-3CcVk5S6qiy1I/Uvh0Ry/1DRYZgyMyZMoqIuhQdB7Ho=";
54 };
55
56 patches = [
57 # patch taken from gtk_doc
58 ./respect-xml-catalog-files-var.patch
59
60 # Hardcode paths
61 (substituteAll {
62 src = ./fix-paths.patch;
63 brz = "${breezy}/bin/brz";
64 cp = "${coreutils}/bin/cp";
65 patch = "${patch}/bin/patch";
66 tar = "${gnutar}/bin/tar";
67 unzip = "${unzip}/bin/unzip";
68 rpm2cpio = "${rpm}/bin/rpm2cpio";
69 cpio = "${cpio}/bin/cpio";
70 git = "${gitMinimal}/bin/git";
71 rofilesfuse = "${ostree}/bin/rofiles-fuse";
72 strip = "${binutils}/bin/strip";
73 eustrip = "${elfutils}/bin/eu-strip";
74 euelfcompress = "${elfutils}/bin/eu-elfcompress";
75 })
76
77 (substituteAll {
78 src = ./fix-test-paths.patch;
79 inherit glibcLocales;
80 })
81 ./fix-test-prefix.patch
82 ];
83
84 nativeBuildInputs = [
85 meson
86 ninja
87 docbook_xml_dtd_45
88 docbook_xsl
89 gettext
90 libxml2
91 libxslt
92 pkg-config
93 xmlto
94 ];
95
96 buildInputs = [
97 acl
98 appstream
99 bzip2
100 curl
101 debugedit
102 elfutils
103 flatpak
104 glib
105 json-glib
106 libcap
107 libsoup
108 libxml2
109 libyaml
110 ostree
111 ];
112
113 mesonFlags = [
114 "-Dinstalled_tests=true"
115 "-Dinstalled_test_prefix=${placeholder "installedTests"}"
116 ];
117
118 # Some scripts used by tests need to use shebangs that are available in Flatpak runtimes.
119 dontPatchShebangs = true;
120
121 enableParallelBuilding = true;
122
123 # Installed tests
124 postFixup = let
125 installed_testdir = "${placeholder "installedTests"}/libexec/installed-tests/flatpak-builder";
126 in ''
127 for file in ${installed_testdir}/{test-builder.sh,test-builder-python.sh,test-builder-deprecated.sh}; do
128 patchShebangs $file
129 done
130 '';
131
132 passthru = {
133 installedTestsDependencies = [
134 gnupg
135 ostree
136 gnumake
137 attr
138 libxml2
139 appstream
140 ];
141
142 tests = {
143 installedTests = nixosTests.installed-tests.flatpak-builder;
144 };
145 };
146
147 meta = with lib; {
148 description = "Tool to build flatpaks from source";
149 mainProgram = "flatpak-builder";
150 homepage = "https://github.com/flatpak/flatpak-builder";
151 license = licenses.lgpl21Plus;
152 maintainers = with maintainers; [ arthsmn ];
153 platforms = platforms.linux;
154 };
155})