difftreelog
nocargo testing
4 files changed
flake.lockdiffbeforeafterboth--- a/flake.lock
+++ b/flake.lock
@@ -49,6 +49,24 @@
"type": "github"
}
},
+ "flake-utils": {
+ "inputs": {
+ "systems": "systems"
+ },
+ "locked": {
+ "lastModified": 1701680307,
+ "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "flake-utils",
+ "type": "github"
+ }
+ },
"fleet-tf": {
"inputs": {
"flake-parts": [
@@ -124,6 +142,21 @@
"type": "github"
}
},
+ "nix-filter": {
+ "locked": {
+ "lastModified": 1687178632,
+ "narHash": "sha256-HS7YR5erss0JCaUijPeyg2XrisEb959FIct3n2TMGbE=",
+ "owner": "numtide",
+ "repo": "nix-filter",
+ "rev": "d90c75e8319d0dd9be67d933d8eb9d0894ec9174",
+ "type": "github"
+ },
+ "original": {
+ "owner": "numtide",
+ "repo": "nix-filter",
+ "type": "github"
+ }
+ },
"nixpkgs": {
"locked": {
"lastModified": 1781820577,
@@ -171,6 +204,46 @@
"type": "github"
}
},
+ "nocargo": {
+ "inputs": {
+ "flake-utils": "flake-utils",
+ "nix-filter": "nix-filter",
+ "nixpkgs": [
+ "nixpkgs"
+ ],
+ "registry-crates-io": [
+ "registry-crates-io"
+ ]
+ },
+ "locked": {
+ "lastModified": 1778181426,
+ "owner": "deltaex",
+ "repo": "nocargo",
+ "rev": "10b5ad93582992ed19bf2bd92840e544601cced4",
+ "type": "gitlab"
+ },
+ "original": {
+ "owner": "deltaex",
+ "repo": "nocargo",
+ "type": "gitlab"
+ }
+ },
+ "registry-crates-io": {
+ "flake": false,
+ "locked": {
+ "lastModified": 1783425179,
+ "narHash": "sha256-g9gZx0E3isjuTXGwmkY7pVmYAkYDn0UucxO5c+GOpvw=",
+ "owner": "rust-lang",
+ "repo": "crates.io-index",
+ "rev": "c4f52e3ab01b43153b474dda067993b982457908",
+ "type": "github"
+ },
+ "original": {
+ "owner": "rust-lang",
+ "repo": "crates.io-index",
+ "type": "github"
+ }
+ },
"root": {
"inputs": {
"crane": "crane",
@@ -178,6 +251,8 @@
"fleet-tf": "fleet-tf",
"nix": "nix",
"nixpkgs": "nixpkgs",
+ "nocargo": "nocargo",
+ "registry-crates-io": "registry-crates-io",
"rust-overlay": "rust-overlay",
"shelly": "shelly",
"treefmt-nix": "treefmt-nix"
@@ -216,6 +291,21 @@
"type": "github"
}
},
+ "systems": {
+ "locked": {
+ "lastModified": 1681028828,
+ "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
+ "owner": "nix-systems",
+ "repo": "default",
+ "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
+ "type": "github"
+ },
+ "original": {
+ "owner": "nix-systems",
+ "repo": "default",
+ "type": "github"
+ }
+ },
"treefmt-nix": {
"inputs": {
"nixpkgs": [
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.nixdiffbeforeafterboth1{2 lib,3 pkgs,4 stdenv,5 callPackage,6 fetchurl,7 pkg-config,8 rustPlatform,9 rustc,10 rofi,11 installShellFiles,12 inputs,13 remowt-agents-bundle,14 rustToolchain ? null,15}:16let17 system = stdenv.hostPlatform.system;18 nocargoSrc = inputs.nocargo;19 nocargoLib = import (nocargoSrc + "/lib") {20 inherit lib;21 inherit (inputs.nocargo.inputs) nix-filter;22 };23 toml2json = callPackage (nocargoSrc + "/toml2json") { };24 buildRustCrateUnwrapped = callPackage (nocargoSrc + "/build-rust-crate") {25 nocargo-lib = nocargoLib;26 inherit toml2json;27 };28 # nocargo passes profile.panic to every crate, breaking build script and29 # proc-macro linkage; cargo applies it only to final artifacts:30 # https://doc.rust-lang.org/cargo/reference/profiles.html#panic31 buildRustCrate =32 args:33 let34 profile = args.profile or { };35 crate = buildRustCrateUnwrapped (36 args37 // {38 profile = removeAttrs profile [ "panic" ];39 buildFlags = [ "--cfg=tokio_unstable" ] ++ args.buildFlags or [ ];40 # Every crate dev output propagates its transitive dev closure, and41 # the bintools hook emits -L for each one; on large dependency42 # closures the resulting NIX_LDFLAGS overflows the execve limit43 # ("Argument list too long"). Those entries only contain .rmeta;44 # rustc gets real paths via --extern and -Ldependency.45 postHook = ''46 _newLdflags=47 for _flag in $NIX_LDFLAGS; do48 if [[ "$_flag" == -L/nix/store/*-rust_*/lib ]]; then continue; fi49 _newLdflags+="''${_newLdflags:+ }$_flag"50 done51 export NIX_LDFLAGS="$_newLdflags"52 unset _newLdflags _flag53 '';54 }55 );56 in57 if profile.panic or "unwind" == "unwind" then58 crate59 else60 crate61 // {62 bin = crate.bin.overrideAttrs (old: {63 buildFlags = old.buildFlags ++ [ "-Cpanic=${profile.panic}" ];64 });65 };6667 extraProcMacroCrates = [68 "bifrostlink-macros"69 "curve25519-dalek-derive"70 "derive_more-impl"71 "iroh-metrics-derive"72 "jni-macros"73 "jni-sys-macros"74 "n0-error-macros"75 "proc-macro-error-attr2"76 "prost-derive"77 "spez"78 "test-log-macros"79 ];80 cratesIoOverride =81 import (nocargoSrc + "/crates-io-override") { inherit lib pkgs; }82 // lib.genAttrs extraProcMacroCrates (_: _: { procMacro = true; })83 // {84 derive_more = { version, ... }: { procMacro = lib.versionOlder version "1.0.0"; };85 test-log = { version, ... }: { procMacro = lib.versionOlder version "0.2.12"; };86 # scratch bakes env!("OUT_DIR") into its lib as a shared writable87 # directory, and cxx-build then creates files there from dependent88 # builds; a store path is immutable, so rebake it to a path that89 # exists in every build sandbox.90 scratch = _: {91 postConfigure = ''92 export OUT_DIR="$NIX_BUILD_TOP/rust-scratch-out-dir"93 mkdir -p "$OUT_DIR"94 '';95 };96 };97 cratesIoIndex = nocargoLib.pkg-info.mkIndex fetchurl inputs.registry-crates-io cratesIoOverride;9899 mkRustPackageOrWorkspace = callPackage nocargoLib.support.mkRustPackageOrWorkspace {100 defaultRegistries = {101 "https://github.com/rust-lang/crates.io-index" = cratesIoIndex;102 };103 inherit buildRustCrate;104 };105106 ws = mkRustPackageOrWorkspace {107 src = lib.cleanSourceWith {108 src = ../.;109 filter =110 path: type:111 (if type == "directory" then baseNameOf path != "target" else true)112 && (113 type == "directory"114 || lib.any (suffix: lib.hasSuffix suffix path) [115 ".rs"116 ".toml"117 ".cc"118 ".hh"119 ]120 || baseNameOf path == "Cargo.lock"121 );122 };123 rustc = if rustToolchain != null then rustToolchain else rustc;124 buildCrateOverrides = {125 nix-eval = _: {126 nativeBuildInputs = [127 pkg-config128 rustPlatform.bindgenHook129 ];130 propagatedBuildInputs = [131 inputs.nix.packages.${system}.nix-expr-c132 inputs.nix.packages.${system}.nix-flake-c133 inputs.nix.packages.${system}.nix-fetchers-c134 ];135 };136 fleet-base = _: {137 REMOWT_AGENTS_DIR = "${remowt-agents-bundle}";138 };139 remowt-ui-prompt = _: {140 ROFI = "${rofi}/bin/rofi";141 };142 };143 };144145 fleet = ws.release.fleet.bin;146in147stdenv.mkDerivation {148 pname = "fleet-nocargo";149 inherit (fleet) version;150151 nativeBuildInputs = [ installShellFiles ];152153 buildCommand = ''154 mkdir -p $out/bin155 ln -s ${fleet}/bin/* $out/bin/156157 for shell in bash fish zsh; do158 installShellCompletion --cmd fleet \159 --$shell <($out/bin/fleet complete --shell $shell)160 done161 '';162163 passthru.workspace = ws;164}