-
Notifications
You must be signed in to change notification settings - Fork 2
/
flake.nix
176 lines (158 loc) · 4.97 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
{
nixConfig.extra-substituters = [
"https://wasmcloud.cachix.org"
"https://nixify.cachix.org"
"https://crane.cachix.org"
"https://bytecodealliance.cachix.org"
"https://nix-community.cachix.org"
"https://cache.garnix.io"
];
nixConfig.extra-trusted-public-keys = [
"wasmcloud.cachix.org-1:9gRBzsKh+x2HbVVspreFg/6iFRiD4aOcUQfXVDl3hiM="
"nixify.cachix.org-1:95SiUQuf8Ij0hwDweALJsLtnMyv/otZamWNRp1Q1pXw="
"crane.cachix.org-1:8Scfpmn9w+hGdXH/Q9tTLiYAE/2dnJYRJP7kl80GuRk="
"bytecodealliance.cachix.org-1:0SBgh//n2n0heh0sDFhTm+ZKBRy2sInakzFGfzN531Y="
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
"cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g="
];
inputs.nixify.inputs.nixlib.follows = "nixlib";
inputs.nixify.url = "github:rvolosatovs/nixify";
inputs.nixlib.url = "github:nix-community/nixpkgs.lib";
inputs.nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
inputs.wit-deps.inputs.nixify.follows = "nixify";
inputs.wit-deps.inputs.nixlib.follows = "nixlib";
inputs.wit-deps.url = "github:bytecodealliance/wit-deps/v0.4.0";
outputs = {
nixify,
nixlib,
nixpkgs-unstable,
wit-deps,
...
}:
with builtins;
with nixlib.lib;
with nixify.lib;
rust.mkFlake {
src = ./.;
name = "wadge";
overlays = [
wit-deps.overlays.fenix
wit-deps.overlays.default
(
final: prev: {
pkgsUnstable = import nixpkgs-unstable {
inherit
(final.stdenv.hostPlatform)
system
;
inherit
(final)
config
;
};
}
)
];
excludePaths = [
".envrc"
".github"
".gitignore"
"ADOPTERS.md"
"CODE_OF_CONDUCT.md"
"CONTRIBUTING.md"
"flake.nix"
"LICENSE"
"README.md"
"SECURITY.md"
];
doCheck = false; # testing is performed in checks via `nextest`
build.packages = [
"wadge-sys"
];
targets.arm-unknown-linux-gnueabihf = false;
targets.arm-unknown-linux-musleabihf = false;
targets.armv7-unknown-linux-gnueabihf = false;
targets.armv7-unknown-linux-musleabihf = false;
targets.powerpc64le-unknown-linux-gnu = false;
targets.s390x-unknown-linux-gnu = false;
targets.wasm32-unknown-unknown = false;
targets.wasm32-wasip1 = false;
clippy.deny = ["warnings"];
clippy.workspace = true;
test.allTargets = true;
test.workspace = true;
buildOverrides = {
pkgs,
pkgsCross ? pkgs,
...
}: {
buildInputs ? [],
depsBuildBuild ? [],
nativeBuildInputs ? [],
nativeCheckInputs ? [],
preCheck ? "",
...
} @ args:
with pkgs.lib; let
darwin2darwin = pkgs.stdenv.hostPlatform.isDarwin && pkgsCross.stdenv.hostPlatform.isDarwin;
depsBuildBuild' =
depsBuildBuild
++ optional pkgs.stdenv.hostPlatform.isDarwin pkgs.darwin.apple_sdk.frameworks.SystemConfiguration
++ optional darwin2darwin pkgs.xcbuild.xcrun;
in
{
buildInputs =
buildInputs
++ optional pkgs.stdenv.hostPlatform.isDarwin pkgs.libiconv;
depsBuildBuild = depsBuildBuild';
}
// optionalAttrs (args ? cargoArtifacts) {
preCheck =
''
export GOCACHE=$TMPDIR/gocache
export GOMODCACHE=$TMPDIR/gomod
export GOPATH=$TMPDIR/go
export HOME=$TMPDIR/home
''
+ preCheck;
depsBuildBuild =
depsBuildBuild'
++ optionals darwin2darwin [
pkgs.darwin.apple_sdk.frameworks.CoreFoundation
pkgs.darwin.apple_sdk.frameworks.CoreServices
];
nativeCheckInputs =
nativeCheckInputs
++ [
pkgs.pkgsUnstable.go
];
};
withPackages = {
hostRustToolchain,
packages,
...
}:
packages
// {
rust = hostRustToolchain;
};
withDevShells = {
devShells,
pkgs,
...
}:
extendDerivations {
buildInputs = [
pkgs.wit-deps
pkgs.pkgsUnstable.binaryen
pkgs.pkgsUnstable.cargo-audit
pkgs.pkgsUnstable.cargo-nextest
pkgs.pkgsUnstable.gh
pkgs.pkgsUnstable.go
pkgs.pkgsUnstable.wasm-tools
pkgs.pkgsUnstable.wasmtime
];
}
devShells;
};
}