-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathflake.nix
More file actions
91 lines (85 loc) · 2.15 KB
/
flake.nix
File metadata and controls
91 lines (85 loc) · 2.15 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
83
84
85
86
87
88
89
90
91
{
description = "name";
inputs = {
flake-parts = {
follows = "nativelink/flake-parts";
};
git-hooks = {
follows = "nativelink/git-hooks";
};
nativelink = {
url = "github:TraceMachina/nativelink/f9ff630e09a3c22d6a3abea68d1bacc775eac6bb";
};
nixpkgs = {
follows = "nativelink/nixpkgs";
};
rust-overlay = {
follows = "nativelink/rust-overlay";
};
};
outputs = inputs @ {
flake-parts,
git-hooks,
nativelink,
nixpkgs,
rust-overlay,
self,
...
}:
flake-parts.lib.mkFlake {inherit inputs;} {
systems = [
"x86_64-linux"
"x86_64-darwin"
"aarch64-linux"
"aarch64-darwin"
];
imports = [
git-hooks.flakeModule
nativelink.flakeModules.lre
];
perSystem = {
config,
pkgs,
system,
...
}: {
_module.args.pkgs = import self.inputs.nixpkgs {
inherit system;
overlays = [
# Add `pkgs.lre` from NativeLink.
nativelink.overlays.lre
rust-overlay.overlays.default
];
};
# Option from the NativeLink flake module.
lre = {
# Use the lre-cc environment from NativeLink locally.
inherit (pkgs.lre.lre-cc.meta) Env;
};
# Option from the git-hooks flake module.
pre-commit.settings = {
hooks = import ./pre-commit-hooks.nix {inherit pkgs;};
};
devShells.default = pkgs.mkShell {
packages = [
# Development tools
pkgs.git
pkgs.ruff
# Build dependencies
# Bazel installed by Bazelisk.
(pkgs.writeShellScriptBin "bazel" ''
unset TMPDIR TMP
exec ${pkgs.bazelisk}/bin/bazelisk "$@"
'')
pkgs.lre.clang
];
shellHook = ''
# Generate lre.bazelrc, which configures Bazel toolchains.
${config.lre.installationScript}
# Generate .pre-commit-config.yaml symlink.
${config.pre-commit.installationScript}
'';
};
};
};
}