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
.cargo
/result

View File

@ -25,10 +25,17 @@
in
{
defaultPackage = naersk-lib.buildPackage ./.;
devShell = with pkgs; mkShell {
defaultPackage = naersk-lib.buildPackage {
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 = [
toolchain
pkgs.glibc.static
];
shellHook = ''
source $(pwd)/.env.dev

View File

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