Add Nix flake package outputs for syn-cli, syn-tui, syn-gui
Build Debug APK / build (push) Failing after 14m48s

Use crane to build each binary as a separate flake package output.
Track Cargo.lock in git (required for Nix flake source visibility).
This commit is contained in:
Greg Shuflin
2026-04-14 14:43:13 -07:00
parent 5b8c8580ad
commit 3845bc3f10
4 changed files with 12413 additions and 2 deletions
-1
View File
@@ -11,7 +11,6 @@ rust/cli-app/tests/stores/
# Rust
rust/target/
rust/**/*.rs.bk
rust/Cargo.lock
# Android
*.iml
Generated
+16
View File
@@ -1,5 +1,20 @@
{
"nodes": {
"crane": {
"locked": {
"lastModified": 1775839657,
"narHash": "sha256-SPm9ck7jh3Un9nwPuMGbRU04UroFmOHjLP56T10MOeM=",
"owner": "ipetkov",
"repo": "crane",
"rev": "7cf72d978629469c4bd4206b95c402514c1f6000",
"type": "github"
},
"original": {
"owner": "ipetkov",
"repo": "crane",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
@@ -36,6 +51,7 @@
},
"root": {
"inputs": {
"crane": "crane",
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"rust-overlay": "rust-overlay"
+76 -1
View File
@@ -1,5 +1,5 @@
{
description = "TestAndroid";
description = "Synchronicity personal server runtime";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
@@ -7,6 +7,7 @@
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
flake-utils.url = "github:numtide/flake-utils";
};
@@ -14,6 +15,7 @@
self,
nixpkgs,
rust-overlay,
crane,
flake-utils,
}: let
rust-version = "1.92.0";
@@ -43,6 +45,74 @@
rustToolchain = pkgs.rust-bin.stable."${rust-version}".default.override {
targets = ["aarch64-linux-android"];
};
craneLib = (crane.mkLib pkgs).overrideToolchain rustToolchain;
# Source filtering — include Cargo sources and .slint UI files
rustSrc = pkgs.lib.cleanSourceWith {
src = ./rust;
filter = path: type:
(craneLib.filterCargoSources path type)
|| (builtins.match ".*\\.slint$" path != null);
};
# Common arguments shared across all builds
commonArgs = {
src = rustSrc;
pname = "synchronicity";
version = "0.1.0";
strictDeps = true;
nativeBuildInputs = [
pkgs.pkg-config
];
buildInputs = [
pkgs.openssl
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.wayland
pkgs.libxkbcommon
pkgs.fontconfig
];
};
# Build workspace deps once (shared across all binaries)
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
# Helper to build a single binary from the workspace
mkBin = name: extraArgs: craneLib.buildPackage (commonArgs // {
inherit cargoArtifacts;
cargoExtraArgs = "--bin ${name}";
# Only install the specific binary
doInstallCargoArtifacts = false;
} // extraArgs);
syn-cli = mkBin "syn-cli" {};
syn-tui = mkBin "syn-tui" {};
syn-gui = mkBin "syn-gui" {
buildInputs = commonArgs.buildInputs ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.libX11
pkgs.libxcursor
pkgs.libxrandr
pkgs.libxi
pkgs.libGL
];
# Slint needs to find wayland/X11 libs at runtime
postFixup = pkgs.lib.optionalString pkgs.stdenv.isLinux ''
patchelf --add-rpath ${pkgs.lib.makeLibraryPath [
pkgs.wayland
pkgs.libxkbcommon
pkgs.libGL
pkgs.libX11
pkgs.libxcursor
pkgs.libxrandr
pkgs.libxi
pkgs.fontconfig
]} $out/bin/syn-gui
'';
};
# CI scripts — source lives in scripts/ for proper shell highlighting
createReleaseCi = pkgs.writeShellScriptBin "create-release-ci" ''
export TEA_BIN="${pkgs.tea}/bin/tea"
@@ -57,6 +127,11 @@
exec bash ${./scripts/build-apk-ci.sh} "$@"
'';
in {
packages = {
inherit syn-cli syn-tui syn-gui;
default = syn-cli;
};
devShells.default = pkgs.mkShell {
buildInputs = [
buildApkCi
+12321
View File
File diff suppressed because it is too large Load Diff