sideswap: init at 1.8.0

Adding sideswap wallet, non‑custodial wallet and atomic swap marketplace for
the Liquid Network. It is a very convenient crypto wallet for L-BTC and USDT on
Liquid and provides a way to swap between each other without involving trust.

The package is a flutter app, which depends on a Rust library
(libsideswap_client.so). The library is put into the same directory.
This commit is contained in:
Boris Nagaev 2025-06-08 15:39:43 -03:00
parent f11f2f60d6
commit bd0770a8ed
No known key found for this signature in database
3 changed files with 2705 additions and 0 deletions

View File

@ -0,0 +1,56 @@
{
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 ];
};
})

View File

@ -0,0 +1,83 @@
{
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 = "Crossplatform, noncustodial 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 ];
};
}

File diff suppressed because it is too large Load Diff