File tree Expand file tree Collapse file tree 3 files changed +114
-21
lines changed
Expand file tree Collapse file tree 3 files changed +114
-21
lines changed Original file line number Diff line number Diff line change 88 url = "github:oxalica/rust-overlay" ;
99 inputs . nixpkgs . follows = "nixpkgs" ;
1010 } ;
11- crane = {
12- url = "github:ipetkov/crane " ;
13- } ;
11+
12+ fenix . url = "github:nix-community/fenix " ;
13+ naersk . url = "github:nix-community/naersk" ;
1414 } ;
1515
1616 outputs =
1919 nixpkgs ,
2020 rust-overlay ,
2121 flake-utils ,
22- crane ,
22+ naersk ,
23+ fenix ,
2324 ...
2425 } :
2526 flake-utils . lib . eachDefaultSystem (
3132 pkgs = import nixpkgs {
3233 inherit system overlays ;
3334 } ;
34- craneLib = crane . mkLib pkgs ;
35+ toolchain =
36+ with fenix . packages . ${ system } ;
37+ combine [
38+ minimal . rustc
39+ minimal . cargo
40+ targets . x86_64-unknown-linux-musl . latest . rust-std
41+ ] ;
42+
43+ naersk' = naersk . lib . ${ system } . override {
44+ cargo = toolchain ;
45+ rustc = toolchain ;
46+ } ;
3547 in
3648 {
3749 packages = rec {
3850 bin = package {
3951 inherit pkgs ;
40- craneLib = craneLib ;
52+ naersk = naersk' ;
4153 } ;
4254 docker = docker-image {
4355 inherit pkgs ;
Original file line number Diff line number Diff line change 1- { craneLib , pkgs , ... } :
2- craneLib . buildPackage rec {
1+ { naersk , pkgs , ... } :
2+ naersk . buildPackage rec {
33 pname = "rubric-merge" ;
44 name = pname ;
5- src = craneLib . cleanCargoSource ../. ;
5+ src = ../. ;
6+ strictDeps = true ;
67
7- nativeBuildInputs = with pkgs ; [ pkg-config ] ;
8- buildInputs = with pkgs ; [ openssl ] ;
8+ OPENSSL_STATIC = "1" ;
9+ OPENSSL_LIB_DIR = "${ pkgs . pkgsStatic . openssl . out } /lib" ;
10+ OPENSSL_INCLUDE_DIR = "${ pkgs . pkgsStatic . openssl . dev } /include" ;
11+
12+ CARGO_BUILD_TARGET = "x86_64-unknown-linux-musl" ;
13+ CARGO_BUILD_RUSTFLAGS = [
14+ "-C"
15+ "target-feature=+crt-static"
16+
17+ # -latomic is required to build openssl-sys for armv6l-linux, but
18+ # it doesn't seem to hurt any other builds.
19+ # "-C"
20+ # "link-args=-static -latomic"
21+ ] ;
922}
You can’t perform that action at this time.
0 commit comments