/
flake.nix
37 lines (33 loc) 路 1.03 KB
/
flake.nix
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
{
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";
};
}
);
}