-
Notifications
You must be signed in to change notification settings - Fork 0
/
flake.nix
69 lines (64 loc) · 1.87 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
fenix.url = "github:nix-community/fenix";
};
outputs =
{ nixpkgs, ... }@inputs:
let
systems = [
"aarch64-darwin"
"aarch64-linux"
"x86_64-darwin"
"x86_64-linux"
];
forAllSystems = f: nixpkgs.lib.genAttrs systems (system: f system);
in
{
devShells = forAllSystems (system: {
default =
let
pkgs = nixpkgs.legacyPackages.${system};
fenix = inputs.fenix.packages.${system}.latest;
in
pkgs.mkShell {
env.RUST_SRC_PATH = "${fenix.rust-src}/lib/rustlib/src/rust/library";
nativeBuildInputs = with pkgs; [
# required by libz-ng-sys crate
cmake
# required by deno_kv crate
protobuf
];
buildInputs =
with pkgs;
[
fenix.toolchain
rust-analyzer
cargo-watch
]
++ lib.optionals stdenv.isDarwin (
[
libiconv
darwin.libobjc
]
++ (with darwin.apple_sdk_11_0.frameworks; [
Security
CoreServices
Metal
MetalPerformanceShaders
Foundation
QuartzCore
])
++ lib.optionals (stdenv.isAarch64) [ llvmPackages.lld ]
);
};
});
formatter = forAllSystems (system: nixpkgs.legacyPackages.${system}.nixfmt-rfc-style);
nixConfig = {
extra-substituters = [ "https://nix-community.cachix.org" ];
extra-trusted-public-keys = [
"nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs="
];
};
};
}