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