-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathflake.nix
More file actions
68 lines (59 loc) · 2.08 KB
/
flake.nix
File metadata and controls
68 lines (59 loc) · 2.08 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
{
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
flake-parts.url = "github:hercules-ci/flake-parts";
systems.url = "github:nix-systems/default";
naersk.url = "github:nix-community/naersk";
rust-overlay.url = "github:oxalica/rust-overlay";
};
outputs = inputs:
inputs.flake-parts.lib.mkFlake { inherit inputs; } {
systems = import inputs.systems;
perSystem = { config, self', pkgs, lib, system, ... }:
let
naersk-lib = pkgs.callPackage inputs.naersk { };
rustToolchain = pkgs.rust-bin.nightly.latest.default.override {
extensions = [
"rust-src"
"rust-analyzer"
"clippy"
"rustc-codegen-cranelift-preview"
];
};
in rec {
_module.args.pkgs = import inputs.nixpkgs {
inherit system;
overlays = [ inputs.rust-overlay.overlays.default ];
};
packages.default = naersk-lib.buildPackage {
src = ./.;
nativeBuildInputs = with pkgs; [ gcc cmake lld openssl python3 ];
};
devShells.default = pkgs.mkShell {
name = "optik-dev";
nativeBuildInputs = with pkgs;
packages.default.nativeBuildInputs ++ [
rustToolchain
cargo-nextest
cargo-outdated
# For C++ bindings
eigen
# For Python bindings
maturin
pyright
python3Packages.numpy
python3Packages.black
python3Packages.ruff
python3Packages.venvShellHook
];
# Create a virtualenv for Python development with maturin.
venvDir = "./.venv";
postShellHook = ''
# For rust-analyzer 'hover' tooltips to work.
export RUST_SRC_PATH="${rustToolchain}/lib/rustlib/src/rust/library";
'';
LD_LIBRARY_PATH = lib.makeLibraryPath [ pkgs.stdenv.cc.cc.lib ];
};
};
};
}