From 859d62205b3f472a3657f4f9b573ea9f4f4e58e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Wed, 11 Nov 2020 10:39:33 +0100 Subject: [PATCH] nix: Add development shell --- flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 25 +++++++++++++++++++++++++ shell.nix | 19 +++++++++++++++++++ 3 files changed, 87 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 shell.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..9707267 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1604987532, + "narHash": "sha256-O3afggEbKLxnHbNmZq6Mno8dbtNrPk5D2RN3x5HoH5U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "dd1b7e377f6d77ddee4ab84be11173d3566d6a18", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs", + "utils": "utils" + } + }, + "utils": { + "locked": { + "lastModified": 1604964167, + "narHash": "sha256-+mTmiCD29wecyDaGlbeWpvnysBygagl9FdMVfdU0RTM=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "af81e8d00b2cd021d8806104f14d66ae429dc2f7", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..43559c0 --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + description = "SyntaxDot sequence labeler"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, utils }: + utils.lib.eachSystem [ "x86_64-linux" ] (system: + let + pkgs = import nixpkgs { + inherit system; + config = { + allowUnfreePredicate = pkg: builtins.elem (pkgs.lib.getName pkg) [ + "libtorch" + "nvidia-x11" + ]; + cudaSupport = true; + }; + }; + in { + devShell = import ./shell.nix { inherit pkgs; }; + }); +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..d341890 --- /dev/null +++ b/shell.nix @@ -0,0 +1,19 @@ +{ pkgs ? import {} }: + +with pkgs; + +mkShell { + nativeBuildInputs = [ cmake pkg-config rustup ]; + + buildInputs = [ openssl ]; + + HDF5_DIR = symlinkJoin { + name = "hdf5-join"; + paths = [ hdf5.dev hdf5.out ]; + }; + + LIBTORCH = symlinkJoin { + name = "torch-join"; + paths = [ libtorch-bin.dev libtorch-bin.out ]; + }; +}