Skip to content

Commit 78dd396

Browse files
authored
conky: 1.19.6 -> 1.22.1, fix cross and docs, and modernize (#400497)
2 parents a4ee497 + cefebce commit 78dd396

File tree

1 file changed

+76
-81
lines changed

1 file changed

+76
-81
lines changed

pkgs/os-specific/linux/conky/default.nix

Lines changed: 76 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,26 @@
33
lib,
44
stdenv,
55
fetchFromGitHub,
6+
fetchpatch,
67
pkg-config,
78
cmake,
89

910
# dependencies
1011
glib,
1112
libXinerama,
1213
catch2,
14+
gperf,
1315

1416
# lib.optional features without extra dependencies
1517
mpdSupport ? true,
1618
ibmSupport ? true, # IBM/Lenovo notebooks
1719

1820
# lib.optional features with extra dependencies
1921

20-
# ouch, this is ugly, but this gives the man page
2122
docsSupport ? true,
22-
docbook2x,
23-
libxslt ? null,
24-
man ? null,
25-
less ? null,
26-
docbook_xsl ? null,
27-
docbook_xml_dtd_44 ? null,
23+
buildPackages,
24+
pandoc,
25+
python3,
2826

2927
ncursesSupport ? true,
3028
ncurses ? null,
@@ -59,22 +57,16 @@
5957
curlSupport ? true,
6058
curl ? null,
6159
rssSupport ? curlSupport,
62-
weatherMetarSupport ? curlSupport,
63-
weatherXoapSupport ? curlSupport,
6460
journalSupport ? true,
6561
systemd ? null,
6662
libxml2 ? null,
63+
64+
extrasSupport ? true,
65+
66+
versionCheckHook,
6767
}:
6868

69-
assert
70-
docsSupport
71-
->
72-
docbook2x != null
73-
&& libxslt != null
74-
&& man != null
75-
&& less != null
76-
&& docbook_xsl != null
77-
&& docbook_xml_dtd_44 != null;
69+
assert docsSupport -> pandoc != null && python3 != null;
7870

7971
assert ncursesSupport -> ncurses != null;
8072

@@ -91,54 +83,55 @@ assert pulseSupport -> libpulseaudio != null;
9183

9284
assert curlSupport -> curl != null;
9385
assert rssSupport -> curlSupport && libxml2 != null;
94-
assert weatherMetarSupport -> curlSupport;
95-
assert weatherXoapSupport -> curlSupport && libxml2 != null;
9686
assert journalSupport -> systemd != null;
9787

98-
stdenv.mkDerivation rec {
88+
assert extrasSupport -> python3 != null;
89+
90+
stdenv.mkDerivation (finalAttrs: {
9991
pname = "conky";
100-
version = "1.19.6";
92+
version = "1.22.1";
10193

10294
src = fetchFromGitHub {
10395
owner = "brndnmtthws";
10496
repo = "conky";
105-
rev = "v${version}";
106-
hash = "sha256-L8YSbdk+qQl17L4IRajFD/AEWRXb2w7xH9sM9qPGrQo=";
97+
tag = "v${finalAttrs.version}";
98+
hash = "sha256-tEJQWZBaiX/bONPZEuGcvbGidktcvxUZtLvcGjz71Lk=";
10799
};
108100

109-
postPatch =
110-
lib.optionalString docsSupport ''
111-
substituteInPlace cmake/Conky.cmake --replace "# set(RELEASE true)" "set(RELEASE true)"
112-
113-
cp ${catch2}/include/catch2/catch.hpp tests/catch2/catch.hpp
114-
''
115-
+ lib.optionalString waylandSupport ''
116-
substituteInPlace src/CMakeLists.txt \
117-
--replace 'COMMAND ''${Wayland_SCANNER}' 'COMMAND wayland-scanner'
118-
'';
119-
120-
env = {
121-
# For some reason -Werror is on by default, causing the project to fail compilation.
122-
NIX_CFLAGS_COMPILE = "-Wno-error";
123-
NIX_LDFLAGS = "-lgcc_s";
124-
};
101+
patches = [
102+
# Upstream patch to install extra syntax files, remove after next release
103+
(fetchpatch {
104+
name = "install-extra-syntax-files";
105+
url = "https://github.com/brndnmtthws/conky/commit/c67d8c27d1d091968a98ee49b313935eb7ea67fd.patch";
106+
hash = "sha256-NaQlQm+7iJWtdKYErTak5CPLNUBlsWb7sECNg0i3fWY=";
107+
})
108+
];
109+
110+
# pkg-config doesn't detect wayland-scanner in cross-compilation for some reason
111+
postPatch = ''
112+
substituteInPlace cmake/ConkyPlatformChecks.cmake \
113+
--replace-fail "pkg_get_variable(Wayland_SCANNER wayland-scanner wayland_scanner)" "set(Wayland_SCANNER ${lib.getExe buildPackages.wayland-scanner})"
114+
'';
115+
116+
strictDeps = true;
125117

126118
nativeBuildInputs =
127119
[
128120
cmake
129121
pkg-config
122+
gperf
130123
]
131-
++ lib.optionals docsSupport [
132-
docbook2x
133-
docbook_xsl
134-
docbook_xml_dtd_44
135-
libxslt
136-
man
137-
less
138-
]
139-
++ lib.optional waylandSupport wayland-scanner
124+
++ lib.optional docsSupport pandoc
125+
++ lib.optional (docsSupport || extrasSupport) (
126+
# Use buildPackages to work around https://github.com/NixOS/nixpkgs/issues/305858
127+
buildPackages.python3.withPackages (ps: [
128+
ps.jinja2
129+
ps.pyyaml
130+
])
131+
)
140132
++ lib.optional luaImlib2Support toluapp
141133
++ lib.optional luaCairoSupport toluapp;
134+
142135
buildInputs =
143136
[
144137
glib
@@ -166,46 +159,48 @@ stdenv.mkDerivation rec {
166159
++ lib.optional wirelessSupport wirelesstools
167160
++ lib.optional curlSupport curl
168161
++ lib.optional rssSupport libxml2
169-
++ lib.optional weatherXoapSupport libxml2
170162
++ lib.optional nvidiaSupport libXNVCtrl
171163
++ lib.optional pulseSupport libpulseaudio
172164
++ lib.optional journalSupport systemd;
173165

174-
cmakeFlags =
175-
[ ]
176-
++ lib.optional docsSupport "-DMAINTAINER_MODE=ON"
177-
++ lib.optional curlSupport "-DBUILD_CURL=ON"
178-
++ lib.optional (!ibmSupport) "-DBUILD_IBM=OFF"
179-
++ lib.optional imlib2Support "-DBUILD_IMLIB2=ON"
180-
++ lib.optional luaCairoSupport "-DBUILD_LUA_CAIRO=ON"
181-
++ lib.optional luaImlib2Support "-DBUILD_LUA_IMLIB2=ON"
182-
++ lib.optional (!mpdSupport) "-DBUILD_MPD=OFF"
183-
++ lib.optional (!ncursesSupport) "-DBUILD_NCURSES=OFF"
184-
++ lib.optional rssSupport "-DBUILD_RSS=ON"
185-
++ lib.optional (!x11Support) "-DBUILD_X11=OFF"
186-
++ lib.optional waylandSupport "-DBUILD_WAYLAND=ON"
187-
++ lib.optional xdamageSupport "-DBUILD_XDAMAGE=ON"
188-
++ lib.optional doubleBufferSupport "-DBUILD_XDBE=ON"
189-
++ lib.optional weatherMetarSupport "-DBUILD_WEATHER_METAR=ON"
190-
++ lib.optional weatherXoapSupport "-DBUILD_WEATHER_XOAP=ON"
191-
++ lib.optional wirelessSupport "-DBUILD_WLAN=ON"
192-
++ lib.optional nvidiaSupport "-DBUILD_NVIDIA=ON"
193-
++ lib.optional pulseSupport "-DBUILD_PULSEAUDIO=ON"
194-
++ lib.optional journalSupport "-DBUILD_JOURNAL=ON";
195-
196-
# `make -f src/CMakeFiles/conky.dir/build.make src/CMakeFiles/conky.dir/conky.cc.o`:
197-
# src/conky.cc:137:23: fatal error: defconfig.h: No such file or directory
198-
enableParallelBuilding = false;
166+
cmakeFlags = [
167+
(lib.cmakeBool "REPRODUCIBLE_BUILD" true)
168+
(lib.cmakeBool "RELEASE" true)
169+
(lib.cmakeBool "BUILD_TESTING" finalAttrs.finalPackage.doCheck)
170+
(lib.cmakeBool "BUILD_EXTRAS" extrasSupport)
171+
(lib.cmakeBool "BUILD_DOCS" docsSupport)
172+
(lib.cmakeBool "BUILD_CURL" curlSupport)
173+
(lib.cmakeBool "BUILD_IBM" ibmSupport)
174+
(lib.cmakeBool "BUILD_IMLIB2" imlib2Support)
175+
(lib.cmakeBool "BUILD_LUA_CAIRO" luaCairoSupport)
176+
(lib.cmakeBool "BUILD_LUA_IMLIB2" luaImlib2Support)
177+
(lib.cmakeBool "BUILD_MPD" mpdSupport)
178+
(lib.cmakeBool "BUILD_NCURSES" ncursesSupport)
179+
(lib.cmakeBool "BUILD_RSS" rssSupport)
180+
(lib.cmakeBool "BUILD_X11" x11Support)
181+
(lib.cmakeBool "BUILD_WAYLAND" waylandSupport)
182+
(lib.cmakeBool "BUILD_XDAMAGE" xdamageSupport)
183+
(lib.cmakeBool "BUILD_XDBE" doubleBufferSupport)
184+
(lib.cmakeBool "BUILD_WLAN" wirelessSupport)
185+
(lib.cmakeBool "BUILD_NVIDIA" nvidiaSupport)
186+
(lib.cmakeBool "BUILD_PULSEAUDIO" pulseSupport)
187+
(lib.cmakeBool "BUILD_JOURNAL" journalSupport)
188+
(lib.cmakeFeature "CMAKE_INSTALL_DATAROOTDIR" "${placeholder "out"}/share")
189+
];
199190

200191
doCheck = true;
201192

202-
meta = with lib; {
193+
nativeInstallCheckInputs = [ versionCheckHook ];
194+
versionCheckProgramArg = "--version";
195+
doInstallCheck = true;
196+
197+
meta = {
203198
homepage = "https://conky.cc";
204-
changelog = "https://github.com/brndnmtthws/conky/releases/tag/v${version}";
199+
changelog = "https://github.com/brndnmtthws/conky/releases/tag/${finalAttrs.src.tag}";
205200
description = "Advanced, highly configurable system monitor based on torsmo";
206201
mainProgram = "conky";
207-
maintainers = [ maintainers.guibert ];
208-
license = licenses.gpl3Plus;
209-
platforms = platforms.linux;
202+
maintainers = [ lib.maintainers.guibert ];
203+
license = lib.licenses.gpl3Plus;
204+
platforms = lib.platforms.linux;
210205
};
211-
}
206+
})

0 commit comments

Comments
 (0)