nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 56 lines 1.6 kB view raw
1{ 2 lib, 3 rustPlatform, 4 fetchFromGitHub, 5 pkg-config, 6 systemd, 7 protobuf, 8}: 9 10rustPlatform.buildRustPackage (finalAttrs: { 11 pname = "libsideswap-client"; 12 version = "0-unstable-2025-06-24"; 13 14 # This version is pinned in https://github.com/sideswap-io/sideswapclient/blob/v1.8.0/deploy/build_linux.sh 15 src = fetchFromGitHub { 16 owner = "sideswap-io"; 17 repo = "sideswap_rust"; 18 rev = "91791efbceb3fac4774d1e42a519e70b14b876cf"; 19 hash = "sha256-SUAmmKnL/thGLfPU22UxzO+LVXgrHh+lZVdXuAJ4q1E="; 20 }; 21 22 cargoHash = "sha256-bbNFi0cmFFf66IDKi0V8HC/lSU3JLRpgZ+NHeMJog8c="; 23 24 # sideswap_client uses vergen to detect Git commit hash at build time. It 25 # tries to access .git directory which is not present in Nix build dir. 26 # Here we patch that place to use a hardcoded commit hash instead. 27 postPatch = '' 28 substituteInPlace sideswap_client/src/ffi.rs \ 29 --replace-fail 'env!("VERGEN_GIT_SHA");' '"${finalAttrs.src.rev}";' 30 31 substituteInPlace sideswap_client/build.rs \ 32 --replace-fail 'vergen::vergen(vergen::Config::default()).unwrap();' ' ' 33 ''; 34 35 # This is needed for pkg-config to find libudev. It is a part of systemd. 36 nativeBuildInputs = [ 37 pkg-config 38 protobuf 39 ]; 40 buildInputs = [ systemd ]; 41 42 cargoBuildFlags = [ 43 "--package" 44 "sideswap_client" 45 ]; 46 47 # Test gdk_registry_cache::tests::basic hangs in Nix build invironment. 48 doCheck = false; 49 50 meta = { 51 description = "Rust library for Sideswap"; 52 license = lib.licenses.mit; 53 platforms = lib.platforms.linux; 54 maintainers = with lib.maintainers; [ starius ]; 55 }; 56})