difftreelog
nocargo testing
4 files changed
flake.lockdiffbeforeafterboth13 packageslockfile v7
Might be heavy and slow!
flake-compat
0f9255egithub.com/edolstra/flake-compat↘ 0↖ 1sourcegithub:edolstra/flake-compatchecksumsha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=used byflake-parts
f7c1a2dgithub.com/hercules-ci/flake-parts↘ 1↖ 3fleet-tf
aa2200agithub.com/CertainLach/fleet-tf↘ 3↖ 1git-hooks-nix
80479b6https://flakehub.com/f/cachix/git-hooks.nix/0.1.941↘ 3↖ 1sourcehttps://flakehub.com/f/cachix/git-hooks.nix/0.1.941checksumsha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=used bynix
bb8784fgithub.com/deltarocks/nix↘ 5↖ 2sourcegithub:deltarocks/nix/fleetused bynixpkgs
215d4d0github.com/NixOS/nixpkgs↘ 0↖ 1sourcegithub:NixOS/nixpkgschecksumsha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=used bynixpkgs
a62e6edgithub.com/NixOS/nixpkgs↘ 0↖ 1sourcegithub:NixOS/nixpkgschecksumsha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=used bynixpkgs
adf9aaagithub.com/nixos/nixpkgs↘ 0↖ 7sourcegithub:nixos/nixpkgs/release-26.05rust-overlay
c06d86dgithub.com/oxalica/rust-overlay↘ 1↖ 1shelly
b5dd29agithub.com/CertainLach/shelly↘ 0↖ 2sourcegithub:CertainLach/shellyused bytreefmt-nix
db94781github.com/numtide/treefmt-nix↘ 1↖ 1
18 packageslockfile v7
Might be heavy and slow!
crates.io-index
c4f52e3github.com/rust-lang/crates.io-index↘ 0↖ 2sourcegithub:rust-lang/crates.io-indexchecksumsha256-g9gZx0E3isjuTXGwmkY7pVmYAkYDn0UucxO5c+GOpvw=used bydefault
da67096github.com/nix-systems/default↘ 0↖ 1sourcegithub:nix-systems/defaultchecksumsha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=used byflake-compat
0f9255egithub.com/edolstra/flake-compat↘ 0↖ 1sourcegithub:edolstra/flake-compatchecksumsha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=used byflake-parts
f7c1a2dgithub.com/hercules-ci/flake-parts↘ 1↖ 3flake-utils
4022d58github.com/numtide/flake-utils↘ 1↖ 1sourcegithub:numtide/flake-utilschecksumsha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=depends onused byfleet-tf
aa2200agithub.com/CertainLach/fleet-tf↘ 3↖ 1git-hooks-nix
80479b6https://flakehub.com/f/cachix/git-hooks.nix/0.1.941↘ 3↖ 1sourcehttps://flakehub.com/f/cachix/git-hooks.nix/0.1.941checksumsha256-2Y53NGIX2vxfie1rOW0Qb86vjRZ7ngizoo+bnXU9D9k=used bynix
bb8784fgithub.com/deltarocks/nix↘ 5↖ 2sourcegithub:deltarocks/nix/fleetused bynix-filter
d90c75egithub.com/numtide/nix-filter↘ 0↖ 1sourcegithub:numtide/nix-filterchecksumsha256-HS7YR5erss0JCaUijPeyg2XrisEb959FIct3n2TMGbE=used bynixpkgs
215d4d0github.com/NixOS/nixpkgs↘ 0↖ 1sourcegithub:NixOS/nixpkgschecksumsha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=used bynixpkgs
a62e6edgithub.com/NixOS/nixpkgs↘ 0↖ 1sourcegithub:NixOS/nixpkgschecksumsha256-oamiKNfr2MS6yH64rUn99mIZjc45nGJlj9eGth/3Xuw=used bynixpkgs
adf9aaagithub.com/nixos/nixpkgs↘ 0↖ 8sourcegithub:nixos/nixpkgs/release-26.05nocargo
10b5ad9gitlab.com/deltaex/nocargo↘ 4↖ 1sourcegitlab:deltaex/nocargoused byrust-overlay
c06d86dgithub.com/oxalica/rust-overlay↘ 1↖ 1shelly
b5dd29agithub.com/CertainLach/shelly↘ 0↖ 2sourcegithub:CertainLach/shellyused bytreefmt-nix
db94781github.com/numtide/treefmt-nix↘ 1↖ 1
flake.nixdiffbeforeafterboth--- a/flake.nix
+++ b/flake.nix
@@ -12,6 +12,15 @@
inputs.nixpkgs-lib.follows = "nixpkgs";
};
crane.url = "github:ipetkov/crane";
+ nocargo = {
+ url = "gitlab:deltaex/nocargo";
+ inputs.nixpkgs.follows = "nixpkgs";
+ inputs.registry-crates-io.follows = "registry-crates-io";
+ };
+ registry-crates-io = {
+ url = "github:rust-lang/crates.io-index";
+ flake = false;
+ };
shelly.url = "github:CertainLach/shelly";
fleet-tf = {
url = "github:CertainLach/fleet-tf";
@@ -136,6 +145,7 @@
let
packages = pkgs.callPackages ./pkgs {
inherit craneLib inputs;
+ rustToolchain = rust;
};
in
packages // { default = packages.fleet; }
pkgs/default.nixdiffbeforeafterboth--- a/pkgs/default.nix
+++ b/pkgs/default.nix
@@ -2,12 +2,16 @@
callPackage,
craneLib,
inputs,
+ rustToolchain ? null,
}:
let
remowt-agents-bundle = callPackage ./remowt-agents-bundle.nix { inherit craneLib; };
in
{
fleet = callPackage ./fleet.nix { inherit craneLib inputs remowt-agents-bundle; };
+ fleet-nocargo = callPackage ./fleet-nocargo.nix {
+ inherit inputs remowt-agents-bundle rustToolchain;
+ };
fleet-install-secrets = callPackage ./fleet-install-secrets.nix { inherit craneLib; };
fleet-generator-helper = callPackage ./fleet-generator-helper.nix { inherit craneLib; };
fleet-usbd = callPackage ./fleet-usbd.nix { inherit craneLib inputs; };
pkgs/fleet-nocargo.nixdiffbeforeafterboth--- /dev/null
+++ b/pkgs/fleet-nocargo.nix
@@ -0,0 +1,164 @@
+{
+ lib,
+ pkgs,
+ stdenv,
+ callPackage,
+ fetchurl,
+ pkg-config,
+ rustPlatform,
+ rustc,
+ rofi,
+ installShellFiles,
+ inputs,
+ remowt-agents-bundle,
+ rustToolchain ? null,
+}:
+let
+ system = stdenv.hostPlatform.system;
+ nocargoSrc = inputs.nocargo;
+ nocargoLib = import (nocargoSrc + "/lib") {
+ inherit lib;
+ inherit (inputs.nocargo.inputs) nix-filter;
+ };
+ toml2json = callPackage (nocargoSrc + "/toml2json") { };
+ buildRustCrateUnwrapped = callPackage (nocargoSrc + "/build-rust-crate") {
+ nocargo-lib = nocargoLib;
+ inherit toml2json;
+ };
+ # nocargo passes profile.panic to every crate, breaking build script and
+ # proc-macro linkage; cargo applies it only to final artifacts:
+ # https://doc.rust-lang.org/cargo/reference/profiles.html#panic
+ buildRustCrate =
+ args:
+ let
+ profile = args.profile or { };
+ crate = buildRustCrateUnwrapped (
+ args
+ // {
+ profile = removeAttrs profile [ "panic" ];
+ buildFlags = [ "--cfg=tokio_unstable" ] ++ args.buildFlags or [ ];
+ # Every crate dev output propagates its transitive dev closure, and
+ # the bintools hook emits -L for each one; on large dependency
+ # closures the resulting NIX_LDFLAGS overflows the execve limit
+ # ("Argument list too long"). Those entries only contain .rmeta;
+ # rustc gets real paths via --extern and -Ldependency.
+ postHook = ''
+ _newLdflags=
+ for _flag in $NIX_LDFLAGS; do
+ if [[ "$_flag" == -L/nix/store/*-rust_*/lib ]]; then continue; fi
+ _newLdflags+="''${_newLdflags:+ }$_flag"
+ done
+ export NIX_LDFLAGS="$_newLdflags"
+ unset _newLdflags _flag
+ '';
+ }
+ );
+ in
+ if profile.panic or "unwind" == "unwind" then
+ crate
+ else
+ crate
+ // {
+ bin = crate.bin.overrideAttrs (old: {
+ buildFlags = old.buildFlags ++ [ "-Cpanic=${profile.panic}" ];
+ });
+ };
+
+ extraProcMacroCrates = [
+ "bifrostlink-macros"
+ "curve25519-dalek-derive"
+ "derive_more-impl"
+ "iroh-metrics-derive"
+ "jni-macros"
+ "jni-sys-macros"
+ "n0-error-macros"
+ "proc-macro-error-attr2"
+ "prost-derive"
+ "spez"
+ "test-log-macros"
+ ];
+ cratesIoOverride =
+ import (nocargoSrc + "/crates-io-override") { inherit lib pkgs; }
+ // lib.genAttrs extraProcMacroCrates (_: _: { procMacro = true; })
+ // {
+ derive_more = { version, ... }: { procMacro = lib.versionOlder version "1.0.0"; };
+ test-log = { version, ... }: { procMacro = lib.versionOlder version "0.2.12"; };
+ # scratch bakes env!("OUT_DIR") into its lib as a shared writable
+ # directory, and cxx-build then creates files there from dependent
+ # builds; a store path is immutable, so rebake it to a path that
+ # exists in every build sandbox.
+ scratch = _: {
+ postConfigure = ''
+ export OUT_DIR="$NIX_BUILD_TOP/rust-scratch-out-dir"
+ mkdir -p "$OUT_DIR"
+ '';
+ };
+ };
+ cratesIoIndex = nocargoLib.pkg-info.mkIndex fetchurl inputs.registry-crates-io cratesIoOverride;
+
+ mkRustPackageOrWorkspace = callPackage nocargoLib.support.mkRustPackageOrWorkspace {
+ defaultRegistries = {
+ "https://github.com/rust-lang/crates.io-index" = cratesIoIndex;
+ };
+ inherit buildRustCrate;
+ };
+
+ ws = mkRustPackageOrWorkspace {
+ src = lib.cleanSourceWith {
+ src = ../.;
+ filter =
+ path: type:
+ (if type == "directory" then baseNameOf path != "target" else true)
+ && (
+ type == "directory"
+ || lib.any (suffix: lib.hasSuffix suffix path) [
+ ".rs"
+ ".toml"
+ ".cc"
+ ".hh"
+ ]
+ || baseNameOf path == "Cargo.lock"
+ );
+ };
+ rustc = if rustToolchain != null then rustToolchain else rustc;
+ buildCrateOverrides = {
+ nix-eval = _: {
+ nativeBuildInputs = [
+ pkg-config
+ rustPlatform.bindgenHook
+ ];
+ propagatedBuildInputs = [
+ inputs.nix.packages.${system}.nix-expr-c
+ inputs.nix.packages.${system}.nix-flake-c
+ inputs.nix.packages.${system}.nix-fetchers-c
+ ];
+ };
+ fleet-base = _: {
+ REMOWT_AGENTS_DIR = "${remowt-agents-bundle}";
+ };
+ remowt-ui-prompt = _: {
+ ROFI = "${rofi}/bin/rofi";
+ };
+ };
+ };
+
+ fleet = ws.release.fleet.bin;
+in
+stdenv.mkDerivation {
+ pname = "fleet-nocargo";
+ inherit (fleet) version;
+
+ nativeBuildInputs = [ installShellFiles ];
+
+ buildCommand = ''
+ mkdir -p $out/bin
+ ln -s ${fleet}/bin/* $out/bin/
+
+ for shell in bash fish zsh; do
+ installShellCompletion --cmd fleet \
+ --$shell <($out/bin/fleet complete --shell $shell)
+ done
+ '';
+
+ passthru.workspace = ws;
+}