Skip to content

Commit c1523e4

Browse files
committed
Remove poetry2nix
1 parent c719758 commit c1523e4

File tree

5 files changed

+62
-1209
lines changed

5 files changed

+62
-1209
lines changed

flake.lock

Lines changed: 6 additions & 120 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 37 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
{
22
inputs = {
33
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
4-
poetry2nix = {
5-
url = "github:nix-community/poetry2nix";
6-
inputs.nixpkgs.follows = "nixpkgs";
7-
};
84
flake-parts.url = "github:hercules-ci/flake-parts";
95
flake-utils.url = "github:numtide/flake-utils";
106
process-compose-flake.url = "github:Platonic-Systems/process-compose-flake";
@@ -37,41 +33,41 @@
3733
...
3834
}:
3935
let
40-
poetry2nix = inputs.poetry2nix.lib.mkPoetry2Nix { inherit pkgs; };
41-
python = pkgs.python312;
42-
overrides = poetry2nix.defaultPoetryOverrides.extend (
43-
self: super: {
44-
types-peewee = super.types-peewee.overridePythonAttrs (old: {
45-
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ];
46-
});
47-
types-markupsafe = super.types-markupsafe.overridePythonAttrs (old: {
48-
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ];
49-
});
50-
types-werkzeug = super.types-werkzeug.overridePythonAttrs (old: {
51-
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ];
52-
});
53-
types-jinja2 = super.types-jinja2.overridePythonAttrs (old: {
54-
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ];
55-
});
56-
types-flask = super.types-flask.overridePythonAttrs (old: {
57-
buildInputs = (old.buildInputs or [ ]) ++ [ super.setuptools ];
58-
});
59-
}
60-
);
61-
application = poetry2nix.mkPoetryApplication {
62-
projectDir = ./.;
63-
inherit overrides;
64-
inherit python;
65-
};
66-
env = poetry2nix.mkPoetryEnv {
67-
projectDir = ./.;
68-
groups = [ "dev" ];
69-
editablePackageSources = {
70-
snapbin = ./snapbin;
36+
pyproject = pkgs.lib.importTOML ./pyproject.toml;
37+
myPython = pkgs.python312.override {
38+
self = myPython;
39+
packageOverrides = pyfinal: pyprev: {
40+
# An editable package with a script that loads our mutable location
41+
snapbin-editable = pyfinal.mkPythonEditablePackage {
42+
# Inherit project metadata from pyproject.toml
43+
pname = pyproject.project.name;
44+
inherit (pyproject.project) version;
45+
46+
# The editable root passed as a string
47+
root = "$DEVENV_ROOT/snapbin"; # Use environment variable expansion at runtime
48+
};
7149
};
72-
inherit overrides;
73-
inherit python;
7450
};
51+
52+
pythonDev = myPython.withPackages (p: [
53+
p.black
54+
p.gunicorn
55+
p.isort
56+
p.snapbin-editable
57+
p.mypy
58+
p.pylint
59+
p.pylsp-mypy
60+
p.pytest
61+
p.pytest-cov
62+
p.pytest-xdist
63+
p.python-lsp-ruff
64+
p.python-lsp-server
65+
p.ruff
66+
]);
67+
pythonProd = myPython.withPackages (p: [
68+
p.gunicorn
69+
p.snapbin-editable
70+
]);
7571
in
7672
{
7773
process-compose."dev-services" = {
@@ -85,7 +81,7 @@
8581
settings.processes.gunicorn = {
8682
command = ''
8783
cd "$DEVENV_ROOT"
88-
${application.dependencyEnv}/bin/gunicorn --bind=0.0.0.0 snapbin.main:app
84+
${pythonDev}/bin/gunicorn --bind=0.0.0.0 snapbin.main:app
8985
'';
9086
};
9187
}
@@ -97,11 +93,11 @@
9793
tag = "latest";
9894
copyToRoot = pkgs.buildEnv {
9995
name = "image-root";
100-
paths = [ application.dependencyEnv ];
96+
paths = [ pythonProd ];
10197
};
10298
config = {
10399
Cmd = [
104-
"${application.dependencyEnv}/bin/gunicorn"
100+
"${pythonProd}/bin/gunicorn"
105101
"--bind=0.0.0.0"
106102
"snapbin.main:app"
107103
];
@@ -124,7 +120,7 @@
124120
PC_PORT_NUM = "9999";
125121
};
126122
packages = [
127-
env
123+
pythonDev
128124
pkgs.poetry
129125
];
130126
inputsFrom = [

0 commit comments

Comments
 (0)