From f9034a10c6a55177fb20915648eeed084430af03 Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Sat, 23 Nov 2024 10:17:21 -0500 Subject: [PATCH 1/5] xdbg nix build --- .gitignore | 1 + dev/release-kotlin | 2 +- flake.lock | 51 ++++++++++++---- flake.nix | 137 +++++++++++++++++++++++-------------------- nix/android.nix | 66 +++++++++++++++++++++ nix/xdbg/crate.nix | 101 +++++++++++++++++++++++++++++++ nix/xdbg/default.nix | 25 ++++++++ rust-toolchain | 3 +- 8 files changed, 308 insertions(+), 78 deletions(-) create mode 100644 nix/android.nix create mode 100644 nix/xdbg/crate.nix create mode 100644 nix/xdbg/default.nix diff --git a/.gitignore b/.gitignore index 335703a8f..b888df5ef 100644 --- a/.gitignore +++ b/.gitignore @@ -166,3 +166,4 @@ ecies_bindings_wasm/ **/tracing-flamegraph.svg chain_urls.json +result/** diff --git a/dev/release-kotlin b/dev/release-kotlin index 86c1ff670..5020f8296 100755 --- a/dev/release-kotlin +++ b/dev/release-kotlin @@ -35,7 +35,7 @@ fi LIBRARY_NAME="libxmtpv3" TARGET_NAME="libuniffi_xmtpv3" -nix develop . --command cargo ndk -o bindings_ffi/jniLibs/ --manifest-path ./bindings_ffi/Cargo.toml \ +nix develop .#android --command cargo ndk -o bindings_ffi/jniLibs/ --manifest-path ./bindings_ffi/Cargo.toml \ -t aarch64-linux-android \ -t x86_64-linux-android \ -t i686-linux-android \ diff --git a/flake.lock b/flake.lock index b46041fed..9b1f92382 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "crane": { + "locked": { + "lastModified": 1731974733, + "narHash": "sha256-enYSSZVVl15FI5p+0Y5/Ckf5DZAvXe6fBrHxyhA/njc=", + "owner": "ipetkov", + "repo": "crane", + "rev": "3cb338ce81076ce5e461cf77f7824476addb0e1c", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "fenix": { "inputs": { "nixpkgs": [ @@ -21,21 +36,21 @@ "type": "github" } }, - "flake-utils": { + "flake-parts": { "inputs": { - "systems": "systems" + "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1726560853, - "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a", + "lastModified": 1730504689, + "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "506278e768c2a08bec68eb62932193e341f55c90", "type": "github" }, "original": { - "owner": "numtide", - "repo": "flake-utils", + "owner": "hercules-ci", + "repo": "flake-parts", "type": "github" } }, @@ -55,11 +70,25 @@ "type": "github" } }, + "nixpkgs-lib": { + "locked": { + "lastModified": 1730504152, + "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" + } + }, "root": { "inputs": { + "crane": "crane", "fenix": "fenix", - "flake-utils": "flake-utils", - "nixpkgs": "nixpkgs" + "flake-parts": "flake-parts", + "nixpkgs": "nixpkgs", + "systems": "systems" } }, "rust-analyzer-src": { diff --git a/flake.nix b/flake.nix index 006af47ec..68a6547bb 100644 --- a/flake.nix +++ b/flake.nix @@ -7,81 +7,88 @@ url = "github:nix-community/fenix"; inputs = { nixpkgs.follows = "nixpkgs"; }; }; + systems.url = "github:nix-systems/default"; + # A nix-native packaging system for rust (docs: https://crane.dev/index.html) + crane.url = "github:ipetkov/crane"; - flake-utils = { url = "github:numtide/flake-utils"; }; + flake-parts.url = "github:hercules-ci/flake-parts"; }; - outputs = { nixpkgs, flake-utils, fenix, ... }: - flake-utils.lib.eachDefaultSystem (system: - let - inherit (pkgs.stdenv) isDarwin; - inherit (pkgs) androidenv; - inherit (androidComposition) androidsdk; - frameworks = if isDarwin then pkgs.darwin.apple_sdk.frameworks else null; - pkgs = import nixpkgs { - inherit system; - # Rust Overlay - overlays = [ fenix.overlays.default ]; - config = { - android_sdk.accept_license = true; - allowUnfree = true; + nixConfig = { + extra-trusted-public-keys = "xmtp.cachix.org-1:nFPFrqLQ9kjYQKiWL7gKq6llcNEeaV4iI+Ka1F+Tmq0="; + extra-substituters = "https://xmtp.cachix.org"; + }; + + outputs = inputs@{ flake-parts, fenix, crane, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + flake = { }; + systems = import inputs.systems; + perSystem = { pkgs, lib, inputs', system, ... }: + let + fenixPkgs = inputs'.fenix.packages; + rust-toolchain = fenixPkgs.fromToolchainFile { + file = ./rust-toolchain; + sha256 = "sha256-yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk="; }; - }; - android = { - platforms = [ "34" ]; - platformTools = "33.0.3"; - buildTools = [ "30.0.3" ]; - }; + pkgConfig = { + inherit system; + overlays = [ fenix.overlays.default ]; + config = { + android_sdk.accept_license = true; + allowUnfree = true; + }; + }; - sdkArgs = { - platformVersions = android.platforms; - platformToolsVersion = android.platformTools; - buildToolsVersions = android.buildTools; - includeNDK = true; - }; + # Library to build rust crates & test them + # Set the rust toolchain package/versioning + craneLib = (crane.mkLib pkgs).overrideToolchain (p: rust-toolchain); - fenixPkgs = fenix.packages.${system}; - # Pinned Rust Version - rust-toolchain = fenixPkgs.fromToolchainFile { - file = ./rust-toolchain; - sha256 = "sha256-yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk="; - }; + inherit (craneLib.fileset) commonCargoSources; - # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/android.section.md - androidHome = "${androidComposition.androidsdk}/libexec/android-sdk"; - androidComposition = androidenv.composeAndroidPackages sdkArgs; + libFileSetForWorkspace = lib.fileset.unions [ + ./Cargo.toml + ./Cargo.lock + (commonCargoSources ./xmtp_api_grpc) + (commonCargoSources ./xmtp_api_http) + (commonCargoSources ./xmtp_cryptography) + (commonCargoSources ./xmtp_id) + (commonCargoSources ./xmtp_mls) + (commonCargoSources ./xmtp_proto) + (commonCargoSources ./xmtp_v2) + (commonCargoSources ./xmtp_user_preferences) + ./xmtp_id/src/scw_verifier/chain_urls_default.json + ./xmtp_id/artifact + ./xmtp_mls/migrations + ]; - # Packages available to flake while building the environment - nativeBuildInputs = with pkgs; [ pkg-config ]; - # Define the packages available to the build environment - # https://search.nixos.org/packages - buildInputs = with pkgs; [ - rust-toolchain - kotlin - androidsdk - jdk17 - cargo-ndk + binFileSetForWorkspace = lib.fileset.unions [ + (commonCargoSources ./examples/cli) + (commonCargoSources ./mls_validation_service) + (commonCargoSources ./bindings_node) + (commonCargoSources ./bindings_wasm) + (commonCargoSources ./xtask) + (commonCargoSources ./bindings_ffi) + (commonCargoSources ./xmtp_debug) + ]; - # System Libraries - sqlite - openssl - ] ++ lib.optionals isDarwin [ # optional packages if on darwin, in order to check if build passes locally - libiconv - frameworks.CoreServices - frameworks.Carbon - frameworks.ApplicationServices - frameworks.AppKit - darwin.cctools - ]; - in { - devShells.default = pkgs.mkShell { - OPENSSL_DIR = "${pkgs.openssl.dev}"; - ANDROID_HOME = androidHome; - ANDROID_SDK_ROOT = androidHome; # ANDROID_SDK_ROOT is deprecated, but some tools may still use it; - ANDROID_NDK_ROOT = "${androidHome}/ndk-bundle"; + fileSetForWorkspace = lib.fileset.unions [ binFileSetForWorkspace libFileSetForWorkspace ]; - inherit buildInputs nativeBuildInputs; + filesets = { inherit fileSetForWorkspace binFileSetForWorkspace libFileSetForWorkspace; }; + xdbg = pkgs.callPackage ./nix/xdbg { + inherit craneLib filesets; + }; + in + { + _module. args. pkgs = import inputs.nixpkgs pkgConfig; + devShells.android = pkgs.callPackage ./nix/android.nix { inherit rust-toolchain; }; + devShells.muslXdbg = xdbg.muslXDbg.devShell; + devShells.xdbg = xdbg.devShell; + packages = { + xdbg = xdbg.bin; + xdbgDocker = xdbg.dockerImage; + muslXdbg = xdbg.muslXDbg.bin; }; - }); + }; + }; } diff --git a/nix/android.nix b/nix/android.nix new file mode 100644 index 000000000..8c77c0683 --- /dev/null +++ b/nix/android.nix @@ -0,0 +1,66 @@ +{ mkShell +, darwin +, androidenv +, stdenv +, pkg-config +, kotlin +, jdk17 +, cargo-ndk +, sqlite +, openssl +, libiconv +, lib +, rust-toolchain +}: +let + frameworks = if stdenv.isDarwin then darwin.apple_sdk.frameworks else null; + inherit (androidComposition) androidsdk; + + android = { + platforms = [ "34" ]; + platformTools = "33.0.3"; + buildTools = [ "30.0.3" ]; + }; + + sdkArgs = { + platformVersions = android.platforms; + platformToolsVersion = android.platformTools; + buildToolsVersions = android.buildTools; + includeNDK = true; + }; + + # https://github.com/NixOS/nixpkgs/blob/master/doc/languages-frameworks/android.section.md + androidHome = "${androidComposition.androidsdk}/libexec/android-sdk"; + androidComposition = androidenv.composeAndroidPackages sdkArgs; + +in +mkShell { + OPENSSL_DIR = "${openssl.dev}"; + ANDROID_HOME = androidHome; + ANDROID_SDK_ROOT = androidHome; # ANDROID_SDK_ROOT is deprecated, but some tools may still use it; + ANDROID_NDK_ROOT = "${androidHome}/ndk-bundle"; + + # Packages available to flake while building the environment + nativeBuildInputs = [ pkg-config ]; + + buildInputs = [ + rust-toolchain + kotlin + androidsdk + jdk17 + cargo-ndk + + # System Libraries + sqlite + openssl + ] ++ lib.optionals stdenv.isDarwin [ + # optional packages if on darwin, in order to check if build passes locally + libiconv + frameworks.CoreServices + frameworks.Carbon + frameworks.ApplicationServices + frameworks.AppKit + darwin.cctools + ]; +} + diff --git a/nix/xdbg/crate.nix b/nix/xdbg/crate.nix new file mode 100644 index 000000000..5eb917f34 --- /dev/null +++ b/nix/xdbg/crate.nix @@ -0,0 +1,101 @@ +{ openssl +, sqlite +, perl +, libiconv +, lib +, pkg-config +, stdenv +, craneLib +, darwin +, filesets +, mkShell +, rustTarget ? null +, isStatic ? false +}: +let + inherit (stdenv) hostPlatform; + upperTarget = lib.strings.toUpper (builtins.replaceStrings [ "-" ] [ "_" ] rustTarget); + + filesetForWorkspace = lib.fileset.toSource { + root = ./../..; + fileset = filesets.fileSetForWorkspace; + }; + + linkerArgs = if rustTarget == null then { } else { + HOST_CC = "${stdenv.cc.nativePrefix}cc"; + TARGET_CC = "${stdenv.cc.targetPrefix}cc"; + "${upperTarget}_OPENSSL_DIR" = "${openssl.out}"; + "${upperTarget}_OPENSSL_LIB_DIR" = "${openssl.out}/lib"; + "${upperTarget}_OPENSSL_INCLUDE_DIR" = "${openssl.dev}/include"; + + CARGO_BUILD_TARGET = rustTarget; + "CARGO_TARGET_${upperTarget}_LINKER" = "${stdenv.cc.targetPrefix}cc"; + CARGO_BUILD_RUSTFLAGS = if isStatic then "-C target-feature=+crt-static" else ""; + }; + + commonArgs = ({ + src = filesetForWorkspace; + strictDeps = true; + + # Used to build on the current/build machine + nativeBuildInputs = [ + pkg-config + stdenv.cc + perl + ] ++ lib.optionals stdenv.isDarwin [ + libiconv + ]; + + # Libraries that will run on the host machine + # that to be linked + buildInputs = [ + # Add additional build inputs here + openssl + sqlite + ] ++ lib.optionals hostPlatform.isDarwin + (with darwin.apple_sdk; + [ + libiconv + frameworks.Security + frameworks.SystemConfiguration + ]); + cargoExtraArgs = "--workspace --exclude xmtpv3"; + RUSTFLAGS = [ "--cfg" "tracing_unstable" ]; + OPENSSL_DIR = "${openssl.out}"; + OPENSSL_INCLUDE_DIR = "${openssl.dev}/include"; + } // linkerArgs); + + cargoArtifacts = craneLib.buildDepsOnly commonArgs; + + bin = craneLib.buildPackage ({ + inherit cargoArtifacts; + inherit (craneLib.crateNameFromCargoToml { + cargoToml = ./../../xmtp_debug/Cargo.toml; + }) version pname; + cargoExtraArgs = "--package xdbg"; + src = filesetForWorkspace; + doCheck = false; + + RUST_BACKTRACE = 1; + } // commonArgs); + + devShell = mkShell + { + inputsFrom = [ bin ]; + OPENSSL_DIR = "${openssl.out}"; + OPENSSL_LIB_DIR = "${openssl.out}/lib"; + OPENSSL_INCLUDE_DIR = "${openssl.dev}/include"; + HOST_CC = "${stdenv.cc.nativePrefix}cc"; + TARGET_CC = "${stdenv.cc.targetPrefix}cc"; + "${upperTarget}_OPENSSL_DIR" = "${openssl.out}"; + "${upperTarget}_OPENSSL_LIB_DIR" = "${openssl.out}/lib"; + "${upperTarget}_OPENSSL_INCLUDE_DIR" = "${openssl.dev}/include"; + + CARGO_BUILD_TARGET = rustTarget; + "CARGO_TARGET_${upperTarget}_LINKER" = "${stdenv.cc.targetPrefix}cc"; + CARGO_BUILD_RUSTFLAGS = if isStatic then "-C target-feature=+crt-static" else ""; + }; +in +{ + inherit bin devShell; +} diff --git a/nix/xdbg/default.nix b/nix/xdbg/default.nix new file mode 100644 index 000000000..ff1445ddf --- /dev/null +++ b/nix/xdbg/default.nix @@ -0,0 +1,25 @@ +{ pkgs, craneLib, filesets, ... }: +let + + xdbg = pkgs.callPackage ./crate.nix { inherit craneLib filesets; }; + muslXDbg = pkgs.pkgsCross.musl64.callPackage ./crate.nix { + inherit craneLib filesets; rustTarget = "x86_64-unknown-linux-musl"; + isStatic = true; + }; + + dockerImage = pkgs.dockerTools.buildImage { + name = " xdbg"; + tag = " latest"; + copyToRoot = [ muslXDbg.bin ]; + config = { + Cmd = [ "${ muslXDbg.bin}/bin/xdbg" ]; + }; + }; +in +{ + + inherit (xdbg) bin devShell; + inherit muslXDbg; + inherit dockerImage; +} + diff --git a/rust-toolchain b/rust-toolchain index d408d6b65..6228acd2f 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -10,6 +10,7 @@ targets = [ "i686-linux-android", "x86_64-apple-ios", "x86_64-apple-darwin", - "aarch64-apple-ios" + "aarch64-apple-ios", + "x86_64-unknown-linux-musl", ] profile = "default" From e3d68e80bd75e2656bc4cb9e348cc1cb4124d3ee Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Mon, 25 Nov 2024 10:48:59 -0500 Subject: [PATCH 2/5] nix + binary docker builds for xdbg and mls_validation_service --- flake.lock | 20 +++--- flake.nix | 37 ++++++---- nix/android.nix | 2 - nix/mls_validation_service/crate.nix | 95 ++++++++++++++++++++++++++ nix/mls_validation_service/default.nix | 23 +++++++ nix/xdbg/crate.nix | 40 +++++------ nix/xdbg/default.nix | 10 ++- nix/xdbg/result | 1 + 8 files changed, 174 insertions(+), 54 deletions(-) create mode 100644 nix/mls_validation_service/crate.nix create mode 100644 nix/mls_validation_service/default.nix create mode 120000 nix/xdbg/result diff --git a/flake.lock b/flake.lock index 9b1f92382..6b7d6f829 100644 --- a/flake.lock +++ b/flake.lock @@ -23,11 +23,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1729492502, - "narHash": "sha256-d6L4bBlUWr4sHC+eRXo+4acFPEFXKmqHpM/BfQ5gQQw=", + "lastModified": 1732343620, + "narHash": "sha256-IuOzr1HjFK8RxeDITfe1LQKgbUjgqlgeGc8jf9tKAuY=", "owner": "nix-community", "repo": "fenix", - "rev": "4002a1ec3486b855f341d2b864ba06b61e73af28", + "rev": "cb6515f398908e1c74dea085e72b3e3a0a81c6e2", "type": "github" }, "original": { @@ -56,16 +56,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1729307008, - "narHash": "sha256-QUvb6epgKi9pCu9CttRQW4y5NqJ+snKr1FZpG/x3Wtc=", + "lastModified": 1732014248, + "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a9b86fc2290b69375c5542b622088eb6eca2a7c3", + "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", "type": "github" }, "original": { "owner": "NixOS", - "ref": "nixos-24.05", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } @@ -94,11 +94,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1729454508, - "narHash": "sha256-1W5B/CnLgdC03iIFG0wtawO1+dGDWDpc84PeOHo2ecU=", + "lastModified": 1732050317, + "narHash": "sha256-G5LUEOC4kvB/Xbkglv0Noi04HnCfryur7dVjzlHkgpI=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "9323b5385863739d1c113f02e4cf3f2777c09977", + "rev": "c0bbbb3e5d7d1d1d60308c8270bfd5b250032bb4", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 68a6547bb..8aa036166 100644 --- a/flake.nix +++ b/flake.nix @@ -1,7 +1,7 @@ # Flake Shell for building release artifacts for swift and kotlin { inputs = { - nixpkgs.url = "github:NixOS/nixpkgs/nixos-24.05"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; fenix = { url = "github:nix-community/fenix"; @@ -21,7 +21,6 @@ outputs = inputs@{ flake-parts, fenix, crane, ... }: flake-parts.lib.mkFlake { inherit inputs; } { - flake = { }; systems = import inputs.systems; perSystem = { pkgs, lib, inputs', system, ... }: let @@ -61,7 +60,6 @@ ./xmtp_id/artifact ./xmtp_mls/migrations ]; - binFileSetForWorkspace = lib.fileset.unions [ (commonCargoSources ./examples/cli) (commonCargoSources ./mls_validation_service) @@ -71,23 +69,36 @@ (commonCargoSources ./bindings_ffi) (commonCargoSources ./xmtp_debug) ]; - - fileSetForWorkspace = lib.fileset.unions [ binFileSetForWorkspace libFileSetForWorkspace ]; - - filesets = { inherit fileSetForWorkspace binFileSetForWorkspace libFileSetForWorkspace; }; - xdbg = pkgs.callPackage ./nix/xdbg { - inherit craneLib filesets; + fileSetForCrate = crate: lib.fileset.unions [ + libFileSetForWorkspace + crate + ]; + fileSetForWorkspace = lib.fileset.unions [ + binFileSetForWorkspace + libFileSetForWorkspace + ]; + filesets = { + inherit + fileSetForWorkspace + binFileSetForWorkspace + libFileSetForWorkspace + fileSetForCrate; + }; + xdbg = import ./nix/xdbg { + inherit pkgs craneLib filesets; + }; + validationService = import ./nix/mls_validation_service { + inherit pkgs craneLib filesets; }; in { - _module. args. pkgs = import inputs.nixpkgs pkgConfig; + _module.args.pkgs = import inputs.nixpkgs pkgConfig; devShells.android = pkgs.callPackage ./nix/android.nix { inherit rust-toolchain; }; - devShells.muslXdbg = xdbg.muslXDbg.devShell; - devShells.xdbg = xdbg.devShell; packages = { xdbg = xdbg.bin; xdbgDocker = xdbg.dockerImage; - muslXdbg = xdbg.muslXDbg.bin; + validationService = validationService.bin; + validationServiceDocker = validationService.dockerImage; }; }; }; diff --git a/nix/android.nix b/nix/android.nix index 8c77c0683..fbba2150a 100644 --- a/nix/android.nix +++ b/nix/android.nix @@ -8,7 +8,6 @@ , cargo-ndk , sqlite , openssl -, libiconv , lib , rust-toolchain }: @@ -55,7 +54,6 @@ mkShell { openssl ] ++ lib.optionals stdenv.isDarwin [ # optional packages if on darwin, in order to check if build passes locally - libiconv frameworks.CoreServices frameworks.Carbon frameworks.ApplicationServices diff --git a/nix/mls_validation_service/crate.nix b/nix/mls_validation_service/crate.nix new file mode 100644 index 000000000..e3bca831e --- /dev/null +++ b/nix/mls_validation_service/crate.nix @@ -0,0 +1,95 @@ +{ openssl +, sqlite +, sqlcipher +, perl +, lib +, pkg-config +, stdenv +, craneLib +, darwin +, filesets +, mkShell +, rustTarget ? null +}: +let + inherit (stdenv) hostPlatform; + upperTarget = lib.strings.toUpper (builtins.replaceStrings [ "-" ] [ "_" ] rustTarget); + + filesetForCrate = crate: lib.fileset.toSource { + root = ./../..; + fileset = filesets.filesetForCrate crate; + }; + + filesetForWorkspace = lib.fileset.toSource { + root = ./../..; + fileset = filesets.fileSetForWorkspace; + }; + + linkerArgs = if rustTarget == null then { } else { + HOST_CC = "${stdenv.cc.nativePrefix}cc"; + TARGET_CC = "${stdenv.cc.targetPrefix}cc"; + # https://docs.rs/openssl/latest/openssl/#manual + "${upperTarget}_OPENSSL_DIR" = "${openssl.out}"; + "${upperTarget}_OPENSSL_LIB_DIR" = "${openssl.out}/lib"; + "${upperTarget}_OPENSSL_INCLUDE_DIR" = "${openssl.dev}/include"; + # Important because otherwise nix won't be able to link in the correct + # openssl library from the cross pkg set + OPENSSL_NO_VENDOR = 1; + CARGO_BUILD_TARGET = rustTarget; + "CARGO_TARGET_${upperTarget}_LINKER" = "${stdenv.cc.targetPrefix}cc"; + }; + + commonArgs = { + src = filesetForWorkspace; + strictDeps = true; + + # Used to build on the current/build machine + nativeBuildInputs = [ + pkg-config + stdenv.cc + perl + ]; + + # Libraries that will run on the host machine + # that to be linked + buildInputs = [ + # Add additional build inputs here + openssl + sqlite + sqlcipher + ] ++ lib.optionals hostPlatform.isDarwin + (with darwin.apple_sdk; + [ + frameworks.Security + frameworks.SystemConfiguration + ]); + + doCheck = false; + cargoExtraArgs = "--workspace --exclude xmtpv3 --exclude bindings_node --exclude bindings_wasm --exclude xmtp_cli --exclude xtask"; + RUSTFLAGS = [ "--cfg" "tracing_unstable" ]; + OPENSSL_DIR = "${openssl.out}"; + OPENSSL_INCLUDE_DIR = "${openssl.dev}/include"; + } // linkerArgs; + + cargoArtifacts = craneLib.buildDepsOnly commonArgs; + + bin = craneLib.buildPackage ({ + inherit cargoArtifacts; + inherit (craneLib.crateNameFromCargoToml { + cargoToml = ./../../mls_validation_service/Cargo.toml; + }) version pname; + cargoExtraArgs = "--package mls_validation_service"; + src = filesetForCrate ./../../mls_validation_service; + doCheck = false; + + RUST_BACKTRACE = 1; + } // commonArgs); + + devShell = mkShell + { + inputsFrom = [ bin ]; + }; +in +{ + inherit bin devShell; +} diff --git a/nix/mls_validation_service/default.nix b/nix/mls_validation_service/default.nix new file mode 100644 index 000000000..03c044f28 --- /dev/null +++ b/nix/mls_validation_service/default.nix @@ -0,0 +1,23 @@ +{ pkgs, craneLib, filesets }: +let + mls_validation_service = pkgs.callPackage ./crate.nix { inherit craneLib filesets; }; + muslService = pkgs.pkgsCross.musl64.callPackage ./crate.nix { + inherit craneLib filesets; rustTarget = "x86_64-unknown-linux-musl"; + }; + + dockerImage = pkgs.dockerTools.buildImage { + name = "mls_validation_service"; + tag = "latest"; + copyToRoot = [ muslService.bin ]; + config = { + Cmd = [ "${muslService.bin}/bin/xdbg --help" ]; + }; + }; +in +{ + + inherit (mls_validation_service) bin devShell; + inherit muslService; + inherit dockerImage; +} + diff --git a/nix/xdbg/crate.nix b/nix/xdbg/crate.nix index 5eb917f34..201f81600 100644 --- a/nix/xdbg/crate.nix +++ b/nix/xdbg/crate.nix @@ -1,7 +1,7 @@ { openssl , sqlite +, sqlcipher , perl -, libiconv , lib , pkg-config , stdenv @@ -10,12 +10,16 @@ , filesets , mkShell , rustTarget ? null -, isStatic ? false }: let inherit (stdenv) hostPlatform; upperTarget = lib.strings.toUpper (builtins.replaceStrings [ "-" ] [ "_" ] rustTarget); + filesetForCrate = crate: lib.fileset.toSource { + root = ./../..; + fileset = filesets.filesetForCrate crate; + }; + filesetForWorkspace = lib.fileset.toSource { root = ./../..; fileset = filesets.fileSetForWorkspace; @@ -24,16 +28,18 @@ let linkerArgs = if rustTarget == null then { } else { HOST_CC = "${stdenv.cc.nativePrefix}cc"; TARGET_CC = "${stdenv.cc.targetPrefix}cc"; + # https://docs.rs/openssl/latest/openssl/#manual "${upperTarget}_OPENSSL_DIR" = "${openssl.out}"; "${upperTarget}_OPENSSL_LIB_DIR" = "${openssl.out}/lib"; "${upperTarget}_OPENSSL_INCLUDE_DIR" = "${openssl.dev}/include"; - + # Important because otherwise nix won't be able to link in the correct + # openssl library from the cross pkg set + OPENSSL_NO_VENDOR = 1; CARGO_BUILD_TARGET = rustTarget; "CARGO_TARGET_${upperTarget}_LINKER" = "${stdenv.cc.targetPrefix}cc"; - CARGO_BUILD_RUSTFLAGS = if isStatic then "-C target-feature=+crt-static" else ""; }; - commonArgs = ({ + commonArgs = { src = filesetForWorkspace; strictDeps = true; @@ -42,8 +48,6 @@ let pkg-config stdenv.cc perl - ] ++ lib.optionals stdenv.isDarwin [ - libiconv ]; # Libraries that will run on the host machine @@ -52,18 +56,20 @@ let # Add additional build inputs here openssl sqlite + sqlcipher ] ++ lib.optionals hostPlatform.isDarwin (with darwin.apple_sdk; [ - libiconv frameworks.Security frameworks.SystemConfiguration ]); - cargoExtraArgs = "--workspace --exclude xmtpv3"; + + doCheck = false; + cargoExtraArgs = "--workspace --exclude xmtpv3 --exclude bindings_node --exclude bindings_wasm --exclude xmtp_cli --exclude xtask"; RUSTFLAGS = [ "--cfg" "tracing_unstable" ]; OPENSSL_DIR = "${openssl.out}"; OPENSSL_INCLUDE_DIR = "${openssl.dev}/include"; - } // linkerArgs); + } // linkerArgs; cargoArtifacts = craneLib.buildDepsOnly commonArgs; @@ -73,7 +79,7 @@ let cargoToml = ./../../xmtp_debug/Cargo.toml; }) version pname; cargoExtraArgs = "--package xdbg"; - src = filesetForWorkspace; + src = filesetForCrate ./../../xmtp_debug; doCheck = false; RUST_BACKTRACE = 1; @@ -82,18 +88,6 @@ let devShell = mkShell { inputsFrom = [ bin ]; - OPENSSL_DIR = "${openssl.out}"; - OPENSSL_LIB_DIR = "${openssl.out}/lib"; - OPENSSL_INCLUDE_DIR = "${openssl.dev}/include"; - HOST_CC = "${stdenv.cc.nativePrefix}cc"; - TARGET_CC = "${stdenv.cc.targetPrefix}cc"; - "${upperTarget}_OPENSSL_DIR" = "${openssl.out}"; - "${upperTarget}_OPENSSL_LIB_DIR" = "${openssl.out}/lib"; - "${upperTarget}_OPENSSL_INCLUDE_DIR" = "${openssl.dev}/include"; - - CARGO_BUILD_TARGET = rustTarget; - "CARGO_TARGET_${upperTarget}_LINKER" = "${stdenv.cc.targetPrefix}cc"; - CARGO_BUILD_RUSTFLAGS = if isStatic then "-C target-feature=+crt-static" else ""; }; in { diff --git a/nix/xdbg/default.nix b/nix/xdbg/default.nix index ff1445ddf..6c3ae1214 100644 --- a/nix/xdbg/default.nix +++ b/nix/xdbg/default.nix @@ -1,18 +1,16 @@ -{ pkgs, craneLib, filesets, ... }: +{ pkgs, craneLib, filesets }: let - xdbg = pkgs.callPackage ./crate.nix { inherit craneLib filesets; }; muslXDbg = pkgs.pkgsCross.musl64.callPackage ./crate.nix { inherit craneLib filesets; rustTarget = "x86_64-unknown-linux-musl"; - isStatic = true; }; dockerImage = pkgs.dockerTools.buildImage { - name = " xdbg"; - tag = " latest"; + name = "xdbg"; + tag = "latest"; copyToRoot = [ muslXDbg.bin ]; config = { - Cmd = [ "${ muslXDbg.bin}/bin/xdbg" ]; + Cmd = [ "${muslXDbg.bin}/bin/xdbg --help" ]; }; }; in diff --git a/nix/xdbg/result b/nix/xdbg/result new file mode 120000 index 000000000..ff9d143e6 --- /dev/null +++ b/nix/xdbg/result @@ -0,0 +1 @@ +/nix/store/rwhlnfgql23bkim917gl5llvnf966dwb-xdbg-0.1.0 \ No newline at end of file From cd1719f2d9dd5ad7d80d96bc3d590b15539d420f Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Mon, 25 Nov 2024 15:25:11 -0500 Subject: [PATCH 3/5] gitignore --- .gitignore | 1 + nix/mls_validation_service/default.nix | 18 +++++++++++------- nix/xdbg/default.nix | 18 +++++++++++------- 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/.gitignore b/.gitignore index b888df5ef..b9fd9a534 100644 --- a/.gitignore +++ b/.gitignore @@ -167,3 +167,4 @@ ecies_bindings_wasm/ chain_urls.json result/** +result diff --git a/nix/mls_validation_service/default.nix b/nix/mls_validation_service/default.nix index 03c044f28..87d5dac13 100644 --- a/nix/mls_validation_service/default.nix +++ b/nix/mls_validation_service/default.nix @@ -1,16 +1,21 @@ -{ pkgs, craneLib, filesets }: +{ + pkgs, + craneLib, + filesets, +}: let mls_validation_service = pkgs.callPackage ./crate.nix { inherit craneLib filesets; }; muslService = pkgs.pkgsCross.musl64.callPackage ./crate.nix { - inherit craneLib filesets; rustTarget = "x86_64-unknown-linux-musl"; + inherit craneLib filesets; + rustTarget = "x86_64-unknown-linux-musl"; }; - dockerImage = pkgs.dockerTools.buildImage { - name = "mls_validation_service"; + dockerImage = pkgs.dockerTools.streamLayeredImage { + name = "xmtp/mls_validation_service"; tag = "latest"; - copyToRoot = [ muslService.bin ]; + contents = [ muslService.bin ]; config = { - Cmd = [ "${muslService.bin}/bin/xdbg --help" ]; + Cmd = [ "${muslService.bin}/bin/mls_validation_service" ]; }; }; in @@ -20,4 +25,3 @@ in inherit muslService; inherit dockerImage; } - diff --git a/nix/xdbg/default.nix b/nix/xdbg/default.nix index 6c3ae1214..d34947138 100644 --- a/nix/xdbg/default.nix +++ b/nix/xdbg/default.nix @@ -1,16 +1,21 @@ -{ pkgs, craneLib, filesets }: +{ + pkgs, + craneLib, + filesets, +}: let xdbg = pkgs.callPackage ./crate.nix { inherit craneLib filesets; }; muslXDbg = pkgs.pkgsCross.musl64.callPackage ./crate.nix { - inherit craneLib filesets; rustTarget = "x86_64-unknown-linux-musl"; + inherit craneLib filesets; + rustTarget = "x86_64-unknown-linux-musl"; }; - dockerImage = pkgs.dockerTools.buildImage { - name = "xdbg"; + dockerImage = pkgs.dockerTools.streamLayeredImage { + name = "xmtp/xdbg"; tag = "latest"; - copyToRoot = [ muslXDbg.bin ]; + contents = [ muslXDbg.bin ]; config = { - Cmd = [ "${muslXDbg.bin}/bin/xdbg --help" ]; + Cmd = [ "${muslXDbg.bin}/bin/xdbg" ]; }; }; in @@ -20,4 +25,3 @@ in inherit muslXDbg; inherit dockerImage; } - From c686f6cfd09144d1af26d715261ad6a60caef320 Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Fri, 13 Dec 2024 15:35:51 -0500 Subject: [PATCH 4/5] xdbg docker build --- .github/workflows/release-xdbg.yml | 37 +++++++++++++++++++++++++ flake.lock | 38 +++++++++++++------------- flake.nix | 3 +- nix/mls_validation_service/default.nix | 6 ++-- nix/xdbg/default.nix | 14 ++++------ nix/xdbg/result | 1 - 6 files changed, 66 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/release-xdbg.yml delete mode 120000 nix/xdbg/result diff --git a/.github/workflows/release-xdbg.yml b/.github/workflows/release-xdbg.yml new file mode 100644 index 000000000..3e034d699 --- /dev/null +++ b/.github/workflows/release-xdbg.yml @@ -0,0 +1,37 @@ +name: Build and Push xdbgDocker +on: + push: + branches: + - main + workflow_dispatch: +jobs: + build-and-push: + runs-on: ubuntu-latest + strategy: + matrix: + platform: [aarch64-darwin, x86_64-linux, aarch64-linux, x86_64-darwin] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Install Nix + uses: cachix/install-nix-action@v20 + with: + nix_path: nixpkgs=channel:nixos-unstable + - uses: cachix/cachix-action@v14 + with: + name: xmtp + authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' + - name: Build xdbgDocker + run: | + nix build .#packages.${{ matrix.platform }}.xdbgDocker + - name: Log in to GitHub Container Registry + run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin + - name: Tag Docker image + run: | + IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:xdbg-${{ matrix.platform }} + nix path-info .#packages.${{ matrix.platform }}.xdbgDocker | xargs -I {} docker load < {}/docker-image.tar.gz + docker tag $(docker images --filter "label=org.opencontainers.image.title=xdbg" -q):latest $IMAGE_NAME + - name: Push Docker image to GHCR + run: | + IMAGE_NAME=ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:xdbg-${{ matrix.platform }} + docker push $IMAGE_NAME diff --git a/flake.lock b/flake.lock index 6b7d6f829..fda613fd1 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1731974733, - "narHash": "sha256-enYSSZVVl15FI5p+0Y5/Ckf5DZAvXe6fBrHxyhA/njc=", + "lastModified": 1733286231, + "narHash": "sha256-mlIDSv1/jqWnH8JTiOV7GMUNPCXL25+6jmD+7hdxx5o=", "owner": "ipetkov", "repo": "crane", - "rev": "3cb338ce81076ce5e461cf77f7824476addb0e1c", + "rev": "af1556ecda8bcf305820f68ec2f9d77b41d9cc80", "type": "github" }, "original": { @@ -23,11 +23,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1732343620, - "narHash": "sha256-IuOzr1HjFK8RxeDITfe1LQKgbUjgqlgeGc8jf9tKAuY=", + "lastModified": 1733380458, + "narHash": "sha256-H+IQB6cJ7ji/YD537pcSUWlwGGJ49RoYylBonyNW9hk=", "owner": "nix-community", "repo": "fenix", - "rev": "cb6515f398908e1c74dea085e72b3e3a0a81c6e2", + "rev": "08c9e4e29865b60cb81189f8e4de0dccaf297865", "type": "github" }, "original": { @@ -41,11 +41,11 @@ "nixpkgs-lib": "nixpkgs-lib" }, "locked": { - "lastModified": 1730504689, - "narHash": "sha256-hgmguH29K2fvs9szpq2r3pz2/8cJd2LPS+b4tfNFCwE=", + "lastModified": 1733312601, + "narHash": "sha256-4pDvzqnegAfRkPwO3wmwBhVi/Sye1mzps0zHWYnP88c=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "506278e768c2a08bec68eb62932193e341f55c90", + "rev": "205b12d8b7cd4802fbcb8e8ef6a0f1408781a4f9", "type": "github" }, "original": { @@ -56,11 +56,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1732014248, - "narHash": "sha256-y/MEyuJ5oBWrWAic/14LaIr/u5E0wRVzyYsouYY3W6w=", + "lastModified": 1733212471, + "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "23e89b7da85c3640bbc2173fe04f4bd114342367", + "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776", "type": "github" }, "original": { @@ -72,14 +72,14 @@ }, "nixpkgs-lib": { "locked": { - "lastModified": 1730504152, - "narHash": "sha256-lXvH/vOfb4aGYyvFmZK/HlsNsr/0CVWlwYvo2rxJk3s=", + "lastModified": 1733096140, + "narHash": "sha256-1qRH7uAUsyQI7R1Uwl4T+XvdNv778H0Nb5njNrqvylY=", "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" }, "original": { "type": "tarball", - "url": "https://github.com/NixOS/nixpkgs/archive/cc2f28000298e1269cea6612cd06ec9979dd5d7f.tar.gz" + "url": "https://github.com/NixOS/nixpkgs/archive/5487e69da40cbd611ab2cadee0b4637225f7cfae.tar.gz" } }, "root": { @@ -94,11 +94,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1732050317, - "narHash": "sha256-G5LUEOC4kvB/Xbkglv0Noi04HnCfryur7dVjzlHkgpI=", + "lastModified": 1733330394, + "narHash": "sha256-1jwtAQYtErSsfkEQFvZJ9wJBrLGltzlvZKZzPXhpfpE=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "c0bbbb3e5d7d1d1d60308c8270bfd5b250032bb4", + "rev": "f499faf72bcd2abbfbf3d7171e5191100547a3df", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 8aa036166..d3d0a2c36 100644 --- a/flake.nix +++ b/flake.nix @@ -27,7 +27,7 @@ fenixPkgs = inputs'.fenix.packages; rust-toolchain = fenixPkgs.fromToolchainFile { file = ./rust-toolchain; - sha256 = "sha256-yMuSb5eQPO/bHv+Bcf/US8LVMbf/G/0MSfiPwBhiPpk="; + sha256 = "sha256-s1RPtyvDGJaX/BisLT+ifVfuhDT1nZkZ1NcK8sbwELM="; }; pkgConfig = { @@ -84,6 +84,7 @@ libFileSetForWorkspace fileSetForCrate; }; + xdbg = import ./nix/xdbg { inherit pkgs craneLib filesets; }; diff --git a/nix/mls_validation_service/default.nix b/nix/mls_validation_service/default.nix index 87d5dac13..6579ba2c3 100644 --- a/nix/mls_validation_service/default.nix +++ b/nix/mls_validation_service/default.nix @@ -10,12 +10,12 @@ let rustTarget = "x86_64-unknown-linux-musl"; }; - dockerImage = pkgs.dockerTools.streamLayeredImage { - name = "xmtp/mls_validation_service"; + dockerImage = pkgs.dockerTools.buildImage { + name = "xmtp/mls-validation-service"; tag = "latest"; contents = [ muslService.bin ]; config = { - Cmd = [ "${muslService.bin}/bin/mls_validation_service" ]; + Cmd = [ "${muslService.bin}/bin/mls-validation-service" ]; }; }; in diff --git a/nix/xdbg/default.nix b/nix/xdbg/default.nix index d34947138..07ed11cd2 100644 --- a/nix/xdbg/default.nix +++ b/nix/xdbg/default.nix @@ -1,19 +1,14 @@ -{ - pkgs, - craneLib, - filesets, -}: +{ pkgs, craneLib, filesets }: let xdbg = pkgs.callPackage ./crate.nix { inherit craneLib filesets; }; muslXDbg = pkgs.pkgsCross.musl64.callPackage ./crate.nix { - inherit craneLib filesets; - rustTarget = "x86_64-unknown-linux-musl"; + inherit craneLib filesets; rustTarget = "x86_64-unknown-linux-musl"; }; - dockerImage = pkgs.dockerTools.streamLayeredImage { + dockerImage = pkgs.dockerTools.buildImage { name = "xmtp/xdbg"; tag = "latest"; - contents = [ muslXDbg.bin ]; + copyToRoot = [ muslXDbg.bin ]; config = { Cmd = [ "${muslXDbg.bin}/bin/xdbg" ]; }; @@ -25,3 +20,4 @@ in inherit muslXDbg; inherit dockerImage; } + diff --git a/nix/xdbg/result b/nix/xdbg/result deleted file mode 120000 index ff9d143e6..000000000 --- a/nix/xdbg/result +++ /dev/null @@ -1 +0,0 @@ -/nix/store/rwhlnfgql23bkim917gl5llvnf966dwb-xdbg-0.1.0 \ No newline at end of file From f7be8b6dabc1a258ff6e4a41e3d009111340bbb1 Mon Sep 17 00:00:00 2001 From: Andrew Plaza Date: Fri, 13 Dec 2024 16:22:28 -0500 Subject: [PATCH 5/5] add filter for stream all messages test to nextest --- .cargo/nextest.toml | 1 + .github/workflows/test-http-api.yml | 4 ++-- flake.lock | 24 ++++++++++++------------ flake.nix | 5 ++--- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.cargo/nextest.toml b/.cargo/nextest.toml index 07216b1ff..b7afc9364 100644 --- a/.cargo/nextest.toml +++ b/.cargo/nextest.toml @@ -1,2 +1,3 @@ [profile.default] retries = 3 +default-filter = "not test(test_stream_all_messages_does_not_lose_messages)" diff --git a/.github/workflows/test-http-api.yml b/.github/workflows/test-http-api.yml index e906f38aa..92e6c60cb 100644 --- a/.github/workflows/test-http-api.yml +++ b/.github/workflows/test-http-api.yml @@ -41,6 +41,6 @@ jobs: - name: Install nextest uses: taiki-e/install-action@nextest - name: build tests - run: cargo nextest run --no-run --tests --workspace --exclude xmtp_api_grpc --exclude xmtpv3 --exclude bindings_node --exclude bindings_wasm --features http-api + run: cargo nextest run --config-file ".cargo/nextest.toml" --no-run --tests --workspace --exclude xmtp_api_grpc --exclude xmtpv3 --exclude bindings_node --exclude bindings_wasm --features http-api - name: cargo test - run: cargo nextest run --workspace --exclude xmtp_api_grpc --exclude xmtpv3 --exclude bindings_node --exclude bindings_wasm --features http-api --test-threads 2 + run: cargo nextest run --config-file ".cargo/nextest.toml" --workspace --exclude xmtp_api_grpc --exclude xmtpv3 --exclude bindings_node --exclude bindings_wasm --features http-api --test-threads 2 diff --git a/flake.lock b/flake.lock index fda613fd1..ac17cfbc2 100644 --- a/flake.lock +++ b/flake.lock @@ -2,11 +2,11 @@ "nodes": { "crane": { "locked": { - "lastModified": 1733286231, - "narHash": "sha256-mlIDSv1/jqWnH8JTiOV7GMUNPCXL25+6jmD+7hdxx5o=", + "lastModified": 1733688869, + "narHash": "sha256-KrhxxFj1CjESDrL5+u/zsVH0K+Ik9tvoac/oFPoxSB8=", "owner": "ipetkov", "repo": "crane", - "rev": "af1556ecda8bcf305820f68ec2f9d77b41d9cc80", + "rev": "604637106e420ad99907cae401e13ab6b452e7d9", "type": "github" }, "original": { @@ -23,11 +23,11 @@ "rust-analyzer-src": "rust-analyzer-src" }, "locked": { - "lastModified": 1733380458, - "narHash": "sha256-H+IQB6cJ7ji/YD537pcSUWlwGGJ49RoYylBonyNW9hk=", + "lastModified": 1734071760, + "narHash": "sha256-i5/1cvgahF0lvtRkg9aKlYr0SuE8hNO7xaqvdkc+qXE=", "owner": "nix-community", "repo": "fenix", - "rev": "08c9e4e29865b60cb81189f8e4de0dccaf297865", + "rev": "db0bcf236f561ebbac1204074757c26c53a3d63c", "type": "github" }, "original": { @@ -56,11 +56,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1733212471, - "narHash": "sha256-M1+uCoV5igihRfcUKrr1riygbe73/dzNnzPsmaLCmpo=", + "lastModified": 1733940404, + "narHash": "sha256-Pj39hSoUA86ZePPF/UXiYHHM7hMIkios8TYG29kQT4g=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "55d15ad12a74eb7d4646254e13638ad0c4128776", + "rev": "5d67ea6b4b63378b9c13be21e2ec9d1afc921713", "type": "github" }, "original": { @@ -94,11 +94,11 @@ "rust-analyzer-src": { "flake": false, "locked": { - "lastModified": 1733330394, - "narHash": "sha256-1jwtAQYtErSsfkEQFvZJ9wJBrLGltzlvZKZzPXhpfpE=", + "lastModified": 1734022706, + "narHash": "sha256-rIz8/rsTP5N7uLSyFbHZ+ink6EHBKkWFAQPkzhq7/YM=", "owner": "rust-lang", "repo": "rust-analyzer", - "rev": "f499faf72bcd2abbfbf3d7171e5191100547a3df", + "rev": "9b2e72c40454012cbac8a1aa94d65931e3a7b881", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index b5b97d1e2..a738e9bb6 100644 --- a/flake.nix +++ b/flake.nix @@ -22,9 +22,8 @@ outputs = inputs@{ flake-parts, fenix, crane, ... }: flake-parts.lib.mkFlake { inherit inputs; } { systems = import inputs.systems; - perSystem = { pkgs, lib, inputs', system, ... }: + perSystem = { pkgs, lib, system, ... }: let - fenixPkgs = inputs'.fenix.packages; androidTargets = [ "aarch64-linux-android" "armv7-linux-androideabi" @@ -36,7 +35,7 @@ rust-toolchain = with fenix.packages.${system}; combine [ stable.cargo stable.rustc - (pkgs.lib.forEach + (lib.forEach androidTargets (target: targets."${target}".stable.rust-std)) targets.x86_64-unknown-linux-musl.stable.rust-std