-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathflake.nix
More file actions
86 lines (78 loc) · 2.06 KB
/
Copy pathflake.nix
File metadata and controls
86 lines (78 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
{
description = "ENTSO-E-apy Development Shell";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
};
outputs =
{ self, nixpkgs }:
let
system = "x86_64-linux"; # Adjust if necessary
pkgs = import nixpkgs {
inherit system;
};
pyproject = fromTOML (builtins.readFile ./pyproject.toml);
in
{
packages.${system} = rec {
default = pkgs.python3.pkgs.callPackage (./default.nix) {
self = self;
lib = pkgs.lib;
pyproject = pyproject;
};
entsoe-apy = default;
};
devShells.${system}.default = pkgs.mkShell {
name = "Python";
venvDir = "./.venv";
buildInputs =
with pkgs.python3.pkgs;
[
# Stuff needed for technical reasons
ipykernel
jupyterlab
pyzmq # Adding pyzmq explicitly
pip
notebook
jupyter
jupyter-client
venvShellHook
ruff
# Project specific
numpy
pandas
mkdocs-material
mkdocstrings
mkdocstrings-python
pytest
build
twine
]
++ [ pkgs.mkdocs ];
env = {
NIX_LD = nixpkgs.lib.fileContents "${pkgs.stdenv.cc}/nix-support/dynamic-linker";
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath (
with pkgs;
[
stdenv.cc.cc
stdenv.cc.cc.lib
]
);
EXTRA_CCFLAGS = "-I/usr/include";
};
# Run this command only after creating the virtual environment
postVenvCreation = ''
unset SOURCE_DATE_EPOCH
pip install -r requirements.txt
'';
# This is optional and can be left out to run pip manually.
postShellHook = ''
if [ -f .env ]; then
# Export variables from .env into the environment
set -a
source .env
set +a
fi
'';
};
};
}