forked from r0fls/soad
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
103 lines (98 loc) · 2.91 KB
/
flake.nix
File metadata and controls
103 lines (98 loc) · 2.91 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
{
description = "Python development environment";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils.url = "github:numtide/flake-utils";
poetry2nix = {
url = "github:nix-community/poetry2nix";
};
nixpkgs-docker-layering = {
url = "github:colonelpanic8/nixpkgs/docker-customisable-layering-strategy";
};
};
outputs = { self, nixpkgs, flake-utils, poetry2nix, nixpkgs-docker-layering }:
flake-utils.lib.eachDefaultSystem (system:
let
inherit (poetry2nix.lib.mkPoetry2Nix {inherit pkgs;}) mkPoetryApplication defaultPoetryOverrides;
pkgs = nixpkgs.legacyPackages.${system};
python-with-pip = pkgs.python312.withPackages (p:
with p; [
pip
]);
dev-packages = with pkgs; [
pyright
black
isort
autoflake
alejandra
python-with-pip
git
poetry
curl
jq
just
kubernetes-helm
kubectx
kubectl
terraform
terragrunt
];
other-packages = with pkgs; [
boost
glib
stdenv.cc.cc
zlib
clang
];
pypkgs-build-requirements = {
asyncio = ["setuptools"];
};
p2n-overrides = defaultPoetryOverrides.extend (self: super:
(builtins.mapAttrs (
package: build-requirements:
(builtins.getAttr package super).overridePythonAttrs (old: {
buildInputs =
(old.buildInputs or [])
++ (builtins.map (pkg:
if builtins.isString pkg
then builtins.getAttr pkg super
else pkg)
build-requirements);
})
)
pypkgs-build-requirements));
in {
packages = rec {
soad = mkPoetryApplication {
projectDir = self;
overrides = p2n-overrides;
preferWheels = true;
python = pkgs.python312;
extras = [];
groups = [];
checkGroups = [];
};
};
devShells.default = pkgs.mkShell rec {
packages = [pkgs.poetry];
nativeBuildInputs = dev-packages ++ other-packages;
LD_LIBRARY_PATH = pkgs.lib.makeLibraryPath nativeBuildInputs;
STDENV = "${pkgs.stdenv.cc.cc.lib}";
PYRIGHT = "${pkgs.pyright}/bin/pyright";
shellHook =
''
poetry env use ${python-with-pip}/bin/python
export PATH="$PATH:$(pwd)/bin"
''
+ (
if system == "x86_64-linux"
then ''
if [[ $(grep -i microsoft /proc/version) ]]; then
export LD_LIBRARY_PATH=/usr/lib/wsl/lib:$LD_LIBRARY_PATH
fi
''
else ""
);
};
});
}