Skip to content

Commit 9b1ba2a

Browse files
committed
Add Nix development environment
The environment is impure, because it creates a Python venv in the local directory. But this makes live easier with `pyo3-pack develop`.
1 parent 7fa8fae commit 9b1ba2a

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
use nix

default.nix

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
with import <nixpkgs> {};
2+
let
3+
mozillaOverlay = fetchFromGitHub {
4+
owner = "mozilla";
5+
repo = "nixpkgs-mozilla";
6+
rev = "9f35c4b09fd44a77227e79ff0c1b4b6a69dff533";
7+
sha256 = "18h0nvh55b5an4gmlgfbvwbyqj91bklf1zymis6lbdh75571qaz0";
8+
};
9+
rustNightly =
10+
with import "${mozillaOverlay.out}/rust-overlay.nix" pkgs pkgs;
11+
(rustChannelOf { date = "2019-02-07"; channel = "nightly"; }).rust;
12+
in stdenv.mkDerivation rec {
13+
name = "toponn-env";
14+
env = buildEnv { name = name; paths = buildInputs; };
15+
16+
nativeBuildInputs = [
17+
pkgconfig
18+
pyo3-pack
19+
python3
20+
rustNightly
21+
];
22+
23+
propagatedBuildInputs = [
24+
python3Packages.numpy
25+
];
26+
27+
buildInputs = [
28+
curl
29+
libtensorflow
30+
openssl
31+
] ++ lib.optional stdenv.isDarwin darwin.apple_sdk.frameworks.Security;
32+
33+
shellHook = ''
34+
${python3}/bin/python -m venv venv
35+
source venv/bin/activate
36+
'';
37+
}

0 commit comments

Comments
 (0)