-
Notifications
You must be signed in to change notification settings - Fork 346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot run task after poetry install
#1557
Comments
I'm not familiar with the tasks implementation, but something tells me we have an issue in the graph traversal somewhere, ie. we're not picking up indirect dependencies of |
I think I've found the issue. We'll discuss it next week and have a fix out promptly. |
After a search on GitHub, I have found a way to make this work. Credits go to this commit. It's a matter of defining both devenv.nix (...)
languages.python = {
enable = true;
version = "3.12.7";
venv = {
enable = true;
requirements = ./requirements.txt;
};
};
tasks = {
# Patch ruff to make it runnable
"venv:patchelf" = {
exec = "${lib.getExe pkgs.patchelf} --set-interpreter ${pkgs.stdenv.cc.bintools.dynamicLinker} $VIRTUAL_ENV/bin/ruff";
after = [ "devenv:python:virtualenv" ]; # Runs after this
before = [ "devenv:enterShell" ]; # Runs before this
};
}; |
Describe the bug
I'm attempting to run a small script after
poetry install
completes in my repo.poetry install
downloads some binaries that are dynamically linked againstld
, and thus do not work on NixOS. I'm trying to automatically runpatchelf
afterpoetry install
completes in order to patchruff
, thus allowing NixOS developers to not have to worry about doing it themselves or manually running a command after eachpoetry install
.Here is my devenv module:
I first tried to put the above
patchelf; autoPatchelf
invocation inenterShell
, but that failed aspoetry install
runs after whatever a devenv module defines inenterShell
. Meaningpatchelf
would be called, and thenruff
would be downloaded bypoetry install
.Interestingly,
poetry install
is defined as a task that apparently runs afterenterShell
:devenv/src/modules/languages/python.nix
Lines 457 to 486 in fa53082
I attempted all sorts of combinations of trying to get my task to run after both
"devenv:enterShell"
and"devenv:python:poetry"
, but to no avail. If I do:then my task runs, but does so before the
poetry install
, so fails asruff
does not exist:however, if I do the logical thing and:
my task doesn't run at all:
So I'm at a loss. This is using a flake, not
devenv.nix/yaml/lock
.To reproduce
My devenv module can be found here, along with all other relevant files: https://github.com/element-hq/nix-flakes/blob/anoa/devenv_repro/project-flakes/sygnal/module.nix
Version
Using flakes, devenv v1.3.1.
The text was updated successfully, but these errors were encountered: