feat(flake): add musl static build for streamd

Add mkMuslCraneLib and mkStreamdMusl functions to create a
statically-linked binary using the x86_64-unknown-linux-musl target.
This enables portable binaries that don't depend on system glibc.
This commit is contained in:
Konstantin Fickel 2026-04-02 22:54:42 +02:00 committed by kfickel
parent 9d1b47d19e
commit e242e0cc2c

View file

@ -105,6 +105,32 @@
commitizen.enable = true; commitizen.enable = true;
}; };
}; };
mkMuslCraneLib =
system:
let
pkgs = mkPkgs system;
toolchain = pkgs.rust-bin.stable.latest.default.override {
targets = [ "x86_64-unknown-linux-musl" ];
};
in
(crane.mkLib pkgs).overrideToolchain toolchain;
mkStreamdMusl =
system:
let
craneLib = mkMuslCraneLib system;
commonArgs = {
src = craneLib.path ./.;
pname = "streamd";
inherit version;
strictDeps = true;
CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
};
cargoArtifacts = craneLib.buildDepsOnly commonArgs;
in
craneLib.buildPackage (commonArgs // { inherit cargoArtifacts; });
in in
{ {
packages = forAllSystems ( packages = forAllSystems (