-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
82 lines (70 loc) · 2.25 KB
/
Copy pathflake.nix
File metadata and controls
82 lines (70 loc) · 2.25 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
crane.url = "github:ipetkov/crane";
fenix = {
url = "github:nix-community/fenix?rev=6b5325a017a9a9fe7e6252ccac3680cc7181cd63";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
nixpkgs,
crane,
flake-utils,
rust-overlay,
...
}:
flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = (
import nixpkgs {
system = system;
config.allowUnsupportedSystem = true;
overlays = [ (import rust-overlay) ];
}
);
buildForArchitecture =
custom_pkgs:
((crane.mkLib custom_pkgs).overrideToolchain (p: p.rust-bin.stable.latest.default)).buildPackage {
name = "arti-facts-${custom_pkgs.stdenv.hostPlatform.config}";
src = ./.;
strictDeps = false;
doCheck = false;
CARGO_BUILD_TARGET = "${custom_pkgs.stdenv.hostPlatform.rust.rustcTarget}";
CARGO_BUILD_RUSTFLAGS = "-C target-feature=+crt-static";
TARGET_CC = "${custom_pkgs.stdenv.cc}/bin/${custom_pkgs.stdenv.cc.targetPrefix}cc";
nativeBuildInputs = [
custom_pkgs.stdenv.cc
pkgs.perl
];
buildInputs = [
]
++ custom_pkgs.lib.optionals custom_pkgs.stdenv.hostPlatform.isWindows [
custom_pkgs.windows.pthreads
]
++ custom_pkgs.lib.optionals custom_pkgs.stdenv.hostPlatform.isDarwin [
custom_pkgs.libiconv
];
};
in
{
packages.linux = buildForArchitecture pkgs.pkgsCross.musl64;
packages.windows = buildForArchitecture pkgs.pkgsCross.mingwW64;
defaultPackage = pkgs.symlinkJoin {
name = "arti-facts";
paths = [
(buildForArchitecture pkgs.pkgsCross.musl64)
(buildForArchitecture pkgs.pkgsCross.mingwW64)
#(buildForArchitecture pkgs.pkgsCross.aarch64-darwin)
];
};
}
);
}