diff --git a/pkgs/applications/networking/instant-messengers/chatterino2/default.nix b/pkgs/applications/networking/instant-messengers/chatterino2/default.nix index be7862611f192f..0870184103ab79 100644 --- a/pkgs/applications/networking/instant-messengers/chatterino2/default.nix +++ b/pkgs/applications/networking/instant-messengers/chatterino2/default.nix @@ -1,49 +1,140 @@ -{ stdenv, lib, cmake, pkg-config, fetchFromGitHub, qt6, boost, openssl, libsecret }: +{ + stdenv, + lib, + cmake, + pkg-config, + fetchFromGitHub, + qt6, + boost, + openssl, + libsecret, + darwin, +}: +let + stdenv' = if stdenv.hostPlatform.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv; + mkPackage = + { + pname, + version, + src, + extraMeta, + }: -stdenv.mkDerivation rec { - pname = "chatterino2"; - version = "2.5.1"; - src = fetchFromGitHub { - owner = "Chatterino"; - repo = pname; - rev = "v${version}"; - hash = "sha256-c3Vhzes54xLjKV0Of7D1eFpQvIWJwcUBXvLT2p6VwBE="; - fetchSubmodules = true; + stdenv'.mkDerivation { + inherit pname version src; + nativeBuildInputs = [ + cmake + pkg-config + qt6.wrapQtAppsHook + ]; + buildInputs = [ + qt6.qtbase + qt6.qtsvg + qt6.qtimageformats + qt6.qttools + qt6.qt5compat + boost + openssl + libsecret + ] ++ lib.optionals stdenv.hostPlatform.isLinux [ qt6.qtwayland ]; + + env.GIT_HASH = "nix-${version}"; + cmakeFlags = [ (lib.cmakeBool "BUILD_WITH_QT6" true) ]; + postInstall = + lib.optionalString stdenv.hostPlatform.isDarwin '' + mkdir -p "$out/Applications" + mv bin/chatterino.app "$out/Applications/" + '' + + '' + mkdir -p $out/share/icons/hicolor/256x256/apps + cp $src/resources/icon.png $out/share/icons/hicolor/256x256/apps/chatterino.png + ''; + passthru.updateScript = ./update.sh; + meta = { + description = "Chat client for Twitch chat"; + mainProgram = "chatterino"; + longDescription = '' + Chatterino is a chat client for Twitch chat. + It aims to be an improved/extended version of the Twitch web chat. + Chatterino 2 is the second installment of the Twitch chat client series "Chatterino". + ''; + license = lib.licenses.mit; + platforms = lib.platforms.unix; + maintainers = with lib.maintainers; [ + rexim + supa + hausken + ]; + } // extraMeta; + }; +in +{ + chatterino2 = mkPackage rec { + pname = "chatterino2"; + version = "2.5.1"; + src = fetchFromGitHub { + owner = "Chatterino"; + repo = "chatterino2"; + rev = "v${version}"; + hash = "sha256-c3Vhzes54xLjKV0Of7D1eFpQvIWJwcUBXvLT2p6VwBE="; + fetchSubmodules = true; + }; + extraMeta = { + homepage = "https://github.com/Chatterino/chatterino2"; + changelog = "https://github.com/Chatterino/chatterino2/blob/${src.rev}/CHANGELOG.md"; + }; + }; + chatterino2-unstable = mkPackage rec { + pname = "chatterino2"; + version = "0-unstable-2024-09-29"; + src = fetchFromGitHub { + owner = "Chatterino"; + repo = "chatterino2"; + rev = "0db477665c5a4b40149aed231c09ce00a075baf7"; + hash = "sha256-1LTfRfxodvyqLSBZsGuFrZaQ5+vYA6LNxuVkLXaTZKI="; + fetchSubmodules = true; + }; + extraMeta = { + homepage = "https://github.com/Chatterino/chatterino2"; + changelog = "https://github.com/Chatterino/chatterino2/blob/${src.rev}/CHANGELOG.md"; + }; + }; + chatterino7 = mkPackage rec { + pname = "chatterino7"; + version = "7.5.1"; + src = fetchFromGitHub { + owner = "SevenTV"; + repo = "chatterino7"; + rev = "v${version}"; + hash = "sha256-T0H+p9hyNd73gETwLilXN0uzcF75TJgx/LzHqnC099M="; + fetchSubmodules = true; + }; + extraMeta = { + homepage = "https://github.com/SevenTV/chatterino7"; + changelog = "https://github.com/SevenTV/chatterino7/blob/${src.rev}/CHANGELOG.md"; + extraDescription = '' + Chatterino7 is a fork of Chatterino 2. + This fork mainly contains features that aren't accepted into Chatterino 2, most notably 7TV subscriber features. + ''; + }; }; - nativeBuildInputs = [ cmake pkg-config qt6.wrapQtAppsHook ]; - buildInputs = [ - qt6.qtbase - qt6.qtsvg - qt6.qtimageformats - qt6.qttools - qt6.qt5compat - boost - openssl - libsecret - ] ++ lib.optionals stdenv.hostPlatform.isLinux [ - qt6.qtwayland - ]; - cmakeFlags = [ "-DBUILD_WITH_QT6=ON" ]; - postInstall = lib.optionalString stdenv.hostPlatform.isDarwin '' - mkdir -p "$out/Applications" - mv bin/chatterino.app "$out/Applications/" - '' + '' - mkdir -p $out/share/icons/hicolor/256x256/apps - cp $src/resources/icon.png $out/share/icons/hicolor/256x256/apps/chatterino.png - ''; - meta = with lib; { - description = "Chat client for Twitch chat"; - mainProgram = "chatterino"; - longDescription = '' - Chatterino is a chat client for Twitch chat. It aims to be an - improved/extended version of the Twitch web chat. Chatterino 2 is - the second installment of the Twitch chat client series - "Chatterino". - ''; - homepage = "https://github.com/Chatterino/chatterino2"; - changelog = "https://github.com/Chatterino/chatterino2/blob/master/CHANGELOG.md"; - license = licenses.mit; - platforms = platforms.unix; - maintainers = with maintainers; [ rexim supa ]; + chatterino7-unstable = mkPackage rec { + pname = "chatterino7"; + version = "0-unstable-2024-09-28"; + src = fetchFromGitHub { + owner = "SevenTV"; + repo = "chatterino7"; + rev = "978fb9820361c2e9ce1b5f1425e0243af1d5517d"; + hash = "sha256-pkY8+UvttYLOJ/9OtJ4q5SY27rutCjR/iJ25+rVGxvk="; + fetchSubmodules = true; + }; + extraMeta = { + homepage = "https://github.com/SevenTV/chatterino7"; + changelog = "https://github.com/SevenTV/chatterino7/blob/${src.rev}/CHANGELOG.md"; + extraDescription = '' + Chatterino7 is a fork of Chatterino 2. + This fork mainly contains features that aren't accepted into Chatterino 2, most notably 7TV subscriber features. + ''; + }; }; } diff --git a/pkgs/applications/networking/instant-messengers/chatterino2/update.sh b/pkgs/applications/networking/instant-messengers/chatterino2/update.sh new file mode 100644 index 00000000000000..575560cc6bf807 --- /dev/null +++ b/pkgs/applications/networking/instant-messengers/chatterino2/update.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env nix-shell +#!nix-shell -I nixpkgs=./. -i bash -p curl common-updater-scripts jq + +set -euo pipefail + +ATTR=$1 + +OLD_VERSION=$(nix eval --raw -f default.nix "$ATTR.version") +OWNER=$(nix eval --raw -f default.nix "$ATTR.src.owner") +REPO=$(nix eval --raw -f default.nix "$ATTR.src.repo") + +if [[ $OLD_VERSION =~ "0-unstable-" ]]; then + releaseDate=$(curl "https://api.github.com/repos/$OWNER/$REPO/commits/nightly-build" | jq -r '.commit.author.date' | cut -d 'T' -f 1) + revision=$(curl "https://api.github.com/repos/$OWNER/$REPO/commits/nightly-build" | jq -r '.sha') + version="0-unstable-$releaseDate" + update-source-version "$ATTR" "$version" --rev="$revision" +else + version=$(curl --silent "https://api.github.com/repos/$OWNER/$REPO/releases" | jq -r '[.[] | select(.tag_name != "nightly-build")] | .[0].tag_name' | sed 's/v//') + update-source-version "$ATTR" "$version" +fi diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 1b8abbdc94439b..4741b0068c648f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -33845,9 +33845,7 @@ with pkgs; xwaylandSupport = false; }; - chatterino2 = callPackage ../applications/networking/instant-messengers/chatterino2 { - stdenv = if stdenv.hostPlatform.isDarwin then darwin.apple_sdk_11_0.stdenv else stdenv; - }; + inherit (callPackages ../applications/networking/instant-messengers/chatterino2 { } ) chatterino2 chatterino2-unstable chatterino7 chatterino7-unstable; weston = callPackage ../applications/window-managers/weston { };