{ inputs = { fenix.url = "github:nix-community/fenix"; flake-utils.url = "github:numtide/flake-utils"; naersk.url = "github:nix-community/naersk"; nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; }; outputs = { self, fenix, flake-utils, naersk, nixpkgs }: flake-utils.lib.eachDefaultSystem ( system: let pkgs = (import nixpkgs) { inherit system; }; toolchain = with fenix.packages.${system}; combine [ stable.rustc stable.cargo targets.x86_64-unknown-linux-musl.stable.rust-std ]; naersk' = naersk.lib.${system}.override { cargo = toolchain; rustc = toolchain; }; in rec { defaultPackage = naersk'.buildPackage { src = ./.; nativeBuildInputs = with pkgs; [ pkgsStatic.stdenv.cc ]; CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl"; CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static -C strip=symbols"; }; } ); }