Add flake.nix and flake.lock

This commit is contained in:
Jacob Hinkle 2022-09-17 13:23:07 -04:00
parent 68ec5ca286
commit ca2f9ea014
2 changed files with 84 additions and 0 deletions

43
flake.lock generated Normal file
View File

@ -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
}

41
flake.nix Normal file
View File

@ -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 ]; };
});
}