-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
88 lines (80 loc) · 2.78 KB
/
Copy pathflake.nix
File metadata and controls
88 lines (80 loc) · 2.78 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
{
description = "Cedar: Simple in memory embeddings in Rust";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
rust-overlay.url = "github:oxalica/rust-overlay";
crane = {
url = "github:ipetkov/crane";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, rust-overlay, crane, ... }:
let
# System types to support.
supportedSystems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" ];
# Rust nightly version.
nightlyVersion = "2022-12-04";
in
flake-utils.lib.eachSystem supportedSystems (system:
let
pkgs =
if system == "x86_64-linux" then
import nixpkgs
{
inherit system;
overlays = [ (import rust-overlay) ];
config = {
allowUnfree = true;
# cudaSupport = true;
};
} else
import nixpkgs {
inherit system;
overlays = [ (import rust-overlay) ];
config = {
allowUnfree = true;
};
};
rustNightly = pkgs.rust-bin.nightly.${nightlyVersion}.default.override {
extensions = [ "rust-src" "rust-analyzer-preview" ];
targets = [ "x86_64-unknown-linux-gnu" ];
};
craneLib = (crane.mkLib pkgs).overrideToolchain rustNightly;
cedarPackage = craneLib.buildPackage {
inherit src;
nativeBuildInputs = with pkgs; [
rustNightly
pkg-config
openssl
python310Packages.torch
duckdb
];
doCheck = false;
torch = "
export LIBTORCH=${pkgs.python310Packages.torch}/lib/python3.10/site-packages/torch
export LD_LIBRARY_PATH=$\{LIBTORCH}/lib:$LD_LIBRARY_PATH
";
LD_LIBRARY_PATH = "${pkgs.python310Packages.torch}/lib/python3.10/site-packages/torch";
LIBTORCH = "${pkgs.python310Packages.torch}/lib/python3.10/site-packages/torch";
};
src = ./.;
in
{
devShell = pkgs.mkShell {
nativeBuildInputs = with pkgs; [
rustNightly
pkg-config
openssl
python310Packages.torch
duckdb
] ++ (if system == "x86_64-linux" then [ ] else [ ]) ++ (if system == "aarch64-darwin" then [ pkgs.darwin.apple_sdk.frameworks.Security ] else [ ]);
LD_LIBRARY_PATH = "${pkgs.python310Packages.torch}/lib/python3.10/site-packages/torch";
LIBTORCH = "${pkgs.python310Packages.torch}/lib/python3.10/site-packages/torch";
};
packages = {
default = cedarPackage;
cedar = cedarPackage;
};
});
}