-
Notifications
You must be signed in to change notification settings - Fork 98
/
Copy pathdevshells.nix
118 lines (99 loc) · 2.53 KB
/
devshells.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
# Development shells
toplevel @ { lib, flake-parts-lib, ... }:
let
inherit (lib)
mkOption
types
;
inherit (flake-parts-lib)
mkPerSystemOption
;
in
{
options = {
perSystem = mkPerSystemOption {
options.attic.devshell = {
packageSets = mkOption {
type = types.attrsOf (types.listOf types.package);
default = {};
};
extraPackages = mkOption {
type = types.listOf types.package;
default = [];
};
extraArgs = mkOption {
type = types.attrsOf types.unspecified;
default = {};
};
};
};
};
config = {
perSystem = { self', pkgs, config, ... }: let
cfg = config.attic.devshell;
in {
attic.devshell.packageSets = with pkgs; {
rustc = lib.optionals (config.attic.toolchain == null) [
rustc
];
rust = [
cargo-expand
cargo-outdated
cargo-edit
tokio-console
];
linters = [
clippy
rustfmt
editorconfig-checker
];
utils = [
jq
just
];
ops = [
postgresql
sqlite-interactive
flyctl
skopeo
manifest-tool
] ++ lib.optionals pkgs.stdenv.isLinux [
wrangler
];
bench = [
wrk
] ++ lib.optionals pkgs.stdenv.isLinux [
linuxPackages.perf
];
wasm = [
llvmPackages_latest.bintools
worker-build wasm-pack wasm-bindgen-cli
];
};
devShells.default = pkgs.mkShell (lib.recursiveUpdate {
inputsFrom = [
self'.packages.attic
self'.packages.book
];
packages = lib.flatten (lib.attrValues cfg.packageSets);
env = {
ATTIC_DISTRIBUTOR = toplevel.config.attic.distributor;
RUST_SRC_PATH = "${pkgs.rustPlatform.rustcSrc}/library";
NIX_PATH = "nixpkgs=${pkgs.path}";
# See comment in `attic/build.rs`
NIX_INCLUDE_PATH = "${lib.getDev self'.packages.attic.passthru.nix}/include";
# Used by `just with-nix` to build/test with alternative Nix versions.
NIX_VERSIONS = config.attic.nix-versions.manifestFile;
};
} cfg.extraArgs);
devShells.demo = pkgs.mkShell {
packages = [ self'.packages.default ];
shellHook = ''
>&2 echo
>&2 echo '🚀 Run `atticd` to get started!'
>&2 echo
'';
};
};
};
}