-
-
Notifications
You must be signed in to change notification settings - Fork 141
/
Copy pathflake.nix
64 lines (60 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
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = {
self,
nixpkgs,
rust-overlay,
flake-utils,
...
}:
flake-utils.lib.eachDefaultSystem (
system: let
pkgs = import nixpkgs {
inherit system;
overlays = [rust-overlay.overlays.default];
};
rustbin = pkgs.rust-bin.selectLatestNightlyWith (toolchain:
toolchain.default.override {
extensions = ["rust-src"];
});
in {
formatter = pkgs.alejandra;
devShells.default = pkgs.mkShell {
packages = [
rustbin
] ++ (with pkgs; [
llvmPackages.libclang.lib
llvmPackages.clang
pkg-config
cmake
vcpkg
rustPlatform.bindgenHook
xmlstarlet
opencv
alsa-lib
systemdLibs
cmake
fontconfig
linuxHeaders
v4l-utils
libv4l
pipewire
]);
env.RUST_SRC_PATH = "${rustbin}/lib/rustlib/src/rust/library";
env.LIBCLANG_PATH = "${pkgs.llvmPackages.libclang.lib}/lib";
shellHook = let
pathToRustProject = "/project/component[@name='RustProjectSettings']";
in
''
echo "WONDERHOOOOOY!!!!"
xmlstarlet edit --inplace --update "${pathToRustProject}/option[@name='explicitPathToStdlib']/@value" --value "${rustbin}/lib/rustlib/src/rust/library" .idea/workspace.xml
xmlstarlet edit --inplace --update "${pathToRustProject}/option[@name='toolchainHomeDirectory']/@value" --value "${rustbin}/bin" .idea/workspace.xml
'';
};
}
);
}