From ca2f9ea0148fc39cc5b985d982f6de6f1563e8e2 Mon Sep 17 00:00:00 2001 From: Jacob Hinkle Date: Sat, 17 Sep 2022 13:23:07 -0400 Subject: [PATCH] Add flake.nix and flake.lock --- flake.lock | 43 +++++++++++++++++++++++++++++++++++++++++++ flake.nix | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..0b9b9d1 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "flake-utils": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1663244735, + "narHash": "sha256-+EukKkeAx6ithOLM1u5x4D12ZFuoi6vpPYjhNDmLz1o=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "178fea1414ae708a5704490f4c49ec3320be9815", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-22.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0c3edc8 --- /dev/null +++ b/flake.nix @@ -0,0 +1,41 @@ +{ + description = "A tool for composable tracking of scientific data provenance"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-22.05"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + # See https://old.reddit.com/r/Python/comments/npu66t/reproducible_python_environment_with_nix_flake/ + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachSystem [ "x86_64-linux" ] (system: + let + python = "python37"; + pkgs = (import nixpkgs { + inherit system; + config = { + allowUnfree = true; + cudaSupport = true; + }; + overlays = [ + ]; + }); + pythonPackages = pkgs.${python}.pkgs; + nancy = pythonPackages.buildPythonPackage { + name = "nancy"; + src = ./.; + propagatedBuildInputs = with pythonPackages; [ + dill + ]; + }; + # core pkgs are those required to run headless scripts + corePythonPkgs = ps: with ps; [ + numpy + pandas + ]; + corePythonEnv = pkgs.${python}.withPackages corePythonPkgs; + in rec { + defaultPackage = nancy; + devShell = pkgs.mkShell { buildInputs = with pkgs; [ corePythonEnv ]; }; + }); +}