diff --git a/pkgs/applications/networking/irc/weechat/default.nix b/pkgs/applications/networking/irc/weechat/default.nix index 199b238ab388..1d79561fc235 100644 --- a/pkgs/applications/networking/irc/weechat/default.nix +++ b/pkgs/applications/networking/irc/weechat/default.nix @@ -38,6 +38,7 @@ pcre2, libargon2, extraBuildInputs ? [ ], + writeScript, }: let @@ -98,16 +99,16 @@ let enabledPlugins = builtins.filter (p: p.enabled) plugins; in -assert lib.all (p: p.enabled -> !(builtins.elem null p.buildInputs)) plugins; -stdenv.mkDerivation rec { - version = "4.5.1"; - pname = "weechat"; - hardeningEnable = [ "pie" ]; +assert lib.all (p: p.enabled -> !(builtins.elem null p.buildInputs)) plugins; + +stdenv.mkDerivation rec { + pname = "weechat"; + version = "4.6.2"; src = fetchurl { url = "https://weechat.org/files/src/weechat-${version}.tar.xz"; - hash = "sha256-Z8FDx7xw5om56obfZ0yan/PPRMzJzf8hvmpWHV6vxSg="; + hash = "sha256-D6AkKhgRb+J/dG27giEhgF2mu129QHUNQsYzBuSJZig="; }; # Why is this needed? https://github.com/weechat/weechat/issues/2031 @@ -120,19 +121,22 @@ stdenv.mkDerivation rec { cmakeFlags = [ - "-DENABLE_MAN=ON" - "-DENABLE_DOC=ON" - "-DENABLE_DOC_INCOMPLETE=ON" - "-DENABLE_TESTS=${if enableTests then "ON" else "OFF"}" + (lib.cmakeBool "ENABLE_MAN" true) + (lib.cmakeBool "ENABLE_DOC" true) + (lib.cmakeBool "ENABLE_DOC_INCOMPLETE" true) + (lib.cmakeBool "ENABLE_TESTS" enableTests) ] - ++ lib.optionals stdenv.hostPlatform.isDarwin [ "-DICONV_LIBRARY=${libiconv}/lib/libiconv.dylib" ] - ++ map (p: "-D${p.cmakeFlag}=" + (if p.enabled then "ON" else "OFF")) plugins; + ++ lib.optionals stdenv.hostPlatform.isDarwin [ + (lib.cmakeFeature "ICONV_LIBRARY" "${libiconv}/lib/libiconv.dylib") + ] + ++ map (p: lib.cmakeBool p.cmakeFlag p.enabled) plugins; nativeBuildInputs = [ cmake pkg-config asciidoctor ] ++ lib.optional enableTests cpputest; + buildInputs = [ ncurses @@ -152,6 +156,8 @@ stdenv.mkDerivation rec { ++ lib.concatMap (p: p.buildInputs) enabledPlugins ++ extraBuildInputs; + hardeningEnable = [ "pie" ]; + env.NIX_CFLAGS_COMPILE = "-I${python}/include/${python.libPrefix}" # Fix '_res_9_init: undefined symbol' error @@ -167,13 +173,28 @@ stdenv.mkDerivation rec { ''; doInstallCheck = true; + installCheckPhase = '' $out/bin/weechat --version ''; + passthru.updateScript = writeScript "update-weechat" '' + #!/usr/bin/env nix-shell + #!nix-shell -i bash -p coreutils gawk git gnugrep common-updater-scripts + set -eu -o pipefail + + version="$(git ls-remote --refs https://github.com/weechat/weechat | \ + awk '{ print $2 }' | \ + grep "refs/tags/v" | \ + sed -E -e 's,refs/tags/v(.*)$,\1,' | \ + sort --version-sort --reverse | \ + head -n1)" + update-source-version weechat-unwrapped "$version" + ''; + meta = { homepage = "https://weechat.org/"; - changelog = "https://weechat.org/files/doc/weechat/ChangeLog-${version}.html"; + changelog = "https://github.com/weechat/weechat/releases/tag/v${version}"; description = "Fast, light and extensible chat client"; longDescription = '' You can find more documentation as to how to customize this package