-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflake.nix
57 lines (56 loc) · 1.51 KB
/
flake.nix
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
{
description = "Jinko API Helper Python Package";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
outputs =
{ self
, flake-utils
, nixpkgs
, ...
} @ inputs:
flake-utils.lib.eachSystem
[
flake-utils.lib.system.x86_64-linux
]
(
system:
let
pkgs = import nixpkgs { inherit system; };
shellBuildInputs = [
# Poetry is the default package manager for the cookbook project
pkgs.poetry
# Add interactive bash to support `poetry shell`
pkgs.bashInteractive
pkgs.curl
];
shellInit = ''
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [
pkgs.stdenv.cc.cc
]}
export POETRY_CACHE_DIR="./.cache/pypoetry"
source .envrc
'';
in
{
# Default shell with only poetry installed
devShells = {
default = pkgs.mkShell {
name = "default";
buildInputs = shellBuildInputs;
shellHook = ''
${shellInit}
'';
};
# Install and load a poetry shell
poetry = pkgs.mkShell {
buildInputs = shellBuildInputs;
shellHook = ''
${shellInit}
poetry install
poetry shell
'';
};
};
}
);
}