-
-
Notifications
You must be signed in to change notification settings - Fork 165
Expand file tree
/
Copy pathflake.nix
More file actions
134 lines (110 loc) · 4.24 KB
/
flake.nix
File metadata and controls
134 lines (110 loc) · 4.24 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
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
{
description = "videocall-rs - WebTransport video calling platform";
inputs = {
nixpkgs.url =
"github:NixOS/nixpkgs/d1c15b7d5806069da59e819999d70e1cec0760bf";
# cargo-leptos 0.2.42 lives in this older nixpkgs (0.2.x is required for
# leptos 0.5.x; the main nixpkgs has jumped to 0.3.x).
nixpkgs-leptos.url =
"github:NixOS/nixpkgs/ee09932cedcef15aaf476f9343d1dea2cb77e261";
rust-overlay = {
url = "github:oxalica/rust-overlay";
inputs.nixpkgs.follows = "nixpkgs";
};
flake-utils.url = "github:numtide/flake-utils";
};
outputs = { self, nixpkgs, nixpkgs-leptos, rust-overlay, flake-utils }:
flake-utils.lib.eachDefaultSystem (system:
let
overlays = [ (import rust-overlay) ];
pkgs = import nixpkgs { inherit system overlays; };
pkgsLeptos = import nixpkgs-leptos { inherit system; };
# leptos-website: pinned nightly required by cargo-leptos 0.2.x
leptosRustMinimal = pkgs.rust-bin.nightly."2024-11-01".minimal.override {
targets = [ "wasm32-unknown-unknown" ];
};
leptosRustDev = pkgs.rust-bin.nightly."2024-11-01".default.override {
targets = [ "wasm32-unknown-unknown" ];
extensions = [ "rust-src" "rust-analyzer" ];
};
# frontend: pinned stable (needs >= 1.85 for edition 2024 deps)
frontendRustMinimal = pkgs.rust-bin.stable."1.93.1".minimal.override {
targets = [ "wasm32-unknown-unknown" ];
};
frontendRustDev = pkgs.rust-bin.stable."1.93.1".default.override {
targets = [ "wasm32-unknown-unknown" ];
extensions = [ "rust-src" "rust-analyzer" ];
};
coreInputs = [
pkgs.binaryen
pkgs.pkg-config
pkgs.openssl
pkgs.git
];
leptosBuildInputs = [
pkgsLeptos.cargo-leptos
pkgs.wasm-bindgen-cli_0_2_100
pkgs.nodejs_20
] ++ coreInputs;
frontendBuildInputs = [
pkgs.trunk
pkgs.wasm-bindgen-cli_0_2_108
pkgs.tailwindcss
] ++ coreInputs;
leptosEnv = {
LEPTOS_HASH_FILES = "false";
LEPTOS_TAILWIND_VERSION = "v3.4.17";
};
# trunk 0.21.x reads NO_COLOR but chokes on the value "1" that
# mkShell injects; fully unsetting it avoids the clash.
frontendHook = ''
unset NO_COLOR
'';
# Backend: native Rust servers (actix-api, meeting-api, bot)
backendRustMinimal = pkgs.rust-bin.stable."1.93.1".minimal;
backendRustDev = pkgs.rust-bin.stable."1.93.1".default.override {
extensions = [ "rust-src" "rust-analyzer" ];
};
backendBuildInputs = [
pkgs.pkg-config
pkgs.openssl
pkgs.git
pkgs.dbmate
pkgs.cmake
pkgs.nasm
] ++ pkgs.lib.optionals pkgs.stdenv.isLinux [
pkgs.libvpx
pkgs.libopus
pkgs.alsa-lib
pkgs.libclang
];
backendEnv = pkgs.lib.optionalAttrs pkgs.stdenv.isLinux {
LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
BINDGEN_EXTRA_CLANG_ARGS = "-isystem ${pkgs.glibc.dev}/include";
};
in
{
devShells.leptos-website = pkgs.mkShell (leptosEnv // {
nativeBuildInputs = [ leptosRustMinimal ] ++ leptosBuildInputs;
});
devShells.leptos-website-dev = pkgs.mkShell (leptosEnv // {
nativeBuildInputs = [ leptosRustDev ] ++ leptosBuildInputs;
});
devShells.frontend = pkgs.mkShell {
nativeBuildInputs = [ frontendRustMinimal ] ++ frontendBuildInputs;
shellHook = frontendHook;
};
devShells.frontend-dev = pkgs.mkShell {
nativeBuildInputs = [ frontendRustDev ] ++ frontendBuildInputs;
shellHook = frontendHook;
};
devShells.backend = pkgs.mkShell (backendEnv // {
nativeBuildInputs = [ backendRustMinimal ] ++ backendBuildInputs;
});
devShells.backend-dev = pkgs.mkShell (backendEnv // {
nativeBuildInputs = [ backendRustDev pkgs.cargo-watch pkgs.cargo-machete ] ++ backendBuildInputs;
});
devShells.default = self.devShells.${system}.frontend-dev;
}
);
}