fumi/flake.nix

109 lines
3.7 KiB
Nix
Raw Permalink Normal View History

2026-09-28 16:03:53 +03:00
{
description = "fumi - Smol Mail client (Rust)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
2026-09-28 16:49:34 +03:00
# RNS carrier sources (upstream RNS.md sec 13): the build sandbox has no
# network, so every microReticulum FetchContent dependency is vendored as
# its own flake input and handed over via RNS_<DEP>_SOURCE_DIR.
# microReticulum is pinned at the commit bunshin verified against.
microReticulum = {
url = "github:attermann/microReticulum/40fa628809d57140180c1c833559ab96fec992c1";
flake = false;
};
rns-arduinojson = {
url = "github:bblanchon/ArduinoJson/ed69feadb95182dc53ac978975d310122060a767";
flake = false;
};
rns-msgpack = {
url = "github:hideakitai/MsgPack/1f552c31b940d6e9063ee17a4b3fa10c47b27169";
flake = false;
};
rns-arxcontainer = {
url = "github:hideakitai/ArxContainer/d6affcd0bc83219b863c20abf7c269214db8db2a";
flake = false;
};
rns-arxtypetraits = {
url = "github:hideakitai/ArxTypeTraits/702de9cc59c7e047cdc169ae3547718b289d2c02";
flake = false;
};
rns-debuglog = {
url = "github:hideakitai/DebugLog/b581f7dde6c276c5df684e2328f406d9754d2f46";
flake = false;
};
rns-crypto = {
url = "github:attermann/Crypto/984dc891330986c302a86c4e312d4f5abcc28359";
flake = false;
};
rns-microstore = {
url = "github:attermann/microStore/0f28567fe00ab8ab14624a34c2e9e0a000a44c46";
flake = false;
};
2026-09-28 16:03:53 +03:00
};
2026-09-28 16:49:34 +03:00
outputs = { self, nixpkgs, flake-utils, microReticulum, rns-arduinojson
, rns-msgpack, rns-arxcontainer, rns-arxtypetraits, rns-debuglog
, rns-crypto, rns-microstore }:
2026-09-28 16:03:53 +03:00
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs { inherit system; };
2026-09-28 16:49:34 +03:00
inherit (pkgs) lib;
# build.rs consumes these directly; with every dependency vendored,
# the cmake configure step never fetches.
rnsSourceEnv = {
MICRORETICULUM_SOURCE_DIR = "${microReticulum}";
RNS_ARDUINOJSON_SOURCE_DIR = "${rns-arduinojson}";
RNS_MSGPACK_SOURCE_DIR = "${rns-msgpack}";
RNS_ARXCONTAINER_SOURCE_DIR = "${rns-arxcontainer}";
RNS_ARXTYPETRAITS_SOURCE_DIR = "${rns-arxtypetraits}";
RNS_DEBUGLOG_SOURCE_DIR = "${rns-debuglog}";
RNS_CRYPTO_SOURCE_DIR = "${rns-crypto}";
RNS_MICROSTORE_SOURCE_DIR = "${rns-microstore}";
};
2026-09-28 16:03:53 +03:00
fumi = { rns ? false }: pkgs.rustPlatform.buildRustPackage {
pname = "fumi";
version = "0.1.0";
src = ./.;
cargoLock.lockFile = ./Cargo.lock;
2026-09-28 16:49:34 +03:00
nativeBuildInputs = [ pkgs.pkg-config ]
++ lib.optionals rns [ pkgs.cmake pkgs.ninja pkgs.gcc ];
buildFeatures = lib.optionals rns [ "rns" ];
env = lib.optionalAttrs rns rnsSourceEnv;
# ninja's setup hook claims buildPhase before the cargo hooks
# can, which would run ninja against no build.ninja instead of
# cargo; ninja here is only for build.rs to invoke through cmake.
dontUseNinjaBuild = rns;
dontUseNinjaCheck = rns;
dontUseNinjaInstall = rns;
2026-09-28 16:03:53 +03:00
};
in
{
packages.default = fumi { };
packages.rns = fumi { rns = true; };
apps.default = flake-utils.lib.mkApp {
drv = fumi { };
name = "fumi";
};
devShells.default = pkgs.mkShell {
2026-09-28 16:49:34 +03:00
packages = with pkgs; [
cargo
rustc
rustfmt
clippy
pkg-config
sqlite
cmake
ninja
gcc
];
env = rnsSourceEnv;
2026-09-28 16:03:53 +03:00
};
});
}