this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

build: add fully static musl build via nix

+76 -27
+3
.github/workflows/nix.yml
··· 38 38 - name: Build cmprss 39 39 run: nix build .#cmprss 40 40 41 + - name: Build static musl binary 42 + run: nix build .#cmprss-static 43 + 41 44 # Run any nix checks that aren't covered by the above 42 45 # This should evaluate the nix expression and then do nothing 43 46 - name: Forgotten checks
+2
README.md
··· 29 29 30 30 For Nix users, the repository contains a flake and an overlay. `nix run github:arcuru/cmprss` 31 31 32 + A fully static musl-linked binary is also available for Linux: `nix build github:arcuru/cmprss#cmprss-static` 33 + 32 34 ## Usage 33 35 34 36 The primary goal is to infer behavior based on the input, so that you don't need to remember esoteric CLI arguments.
+71 -27
flake.nix
··· 83 83 doCheck = false; # Tests are run as a separate build with nextest 84 84 meta.mainProgram = "cmprss"; 85 85 }); 86 + 87 + # Fully static musl build (Linux only) 88 + staticMusl = pkgs.lib.optionalAttrs pkgs.stdenv.isLinux ( 89 + let 90 + muslTarget = 91 + if system == "x86_64-linux" 92 + then "x86_64-unknown-linux-musl" 93 + else "aarch64-unknown-linux-musl"; 94 + 95 + muslToolchain = inputs.fenix.packages.${system}.combine [ 96 + fenixStable.cargo 97 + fenixStable.rustc 98 + inputs.fenix.packages.${system}.targets.${muslTarget}.stable.rust-std 99 + ]; 100 + 101 + craneLibMusl = (inputs.crane.mkLib pkgs).overrideToolchain muslToolchain; 102 + 103 + musl-cc = pkgs.pkgsStatic.stdenv.cc; 104 + 105 + staticArgs = { 106 + src = craneLibMusl.cleanCargoSource ./.; 107 + strictDeps = true; 108 + CARGO_BUILD_TARGET = muslTarget; 109 + CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static"; 110 + TARGET_CC = "${musl-cc}/bin/${musl-cc.targetPrefix}cc"; 111 + HOST_CC = "${pkgs.stdenv.cc}/bin/cc"; 112 + nativeBuildInputs = [ 113 + musl-cc 114 + pkgs.pkg-config 115 + ]; 116 + }; 117 + 118 + cargoArtifactsStatic = craneLibMusl.buildDepsOnly staticArgs; 119 + in { 120 + cmprss-static = craneLibMusl.buildPackage (staticArgs 121 + // { 122 + cargoArtifacts = cargoArtifactsStatic; 123 + doCheck = false; 124 + meta.mainProgram = "cmprss"; 125 + }); 126 + } 127 + ); 86 128 # Source filtered to specific file extensions for lightweight linter checks 87 129 cleanSrc = pkgs.lib.cleanSource ./.; 88 130 sourceWithExts = exts: ··· 140 182 }; 141 183 }; 142 184 in { 143 - packages = { 144 - default = cmprss; 145 - inherit cmprss; 185 + packages = 186 + { 187 + default = cmprss; 188 + inherit cmprss; 146 189 147 - # Check code coverage with tarpaulin 148 - coverage = craneLib.cargoTarpaulin (commonArgs 149 - // { 150 - # Use lcov output as thats far more widely supported 151 - cargoTarpaulinExtraArgs = "--skip-clean --include-tests --output-dir $out --out lcov"; 152 - }); 190 + # Check code coverage with tarpaulin 191 + coverage = craneLib.cargoTarpaulin (commonArgs 192 + // { 193 + # Use lcov output as thats far more widely supported 194 + cargoTarpaulinExtraArgs = "--skip-clean --include-tests --output-dir $out --out lcov"; 195 + }); 153 196 154 - # Run clippy (and deny all warnings) on the crate source 155 - clippy = craneLib.cargoClippy (commonArgs 156 - // { 157 - cargoClippyExtraArgs = "--all-targets -- --deny warnings"; 158 - }); 197 + # Run clippy (and deny all warnings) on the crate source 198 + clippy = craneLib.cargoClippy (commonArgs 199 + // { 200 + cargoClippyExtraArgs = "--all-targets -- --deny warnings"; 201 + }); 159 202 160 - # Check docs build successfully 161 - doc = craneLib.cargoDoc commonArgs; 203 + # Check docs build successfully 204 + doc = craneLib.cargoDoc commonArgs; 162 205 163 - # Check formatting 164 - fmt = craneLib.cargoFmt commonArgs; 206 + # Check formatting 207 + fmt = craneLib.cargoFmt commonArgs; 165 208 166 - # Run tests with cargo-nextest 167 - test = craneLib.cargoNextest commonArgs; 209 + # Run tests with cargo-nextest 210 + test = craneLib.cargoNextest commonArgs; 168 211 169 - # Audit dependencies, check licenses, and detect duplicate crates 170 - deny = craneLib.cargoDeny (commonArgs 171 - // { 172 - # advisories excluded: needs network access (blocked by nix sandbox) 173 - cargoDenyChecks = "bans licenses sources"; 174 - }); 175 - }; 212 + # Audit dependencies, check licenses, and detect duplicate crates 213 + deny = craneLib.cargoDeny (commonArgs 214 + // { 215 + # advisories excluded: needs network access (blocked by nix sandbox) 216 + cargoDenyChecks = "bans licenses sources"; 217 + }); 218 + } 219 + // staticMusl; 176 220 177 221 checks = 178 222 {