-
Notifications
You must be signed in to change notification settings - Fork 8
/
flake.nix
81 lines (69 loc) · 2.44 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
{
description = "A very basic flake";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
fenix = {
url = "github:nix-community/fenix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {flake-parts, ...}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [
"x86_64-linux"
"aarch64-darwin"
"aarch64-linux"
];
perSystem = {
config,
system,
pkgs,
...
}: {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [
inputs.fenix.overlays.default
];
config = {};
};
formatter = pkgs.alejandra;
packages.rust-toolchain = pkgs.fenix.fromToolchainFile {
file = ./rust-toolchain.toml;
sha256 = "sha256-nqZ6L3zf3f9xh1Qh53BhBM+cWfO9S8VPlfE0h+1lg6o=";
};
packages.ci-deps = pkgs.symlinkJoin {
name = "ci-deps";
paths = with pkgs;
[
taplo
nodejs_20
wasmtime
cargo-nextest
cargo-udeps
config.packages.rust-toolchain
(python312.withPackages (python-pkgs: [
python-pkgs.colorama
python-pkgs.toml
]))
]
++ lib.lists.optional (stdenv.isDarwin) pkgs.darwin.libiconv;
};
# CI Setup for GitHub Actions
packages.ci-env = pkgs.writeShellScriptBin "ci-setup" ''
echo CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-args=-Wl,-rpath,${config.packages.ci-deps}/lib/"
echo CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS="-C link-args=-Wl,-rpath,${config.packages.ci-deps}/lib/"
echo CARGO_TARGET_AARCH64_APPLE_DARWIN_RUSTFLAGS="-C link-args=-Wl,-rpath,${config.packages.ci-deps}/lib/"
'';
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
config.packages.ci-deps
];
CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS = ''-C link-args=-Wl,-rpath,${config.packages.ci-deps}/lib/'';
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_RUSTFLAGS = ''-C link-args=-Wl,-rpath,${config.packages.ci-deps}/lib/'';
CARGO_TARGET_AARCH64_APPLE_DARWIN_RUSTFLAGS = ''-C link-args=-Wl,-rpath,${config.packages.ci-deps}/lib/'';
};
};
};
}