Build release as a static binary

This commit is contained in:
Brian Picciano 2023-05-15 22:58:40 +02:00
parent 5fa89593ae
commit ce80c5e23b
3 changed files with 11 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/target /target
.cargo .cargo
/result

View File

@ -25,10 +25,17 @@
in in
{ {
defaultPackage = naersk-lib.buildPackage ./.; defaultPackage = naersk-lib.buildPackage {
devShell = with pkgs; mkShell { src = ./.;
doCheck = false;
nativeBuildInputs = [ pkgs.pkgsStatic.stdenv.cc ];
CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl";
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
};
devShell = pkgs.mkShell {
nativeBuildInputs = [ nativeBuildInputs = [
toolchain toolchain
pkgs.glibc.static
]; ];
shellHook = '' shellHook = ''
source $(pwd)/.env.dev source $(pwd)/.env.dev

View File

@ -1,3 +1,4 @@
[toolchain] [toolchain]
channel = "nightly-2023-05-08" channel = "nightly-2023-05-08"
components = [ "rustfmt", "rustc-dev", "clippy", "cargo" ] components = [ "rustfmt", "rustc-dev", "clippy", "cargo" ]
targets = [ "x86_64-unknown-linux-musl" ]