Skip to content

Commit cefebce

Browse files
committed
conky: fix cross and docs, update derivation to match upstream settings and recommendations
drop WEATHER flags that were removed upstream brndnmtthws/conky#1245 conky: fix doc build This also removes the MAINTAINER_MODE flag as per brndnmtthws/conky#2131 (comment) #371064 conky: add extrasSupport conky: enable parallel building Probably fixed in brndnmtthws/conky#1207 conky: enable reproducible build #371064 conky: fix tests As per #371064 conky: use lib.cmakeBool conky: remove wayland-scanner hack conky: remove RELEASE hack conky: move extra outputs to output conky: fix cross conky: remove redundant NIX_CFLAGS_COMPILE conky: remove redundant NIX_LDFLAGS
1 parent 59575cf commit cefebce

File tree

1 file changed

+67
-76
lines changed

1 file changed

+67
-76
lines changed

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

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

@@ -18,14 +19,10 @@
1819

1920
# lib.optional features with extra dependencies
2021

21-
# ouch, this is ugly, but this gives the man page
2222
docsSupport ? true,
23-
docbook2x,
24-
libxslt ? null,
25-
man ? null,
26-
less ? null,
27-
docbook_xsl ? null,
28-
docbook_xml_dtd_44 ? null,
23+
buildPackages,
24+
pandoc,
25+
python3,
2926

3027
ncursesSupport ? true,
3128
ncurses ? null,
@@ -60,22 +57,16 @@
6057
curlSupport ? true,
6158
curl ? null,
6259
rssSupport ? curlSupport,
63-
weatherMetarSupport ? curlSupport,
64-
weatherXoapSupport ? curlSupport,
6560
journalSupport ? true,
6661
systemd ? null,
6762
libxml2 ? null,
63+
64+
extrasSupport ? true,
65+
66+
versionCheckHook,
6867
}:
6968

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

8071
assert ncursesSupport -> ncurses != null;
8172

@@ -92,10 +83,10 @@ assert pulseSupport -> libpulseaudio != null;
9283

9384
assert curlSupport -> curl != null;
9485
assert rssSupport -> curlSupport && libxml2 != null;
95-
assert weatherMetarSupport -> curlSupport;
96-
assert weatherXoapSupport -> curlSupport && libxml2 != null;
9786
assert journalSupport -> systemd != null;
9887

88+
assert extrasSupport -> python3 != null;
89+
9990
stdenv.mkDerivation (finalAttrs: {
10091
pname = "conky";
10192
version = "1.22.1";
@@ -107,45 +98,44 @@ stdenv.mkDerivation (finalAttrs: {
10798
hash = "sha256-tEJQWZBaiX/bONPZEuGcvbGidktcvxUZtLvcGjz71Lk=";
10899
};
109100

110-
postPatch =
111-
lib.optionalString docsSupport ''
112-
substituteInPlace cmake/Conky.cmake --replace-fail "# set(RELEASE true)" "set(RELEASE true)"
113-
114-
cp ${catch2}/include/catch2/catch.hpp tests/catch2/catch.hpp
115-
''
116-
+ lib.optionalString waylandSupport ''
117-
substituteInPlace src/CMakeLists.txt \
118-
--replace-fail 'COMMAND ''${Wayland_SCANNER}' 'COMMAND wayland-scanner'
119-
'';
120-
121-
env = {
122-
# For some reason -Werror is on by default, causing the project to fail compilation.
123-
NIX_CFLAGS_COMPILE = "-Wno-error";
124-
NIX_LDFLAGS = "-lgcc_s";
125-
};
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;
126117

127118
nativeBuildInputs =
128119
[
129120
cmake
130121
pkg-config
122+
gperf
131123
]
132-
++ lib.optionals docsSupport [
133-
docbook2x
134-
docbook_xsl
135-
docbook_xml_dtd_44
136-
libxslt
137-
man
138-
less
139-
]
140-
++ 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+
)
141132
++ lib.optional luaImlib2Support toluapp
142133
++ lib.optional luaCairoSupport toluapp;
143134

144135
buildInputs =
145136
[
146137
glib
147138
libXinerama
148-
gperf
149139
]
150140
++ lib.optional ncursesSupport ncurses
151141
++ lib.optionals x11Support [
@@ -169,43 +159,44 @@ stdenv.mkDerivation (finalAttrs: {
169159
++ lib.optional wirelessSupport wirelesstools
170160
++ lib.optional curlSupport curl
171161
++ lib.optional rssSupport libxml2
172-
++ lib.optional weatherXoapSupport libxml2
173162
++ lib.optional nvidiaSupport libXNVCtrl
174163
++ lib.optional pulseSupport libpulseaudio
175164
++ lib.optional journalSupport systemd;
176165

177-
cmakeFlags =
178-
[ ]
179-
++ lib.optional docsSupport "-DMAINTAINER_MODE=ON"
180-
++ lib.optional curlSupport "-DBUILD_CURL=ON"
181-
++ lib.optional (!ibmSupport) "-DBUILD_IBM=OFF"
182-
++ lib.optional imlib2Support "-DBUILD_IMLIB2=ON"
183-
++ lib.optional luaCairoSupport "-DBUILD_LUA_CAIRO=ON"
184-
++ lib.optional luaImlib2Support "-DBUILD_LUA_IMLIB2=ON"
185-
++ lib.optional (!mpdSupport) "-DBUILD_MPD=OFF"
186-
++ lib.optional (!ncursesSupport) "-DBUILD_NCURSES=OFF"
187-
++ lib.optional rssSupport "-DBUILD_RSS=ON"
188-
++ lib.optional (!x11Support) "-DBUILD_X11=OFF"
189-
++ lib.optional waylandSupport "-DBUILD_WAYLAND=ON"
190-
++ lib.optional xdamageSupport "-DBUILD_XDAMAGE=ON"
191-
++ lib.optional doubleBufferSupport "-DBUILD_XDBE=ON"
192-
++ lib.optional weatherMetarSupport "-DBUILD_WEATHER_METAR=ON"
193-
++ lib.optional weatherXoapSupport "-DBUILD_WEATHER_XOAP=ON"
194-
++ lib.optional wirelessSupport "-DBUILD_WLAN=ON"
195-
++ lib.optional nvidiaSupport "-DBUILD_NVIDIA=ON"
196-
++ lib.optional pulseSupport "-DBUILD_PULSEAUDIO=ON"
197-
++ lib.optional journalSupport "-DBUILD_JOURNAL=ON";
198-
199-
# `make -f src/CMakeFiles/conky.dir/build.make src/CMakeFiles/conky.dir/conky.cc.o`:
200-
# src/conky.cc:137:23: fatal error: defconfig.h: No such file or directory
201-
enableParallelBuilding = false;
202-
203-
# [CMakeFiles/Makefile2:1805: tests/CMakeFiles/test-conky.dir/all] Error 2
204-
doCheck = 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+
];
190+
191+
doCheck = true;
192+
193+
nativeInstallCheckInputs = [ versionCheckHook ];
194+
versionCheckProgramArg = "--version";
195+
doInstallCheck = true;
205196

206197
meta = {
207198
homepage = "https://conky.cc";
208-
changelog = "https://github.com/brndnmtthws/conky/releases/tag/v${finalAttrs.version}";
199+
changelog = "https://github.com/brndnmtthws/conky/releases/tag/${finalAttrs.src.tag}";
209200
description = "Advanced, highly configurable system monitor based on torsmo";
210201
mainProgram = "conky";
211202
maintainers = [ lib.maintainers.guibert ];

0 commit comments

Comments
 (0)