A better Rust ATProto crate

fixing the flake bc i re-arranged the packages a bit

Orual 07a4f0af 9f71397c

Changed files
+65 -37
crates
jacquard-lexgen
nix
scripts
crates/jacquard-lexicon/lexicons.kdl.example crates/jacquard-lexgen/lexicons.kdl.example
+39 -31
nix/modules/cross.nix
··· 1 {inputs, ...}: { 2 imports = [inputs.rust-flake.flakeModules.nixpkgs]; 3 4 - perSystem = {pkgs, lib, config, system, ...}: let 5 # Get the filtered source from rust-project 6 src = config.rust-project.src; 7 ··· 15 mkCrossPackage = { 16 crossSystem, 17 rustTarget, 18 - extraArgs ? {} 19 }: let 20 # Import nixpkgs with cross-compilation configured (no overlays) 21 pkgs-cross = import inputs.nixpkgs { ··· 32 craneLib = (inputs.crane.mkLib pkgs-cross).overrideToolchain rustToolchain; 33 34 # Common crane args 35 - commonArgs = { 36 - inherit src; 37 - pname = "jacquard-lexicon"; 38 - strictDeps = true; 39 - doCheck = false; # Tests require lexicon corpus files 40 41 - # Native build inputs (tools that run during build) 42 - nativeBuildInputs = with pkgs; [ 43 - installShellFiles 44 - ]; 45 46 - postInstall = '' 47 - # Install man pages and completions from build script output 48 - for outdir in target/${rustTarget}/release/build/jacquard-lexicon-*/out; do 49 - if [ -d "$outdir/man" ]; then 50 - installManPage $outdir/man/*.1 51 - fi 52 - if [ -d "$outdir/completions" ]; then 53 - for completion in $outdir/completions/*; do 54 - case "$(basename "$completion")" in 55 - *.bash) installShellCompletion --bash "$completion" ;; 56 - *.fish) installShellCompletion --fish "$completion" ;; 57 - _*) installShellCompletion --zsh "$completion" ;; 58 - esac 59 - done 60 - fi 61 - done 62 63 - # Install example lexicons.kdl config 64 - install -Dm644 ${./../../crates/jacquard-lexicon/lexicons.kdl.example} $out/share/doc/jacquard-lexicon/lexicons.kdl.example 65 - ''; 66 - } // extraArgs; 67 in 68 craneLib.buildPackage commonArgs; 69 in {
··· 1 {inputs, ...}: { 2 imports = [inputs.rust-flake.flakeModules.nixpkgs]; 3 4 + perSystem = { 5 + pkgs, 6 + lib, 7 + config, 8 + system, 9 + ... 10 + }: let 11 # Get the filtered source from rust-project 12 src = config.rust-project.src; 13 ··· 21 mkCrossPackage = { 22 crossSystem, 23 rustTarget, 24 + extraArgs ? {}, 25 }: let 26 # Import nixpkgs with cross-compilation configured (no overlays) 27 pkgs-cross = import inputs.nixpkgs { ··· 38 craneLib = (inputs.crane.mkLib pkgs-cross).overrideToolchain rustToolchain; 39 40 # Common crane args 41 + commonArgs = 42 + { 43 + inherit src; 44 + pname = "jacquard-lexgen"; 45 + strictDeps = true; 46 + doCheck = false; # Tests require lexicon corpus files 47 48 + # Native build inputs (tools that run during build) 49 + nativeBuildInputs = with pkgs; [ 50 + installShellFiles 51 + ]; 52 53 + postInstall = '' 54 + # Install man pages and completions from build script output 55 + for outdir in target/${rustTarget}/release/build/jacquard-lexgen-*/out; do 56 + if [ -d "$outdir/man" ]; then 57 + installManPage $outdir/man/*.1 58 + fi 59 + if [ -d "$outdir/completions" ]; then 60 + for completion in $outdir/completions/*; do 61 + case "$(basename "$completion")" in 62 + *.bash) installShellCompletion --bash "$completion" ;; 63 + *.fish) installShellCompletion --fish "$completion" ;; 64 + _*) installShellCompletion --zsh "$completion" ;; 65 + esac 66 + done 67 + fi 68 + done 69 70 + # Install example lexicons.kdl config 71 + install -Dm644 ${./../../crates/jacquard-lexgen/lexicons.kdl.example} $out/share/doc/jacquard-lexgen/lexicons.kdl.example 72 + ''; 73 + } 74 + // extraArgs; 75 in 76 craneLib.buildPackage commonArgs; 77 in {
+24 -4
nix/modules/rust.nix
··· 78 crane = { 79 args = { 80 buildInputs = commonBuildInputs; 81 nativeBuildInputs = [pkgs.installShellFiles]; 82 - doCheck = false; # Tests require lexicon corpus files not available in nix build 83 postInstall = '' 84 # Install man pages and completions from build script output 85 - for outdir in target/release/build/jacquard-lexicon-*/out; do 86 if [ -d "$outdir/man" ]; then 87 installManPage $outdir/man/*.1 88 fi ··· 99 done 100 101 # Install example lexicons.kdl config 102 - install -Dm644 ${./../../crates/jacquard-lexicon/lexicons.kdl.example} $out/share/doc/jacquard-lexicon/lexicons.kdl.example 103 ''; 104 }; 105 }; ··· 144 }; 145 }; 146 }; 147 }; 148 }; 149 - packages.default = self'.packages.jacquard-lexicon; 150 }; 151 }
··· 78 crane = { 79 args = { 80 buildInputs = commonBuildInputs; 81 + }; 82 + }; 83 + }; 84 + "jacquard-lexgen" = { 85 + imports = [globalCrateConfig]; 86 + autoWire = ["crate" "clippy"]; 87 + path = ./../../crates/jacquard-lexgen; 88 + crane = { 89 + args = { 90 + buildInputs = commonBuildInputs; 91 nativeBuildInputs = [pkgs.installShellFiles]; 92 + doCheck = false; # Tests require lexicon corpus files not available in nix build 93 postInstall = '' 94 # Install man pages and completions from build script output 95 + for outdir in target/release/build/jacquard-lexgen-*/out; do 96 if [ -d "$outdir/man" ]; then 97 installManPage $outdir/man/*.1 98 fi ··· 109 done 110 111 # Install example lexicons.kdl config 112 + install -Dm644 ${./../../crates/jacquard-lexgen/lexicons.kdl.example} $out/share/doc/jacquard-lexgen/lexicons.kdl.example 113 ''; 114 }; 115 }; ··· 154 }; 155 }; 156 }; 157 + "jacquard-repo" = { 158 + imports = [globalCrateConfig]; 159 + autoWire = ["crate" "clippy"]; 160 + path = ./../../crates/jacquard-repo; 161 + crane = { 162 + args = { 163 + buildInputs = commonBuildInputs; 164 + }; 165 + }; 166 + }; 167 }; 168 }; 169 + packages.default = self'.packages.jacquard-lexgen; 170 }; 171 }
+2 -2
scripts/package-binaries.sh
··· 158 # Only include example config for lex-fetch 159 if [[ "$BINARY" == "lex-fetch" ]]; then 160 mkdir -p "$STAGE_DIR/examples" 161 - cp crates/jacquard-lexicon/lexicons.kdl.example "$STAGE_DIR/examples/" 2>/dev/null || true 162 fi 163 else 164 # Unix (Linux/macOS): binary, man page, completions, README, LICENSE ··· 198 # Only include example config for lex-fetch 199 if [[ "$BINARY" == "lex-fetch" ]]; then 200 mkdir -p "$STAGE_DIR/share/doc/jacquard-lexicon" 201 - cp crates/jacquard-lexicon/lexicons.kdl.example "$STAGE_DIR/share/doc/jacquard-lexicon/" 2>/dev/null || true 202 fi 203 fi 204
··· 158 # Only include example config for lex-fetch 159 if [[ "$BINARY" == "lex-fetch" ]]; then 160 mkdir -p "$STAGE_DIR/examples" 161 + cp crates/jacquard-lexgen/lexicons.kdl.example "$STAGE_DIR/examples/" 2>/dev/null || true 162 fi 163 else 164 # Unix (Linux/macOS): binary, man page, completions, README, LICENSE ··· 198 # Only include example config for lex-fetch 199 if [[ "$BINARY" == "lex-fetch" ]]; then 200 mkdir -p "$STAGE_DIR/share/doc/jacquard-lexicon" 201 + cp crates/jacquard-lexgen/lexicons.kdl.example "$STAGE_DIR/share/doc/jacquard-lexgen/" 2>/dev/null || true 202 fi 203 fi 204