~andir/nixpkgs-dev

ricochet-refresh: add enableGui in preparation for ricochet-irc v1 PROPOSED

Adam Joseph: 2
 ricochet-refresh: add enableGui in preparation for ricochet-irc
 ricochet-irc: init at 3.0.11.2

 2 files changed, 88 insertions(+), 6 deletions(-)



          
          
          
          
Next
Yeah, even if it started as a fork of cochet-im/ricochet, this is a
separate project, so should get a separate expression, and probably
separate set of maintainers.

Sending fixes to nixpkgs is one thing, adding new packages (and
maintaining them) without a GH account isn't really feasible, and
considering you deleted your GH account (?) I suggest maintaining this
expression downstream.

flokli
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~andir/nixpkgs-dev/patches/51022/mbox | git am -3
Learn more about email & git

[PATCH 1/2] ricochet-refresh: add enableGui in preparation for ricochet-irc Export this patch

This commit adds an enableGui parameter to ricochet-refresh.  The following
commit adds a new package ricochet-irc which uses this flag to provide a
gui-less ricochet client for use with any IRC client.
---
 pkgs/by-name/ri/ricochet-refresh/package.nix | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/pkgs/by-name/ri/ricochet-refresh/package.nix b/pkgs/by-name/ri/ricochet-refresh/package.nix
index 4d753b760d69..6feb1eca6d6f 100644
--- a/pkgs/by-name/ri/ricochet-refresh/package.nix
+++ b/pkgs/by-name/ri/ricochet-refresh/package.nix
@@ -6,6 +6,7 @@
, protobuf3_20  # https://github.com/blueprint-freespeech/ricochet-refresh/issues/178
, pkg-config
, cmake
, enableGui ? true  # used by ricochet-irc
}:

let
@@ -28,15 +29,15 @@ stdenv.mkDerivation (finalAttrs: {
  strictDeps = true;

  buildInputs = (with qt5; [
    qtbase
    qtbase  # used for networking even if !enableGui
    openssl
    protobuf
  ] ++ lib.optionals enableGui [
    qttools
    qtmultimedia
    qtquickcontrols2
    qtwayland
  ]) ++ [
    openssl
    protobuf
  ];
  ]);

  nativeBuildInputs = [
    pkg-config
@@ -49,8 +50,9 @@ stdenv.mkDerivation (finalAttrs: {
  # https://github.com/blueprint-freespeech/ricochet-refresh/blob/main/BUILDING.md
  cmakeFlags = [
    (lib.cmakeFeature "CMAKE_BUILD_TYPE" "MinSizeRel")
    (lib.cmakeBool "RICOCHET_REFRESH_INSTALL_DESKTOP" true)
    (lib.cmakeBool "USE_SUBMODULE_FMT" true)
  ] ++ lib.optionals enableGui [
    (lib.cmakeBool "RICOCHET_REFRESH_INSTALL_DESKTOP" true)
  ];

  meta = {
-- 
2.42.0

[PATCH 2/2] ricochet-irc: init at 3.0.11.2 Export this patch

The ricochet-irc package provides a gui-less ricochet client that you connect
to using any IRC client.  See `meta.longDescription` for important usage notes.
---
 pkgs/by-name/ri/ricochet-irc/package.nix | 80 ++++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 pkgs/by-name/ri/ricochet-irc/package.nix

diff --git a/pkgs/by-name/ri/ricochet-irc/package.nix b/pkgs/by-name/ri/ricochet-irc/package.nix
new file mode 100644
index 000000000000..b087125634f3
--- /dev/null
+++ b/pkgs/by-name/ri/ricochet-irc/package.nix
@@ -0,0 +1,80 @@
{ lib
, stdenv
, ricochet-refresh
, fetchFromGitHub
, fetchpatch
}:

(ricochet-refresh.override {
  enableGui = false;

}).overrideAttrs (finalAttrs: previousAttrs: {

  pname = "ricochet-irc";
  version = "3.0.11.2";

  src = (fetchFromGitHub {
    owner = "wfr";
    repo = "ricochet-irc";
    rev = "irc-v${finalAttrs.version}";
    sha256 = "sha256-hN2XaKGurPVx1rbfBPFvvOYyh1CuPFfycPee/MGrkak=";
    fetchSubmodules = false;
    forceFetchGit = true;
  }).overrideAttrs (previousAttrs: {
    env = (previousAttrs.env or {}) // {
      # We need to fetch the `src/extern/tor` git submodule, but it
      # has nested submodules which are no longer fetchable
      # (e.g. `tor/src/ext/rust`); fortunately these broken references
      # are not needed for building ricochet-irc.
      NIX_PREFETCH_GIT_CHECKOUT_HOOK = ''
        git -C $out submodule update --init
      '';
    };
  });

  patches = (previousAttrs.patches or []) ++ [
    (fetchpatch {
      url = "https://github.com/JeremyRand/ricochet-refresh/commit/d826d0257f78cf90788197c8023e0daf4d3cfd71.patch";
      hash = "sha256-bq2lGOD4QobwrZQua1B2tpIOaFAmKp7M9liyU/rLc/U=";
      stripLen = 1;
    })
  ];

  postInstall = (previousAttrs.postInstall or "") + ''
    mv $out/usr/* $out/
    rmdir $out/usr
  '';

  meta = {
    description = "Allows using an IRC client with Ricochet Refresh";
    longDescription = ''
      This package is a headless, gui-less Ricochet client which lets you use
      any IRC client to interact with the Ricochet network.

      This package exports an (very limited) IRC server interface, exposing
      only one channel #ricochet.  Inbound pairing requests will appear as
      messages on this channel, and commands (such as making outbound pairing
      requests) can be issued in this channel.  All other ricochet users
      appear as users on this IRC server to whom you may send `/msg` messages.
      Important note: do not try to `/join` any other channel besides
      #ricochet -- there will never be anybody else in those channels.  All
      communication with other users takes place using `/msg`, not `/join`.

      If you `/msg` a user whose Ricochet client is offline you will be told
      that they are "away", and ricochet-irc will continually attempt to
      resend your message until either it is delivered or until ricochet-irc
      restarts.  All undelivered messages are lost when you restart the
      ricochet-irc daemon.  Unlike the gui client, ricochet-irc currently does
      not provide any way to know if a contact is online or not (the
      green/gray circle in the gui) without attempting to send something to
      them.

      See the ricochet-refresh package description for more details about the
      Ricochet protocol.
    '';
    downloadPage = "https://github.com/wfr/ricochet-irc/releases";
    changelog = "https://github.com/wfr/ricochet-irc/blob/master/CHANGES.md";
    license = lib.licenses.gpl3;
  };

})
-- 
2.42.0