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:
parent
9d1b47d19e
commit
e242e0cc2c
1 changed files with 26 additions and 0 deletions
26
flake.nix
26
flake.nix
|
|
@ -105,6 +105,32 @@
|
|||
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
|
||||
{
|
||||
packages = forAllSystems (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue