aboutsummaryrefslogtreecommitdiff
path: root/shell.nix
diff options
context:
space:
mode:
authorAdrian Kummerlaender2020-03-22 21:08:29 +0100
committerAdrian Kummerlaender2020-03-22 21:08:29 +0100
commit58678cfc3956ac5a1dbec91392b41b1b73a31463 (patch)
tree69957d6e6bc8a7977ead8bdcd3a8d82d98ee9e57 /shell.nix
downloadboltzgas-58678cfc3956ac5a1dbec91392b41b1b73a31463.tar
boltzgas-58678cfc3956ac5a1dbec91392b41b1b73a31463.tar.gz
boltzgas-58678cfc3956ac5a1dbec91392b41b1b73a31463.tar.bz2
boltzgas-58678cfc3956ac5a1dbec91392b41b1b73a31463.tar.lz
boltzgas-58678cfc3956ac5a1dbec91392b41b1b73a31463.tar.xz
boltzgas-58678cfc3956ac5a1dbec91392b41b1b73a31463.tar.zst
boltzgas-58678cfc3956ac5a1dbec91392b41b1b73a31463.zip
Extract hard sphere gas from particle playground
Diffstat (limited to 'shell.nix')
-rw-r--r--shell.nix44
1 files changed, 44 insertions, 0 deletions
diff --git a/shell.nix b/shell.nix
new file mode 100644
index 0000000..9122012
--- /dev/null
+++ b/shell.nix
@@ -0,0 +1,44 @@
+{ pkgs ? import <nixpkgs> { }, ... }:
+
+pkgs.stdenvNoCC.mkDerivation rec {
+ name = "pycl-env";
+ env = pkgs.buildEnv { name = name; paths = buildInputs; };
+
+ buildInputs = let
+ custom-python = let
+ packageOverrides = self: super: {
+ pyopencl = super.pyopencl.overridePythonAttrs(old: rec {
+ buildInputs = with pkgs; [
+ opencl-headers ocl-icd python37Packages.pybind11
+ libGLU_combined
+ ];
+ # Enable OpenGL integration and fix build
+ preBuild = ''
+ python configure.py --cl-enable-gl
+ export HOME=/tmp/pyopencl
+ '';
+ });
+ };
+ in pkgs.python3.override { inherit packageOverrides; };
+
+ local-python = custom-python.withPackages (python-packages: with python-packages; [
+ numpy
+ sympy
+ scipy
+ pyopencl setuptools
+ pyopengl pyrr
+ matplotlib
+ ]);
+
+ in [
+ local-python
+ pkgs.opencl-info
+ pkgs.universal-ctags
+ ];
+
+ shellHook = ''
+ export NIX_SHELL_NAME="${name}"
+ export PYOPENCL_COMPILER_OUTPUT=1
+ export PYTHONPATH="$PWD:$PYTHONPATH"
+ '';
+}