-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathflake.nix
More file actions
87 lines (86 loc) · 2.71 KB
/
Copy pathflake.nix
File metadata and controls
87 lines (86 loc) · 2.71 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
{
inputs = {
flake-utils = {
url = "github:numtide/flake-utils";
};
nixpkgs = {
url = "github:NixOS/nixpkgs?ref=nixos-24.11";
};
poetry2nix = {
url = "github:nix-community/poetry2nix";
inputs = {
nixpkgs = {
follows = "nixpkgs";
};
flake-utils = {
follows = "flake-utils";
};
};
};
};
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = nixpkgs.legacyPackages.${system};
inherit (poetry2nix.lib.mkPoetry2Nix { inherit pkgs; }) defaultPoetryOverrides mkPoetryEnv;
pyproject = builtins.fromTOML(builtins.readFile(./pyproject.toml));
name = pyproject.tool.poetry.name;
default-python = pkgs.python313;
# Alternative Pythons for Tox
alternative-pythons = [
pkgs.pypy3
pkgs.python39
pkgs.python310
pkgs.python311
pkgs.python312
pkgs.python313
pkgs.poetry
pkgs.libffi.dev
pkgs.zlib.dev
];
dev-dependencies = [
pkgs.poetry
];
pypkgs-build-requirements = {
charmonium-cache = [ "poetry" ];
charmonium-time-block = [ "poetry" ];
charmonium-async-subprocess = [ "poetry" ];
charmonium-freeze = [ "poetry" ];
tox = [ "hatchling" "hatch-vcs" ];
bump2version = [ "setuptools" ];
gitchangelog = [ "setuptools" ];
mando = [ "setuptools" ];
proselint = [ "poetry" ];
deptry = [ "poetry" ];
pyproject-api = [ "hatchling" "hatch-vcs" ];
pyprojroot = [ "setuptools" ];
autoimport = [ "setuptools" ];
radon = [ "setuptools" ];
pytest-assume = [ "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 {
devShells = rec {
default = pkgs.mkShell {
packages = [
(mkPoetryEnv {
projectDir = ./.;
python = default-python;
groups = [ "dev" ];
overrides = p2n-overrides;
})
] ++ dev-dependencies ++ alternative-pythons;
};
};
packages = rec {
# TODO
# charmonium-cache = ?;
};
});
}