| 1 Aug 2024 |
declension | Also have you seen https://github.com/nix-community/poetry2nix/blob/master/tests/dependency-environment/default.nix ? | 08:22:47 |
declension | Answering my own question a bit, it seems like the example does do exactly that:
https://github.com/nix-community/poetry2nix/blob/0a4d87e50f4eb58e04a4fe48692148196dc04501/templates/app/flake.nix#L41
| 08:58:41 |
declension | (though interestingly keeps it out of the main dev shell 🤔) | 08:59:08 |
oven_spinout988 | To be honest I saw it, but I am not sure hot to leverage it in my case.
Gunicorn is ran through a python script calling Popen.
| 10:25:27 |
| Vika (she/her) changed their profile picture. | 11:51:51 |
oven_spinout988 | * I saw it, but I am not sure hot to leverage it in my case.
Gunicorn is ran through a python script calling Popen.
| 16:06:09 |
Roland Coeurjoly | Hello, we are trying to build pendulum-3.0.0
Without any overrides, we get the following error: ModuleNotFoundError: No module named 'maturin' With this override:
buildInputs = (old.buildInputs or [ ]) ++ [ self.maturin ];
We also get the same error. Searching the code of poetry2nix, we find out some references to maturin, so we did the following override:
pendulum = super.pendulum.overridePythonAttrs (
old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [
pkgs.cargo
pkgs.rustc
pkgs.maturin
# pkgs.rustPlatform.cargoSetupHook
pkgs.rustPlatform.maturinBuildHook
];
buildInputs = (old.buildInputs or [ ]) ++ [ self.maturin ];
}
);
Now the error is the following:
Executing maturinBuildHook ++ env CC_X86_64_UNKNOWN_LINUX_GNU=/nix/store/62zpnw69ylcfhcpy1di8152zlzmbls91-gcc-wrapper-13.3.0/bin/cc CXX_X86_64_UNKNOWN_LINUX_GN> error: no matching package named pyo3 found location searched: registry crates-io required by package _pendulum v3.0.0 (/build/pendulum-3.0.0/rust) As a reminder, you're using offline mode (--offline) which can sometimes cause surprising resolution failures, if this error is too > 💥 maturin failed Caused by: Cargo metadata failed. Does your crate compile with cargo build? Caused by: cargo metadata exited with an error:
We are out of ideas.
Any ideas?
| 17:51:48 |
K900 | You need to provide cargoDeps | 17:53:06 |
K900 | See the overrides for cryptography and others for how to do that | 17:53:14 |
Roland Coeurjoly | thanks! I will look into that | 18:12:30 |
oven_spinout988 | Ok so using this in my flake :
| 22:20:17 |
oven_spinout988 | * Ok so using this in my flake :
in
{
packages = {
default = lookylooApp.dependencyEnv;
};
make gunicorn available at ./result/bin. Running gunicorn manualy (without the Popen but from my shell) is working.
I think the problem might come from the python script with a Popen calling gunicorn but "not the gunicorn from my flake"
How can I force the script to use the "generated" gunicorn ?
Should I replace the exe inside the python script ? Should I update the PATH env, and how ?
| 22:22:52 |
oven_spinout988 | Redacted or Malformed Event | 22:43:40 |
oven_spinout988 | I did found a solution :
{
description = "Application packaged using poetry2nix";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
flake-utils = {
url = "github:numtide/flake-utils";
};
poetry2nix = {
#url = "github:nix-community/poetry2nix";
url = "git+https://gitea.com/oven_spinout988/poetry2nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem
(system:
let
[...]
lookylooApp = let
lookylooApp = pkgs.poetry2nix.mkPoetryApplication
{
inherit projectDir;
inherit propagatedBuildInputs;
overrides = p2n-overrides;
};
in lookylooApp.overrideAttrs (old: {
postInstall = (if lookylooApp ? old then old else '''') + ''
substituteInPlace $out/lib/${lookylooApp.python.executable}/site-packages/bin/start_website.py \
--replace "gunicorn" "${lookylooApp.dependencyEnv}/bin/gunicorn"
'';
});
in
{
packages = {
default = lookylooApp;
};
};
}
Please let me know if the code can be improved
| 23:13:49 |
oven_spinout988 | * I did found a solution :
{
description = "Application packaged using poetry2nix";
inputs = {
[...]
};
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem
(system:
let
[...]
lookylooApp = let
lookylooApp = pkgs.poetry2nix.mkPoetryApplication
{
inherit projectDir;
inherit propagatedBuildInputs;
overrides = p2n-overrides;
};
in lookylooApp.overrideAttrs (old: {
postInstall = (if lookylooApp ? old then old else '''') + ''
substituteInPlace $out/lib/${lookylooApp.python.executable}/site-packages/bin/start_website.py \
--replace "gunicorn" "${lookylooApp.dependencyEnv}/bin/gunicorn"
'';
});
in
{
packages = {
default = lookylooApp;
};
};
}
Please let me know if the code can be improved
| 23:14:12 |
| 2 Aug 2024 |
truh | I have a subclass of gunicorn.app.base.BaseApplication and call Application(app, options).run() to sttart the webapp | 07:58:18 |
truh | * I have a subclass of gunicorn.app.base.BaseApplication and call SubClass(app, options).run() to sttart the webapp | 07:58:35 |
truh | * I have a subclass of gunicorn.app.base.BaseApplication and call SubClass(app, options).run() to start the webapp | 07:58:43 |
truh | class StandaloneApplication(gunicorn.app.base.BaseApplication):
def __init__(self, app, options=None):
self.options = options or {}
self.application = app
super().__init__()
def load_config(self):
config = {
key: value
for key, value in self.options.items()
if key in self.cfg.settings and value is not None
}
for key, value in config.items():
self.cfg.set(key.lower(), value)
def load(self):
return self.application
| 08:01:56 |
truh | * I have a subclass of gunicorn.app.base.BaseApplication and call StandaloneApplication(app, options).run() to start the webapp | 08:02:03 |
truh | I think I found this on stackoverflow | 08:02:29 |
truh | It's actually in the docs https://docs.gunicorn.org/en/stable/custom.html | 08:07:50 |
truh | * I think I found this on stackoverflow | 08:14:35 |
| 8 Aug 2024 |
| @trexd:matrix.org left the room. | 15:24:37 |
| 11 Aug 2024 |
| @interru:chat.interru.io left the room. | 15:48:06 |
| 12 Aug 2024 |
lambadada | Hey, I'm having an issue with getting pytorch to build. I have a minimal config which works fine: https://github.com/volkswagenfeature/minimalTorchRocm/tree/a9c7cd346e3a2493cc20489407df0d1f59d82d9f
But once I add pytorch, there's a null somewhere it shouldn't be: https://github.com/volkswagenfeature/minimalTorchRocm/commit/acf99457e810777a8316c26e69a0b281f0c0945e
Now nix run fails with
warning: Git tree '/home/tristan/Projects/nixos/minimal-replication/minimalTorchRocm' is dirty
error:
… while calling the 'derivationStrict' builtin
at /builtin/derivation.nix:9:12: (source not available)
… while evaluating derivation 'python3-3.12.4-env'
whose name attribute is located at /nix/store/qxf6anli54ij0q1sdlnlgx9hyl658a4v-source/pkgs/stdenv/generic/make-derivation.nix:334:7
… while evaluating attribute 'passAsFile' of derivation 'python3-3.12.4-env'
at /nix/store/qxf6anli54ij0q1sdlnlgx9hyl658a4v-source/pkgs/build-support/trivial-builders/default.nix:69:9:
68| inherit buildCommand name;
69| passAsFile = [ "buildCommand" ]
| ^
70| ++ (derivationArgs.passAsFile or [ ]);
(stack trace truncated; use '--show-trace' to show the full trace)
error: value is null while a set was expected
| 17:53:30 |
lambadada | I think it's a problem with selecting the right package because the only versions poetry was passing earlier were extremely old, and now I believe that it is no longer passing any versions at all, for whatever reason. There is a github issue which mentions the same error, but under different circumstances: https://github.com/nix-community/poetry2nix/issues/50
I have likely just made a mistake in my pyproject.toml, but I don't know what. | 17:59:05 |
| 13 Aug 2024 |
truh | maybe the problem is that your source for torch only has wheels and no source tarball | 07:56:54 |
| 14 Aug 2024 |
| * adisbladis drops some WIP here https://github.com/adisbladis/poetry2nix-v2 | 01:58:41 |
| ShamrockLee (Yueh-Shun Li) joined the room. | 10:35:58 |