NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.66k stars 13.81k forks source link

Monero 0.17.1.9 -> 0.17.2.1 #121120

Closed anttisoikkeli closed 3 years ago

anttisoikkeli commented 3 years ago
Checklist
Project name

nix search name: monero-gui

current version: 0.17.1.9 desired version: 0.17.2.1

Notify maintainers

maintainers: rnhmjoj

Note for maintainers

Please tag this issue in your PR.

anttisoikkeli commented 3 years ago

Ping @rnhmjoj

Forgot @ in the original comment.

rnhmjoj commented 3 years ago

I'm aware of the update but I can't get monero-gui 0.17.2.1 to build (it's a pain on every minor update).

anttisoikkeli commented 3 years ago

Ok, thanks for the info.

anttisoikkeli commented 3 years ago

An idea: monero-gui-bin? I at least would be fine with just something like:

let
  pkgs = import <nixpkgs> {};
in
pkgs.stdenv.mkDerivation rec {
  pname = "monero-gui-bin";
  version = "0.17.2.1";

  src = pkgs.fetchurl {
    url = "https://downloads.getmonero.org/gui/monero-gui-linux-x64-v0.17.2.1.tar.bz2";
    # Check out latest name and hash from https://github.com/monero-project/monero-gui/releases
    sha256 = "72dfca40797201604a6b2fb97935037f62d3153360695cf732dee3d12e167da3";
  };

  installPhase = ''
    mkdir -p $out/bin
    mv monero-wallet-gui $out/bin
    mv monerod $out/bin
  '';
}
rnhmjoj commented 3 years ago

I just need some free time to work on it: it's usually a matter of a couple hours. Hopefully in the next few days...

anttisoikkeli commented 3 years ago

I'm fiddling with this myself as well, I can post my results if I make it work. Free time challenges as well.

anttisoikkeli commented 3 years ago

At least GUI and monerod start with this, so it should be a good starting point:

{ pkgs ? (import <nixpkgs> {}), ... }:

with pkgs;

stdenv.mkDerivation rec {
  pname = "monero_custom";
  version = "0.17.2.1";

  src = fetchurl {
    url = "https://downloads.getmonero.org/gui/monero-gui-linux-x64-v0.17.2.1.tar.bz2";
    # Check out latest name and hash from https://github.com/monero-project/monero-gui/releases
    sha256 = "72dfca40797201604a6b2fb97935037f62d3153360695cf732dee3d12e167da3";
  };

  preFixup =
    let
      # We prepare our library path in the let clause to avoid it become part of the input of mkDerivation
      #
      # List library dependencies:
      # nix-build test.nix && ldd result/bin/monero-wallet-gui
      #
      # List possible source packages for `not found` libraries:
      # nix-locate -1 -w lib/libudev.so.1
      libPath = stdenv.lib.makeLibraryPath [
        libudev.out                 # libudev.so.1
        libglvnd.out                # libGL.so.1
        glib.out                    # libglib-2.0.so.0
        xlibs.libX11.out            # libX11-xcb.so.1
        xlibs.libxcb.out            # libxcb.so.1
        xlibs.xcbutilwm.out         # libxcb-icccm.so.4
        xlibs.xcbutilimage.out      # libxcb-image.so.0
        xlibs.xcbutilkeysyms.out    # libxcb-keysyms.so.1
        xlibs.xcbutilrenderutil.out # libxcb-render-util.so.0
        libxkbcommon.out            # libxkbcommon-x11.so.0
      ];
    in ''
      patch_and_check () {
        patchelf \
          --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
          --set-rpath "${libPath}" \
          $out/$1
        if ldd $out/$1 | grep -q "not found" ; then
          echo Some Shared Libraries missing:
          ldd $out/$1 | grep "not found"
          exit 1
        fi
      }
      patch_and_check bin/monero-wallet-gui
      patch_and_check daemon/monerod
      '';

  # Let's not put monerod to bin so that it doesn't pop up everywhere
  installPhase = ''
    mkdir -p $out/bin
    mv monero-wallet-gui $out/bin
    mkdir -p $out/daemon
    mv monerod $out/daemon
  '';
}
rnhmjoj commented 3 years ago

Done with #121488.