Unverified Commit ae5f4468 authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

sideswap: init at 1.8.0 (#415100)

parents 3c878807 bd0770a8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -23685,6 +23685,12 @@
    githubId = 6362238;
    name = "Christoph Honal";
  };
  starius = {
    email = "bnagaev@gmail.com";
    github = "starius";
    githubId = 920155;
    name = "Boris Nagaev";
  };
  starkca90 = {
    email = "starkca90@gmail.com";
    github = "starkca90";
+56 −0
Original line number Diff line number Diff line
{
  lib,
  rustPlatform,
  fetchFromGitHub,
  pkg-config,
  systemd,
  protobuf,
}:

rustPlatform.buildRustPackage (finalAttrs: {
  pname = "libsideswap-client";
  version = "0-unstable-2025-06-05";

  # This version is pinned in https://github.com/sideswap-io/sideswapclient/blob/v1.8.0/deploy/build_linux.sh
  src = fetchFromGitHub {
    owner = "sideswap-io";
    repo = "sideswap_rust";
    rev = "0ba7485f77c86d1a6ae64a0cfedba22afe4ed98a";
    hash = "sha256-6qfFpCE6DMZlKuhQbXjJmmb8rPxFB2TA7CpOk06tuDk=";
  };

  cargoHash = "sha256-ecftCyNMRWdFP5SDEmLnssTVSfg9mo/TQEqyeDj4VpQ=";

  # sideswap_client uses vergen to detect Git commit hash at build time. It
  # tries to access .git directory which is not present in Nix build dir.
  # Here we patch that place to use a hardcoded commit hash instead.
  postPatch = ''
    substituteInPlace sideswap_client/src/ffi.rs \
      --replace-fail 'env!("VERGEN_GIT_SHA");' '"${finalAttrs.src.rev}";'

    substituteInPlace sideswap_client/build.rs \
      --replace-fail 'vergen::vergen(vergen::Config::default()).unwrap();' ' '
  '';

  # This is needed for pkg-config to find libudev. It is a part of systemd.
  nativeBuildInputs = [
    pkg-config
    protobuf
  ];
  buildInputs = [ systemd ];

  cargoBuildFlags = [
    "--package"
    "sideswap_client"
  ];

  # Test gdk_registry_cache::tests::basic hangs in Nix build invironment.
  doCheck = false;

  meta = {
    description = "Rust library for Sideswap";
    license = lib.licenses.mit;
    platforms = lib.platforms.linux;
    maintainers = with lib.maintainers; [ starius ];
  };
})
+83 −0
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  flutter332,
  mesa,
  libglvnd,
  callPackage,
  makeDesktopItem,
  copyDesktopItems,
}:

let
  # The Rust library is used by the main application.
  libsideswap-client = callPackage ./libsideswap-client.nix { };
in

flutter332.buildFlutterApplication rec {
  pname = "sideswap";
  version = "1.8.0";

  src = fetchFromGitHub {
    owner = "sideswap-io";
    repo = "sideswapclient";
    tag = "v${version}";
    hash = "sha256-IUUMlaEIUil07nhjep1I+F1WEWakQZfhy42ZlnyRLcQ=";
  };

  pubspecLock = lib.importJSON ./pubspec.lock.json;

  gitHashes = {
    sideswap_logger = "sha256-cTJfSODRmIJXctLQ++BfvJ6OKflau94AjQdXg7j95B0=";
    sideswap_websocket = "sha256-vsG5eUFu/WJvY3y6jaWD/5GfULwpqh3bO4EZmmBSkbs=";
    window_size = "sha256-+lqY46ZURT0qcqPvHFXUnd83Uvfq79Xr+rw1AHqrpak=";
  };

  # Provide OpenGL and libsideswap_client.so for the Flutter application.
  extraWrapProgramArgs = ''
    --set LD_LIBRARY_PATH ${
      lib.makeLibraryPath [
        mesa
        libglvnd
        libsideswap-client
      ]
    }
  '';

  # Install icons.
  postInstall = ''
    install -D -m644 assets/icon/icon_linux.svg $out/share/icons/hicolor/scalable/apps/sideswap.svg
    install -D -m644 assets/icon/icon_linux.png $out/share/icons/hicolor/256x256/apps/sideswap.png
  '';

  # Install .desktop file.
  desktopItems = [
    (makeDesktopItem {
      name = "sideswap";
      exec = meta.mainProgram;
      desktopName = "SideSwap";
      genericName = "L-USDT Wallet";
      icon = "sideswap";
      comment = meta.description;
      categories = [
        "Finance"
        "Network"
      ];
      startupNotify = true;
      startupWMClass = "Sideswap";
      terminal = false;
    })
  ];
  nativeBuildInputs = [
    copyDesktopItems
  ];

  meta = {
    description = "Cross‑platform, non‑custodial wallet and atomic swap marketplace for the Liquid Network";
    homepage = "https://sideswap.io/";
    license = lib.licenses.gpl3Only;
    mainProgram = "sideswap";
    platforms = lib.platforms.linux;
    maintainers = with lib.maintainers; [ starius ];
  };
}
+2566 −0

File added.

Preview size limit exceeded, changes collapsed.