-
Notifications
You must be signed in to change notification settings - Fork 164
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
add a nix flake #1624
add a nix flake #1624
Conversation
I would welcome a flake in the alot repo. I did set up a wrapping flake repo a while ago with a gtihub action to fetch the latest alot: https://github.com/lucc/alot-flake. Having the flake in the main alot repo would simplify a few things in my opinion:
But
|
I am not against this at all and happy to facilitate whatever makes usage and development easier.
If you continue to maintain this then all the better :)
P
Should I just merge this then?
Quoting Lucas Hoffmann (2023-07-28 10:43:11)
… I would welcome a flake in the alot repo.
I did set up a wrapping flake repo a while ago with a gtihub action to fetch
the latest alot: https://github.com/lucc/alot-flake. Having the flake in the
main alot repo would simplify a few things in my opinion:
• the workflow in lucc/alot-flake is regularly deactivated by github because
the repo does not change for a while, so it would be nice to get rid of the
extra repo and the workflow
• I have to maintain the building logic outside of the alot repo resulting in
divergent states (right now my flake does not handle the new pyproject file
I think)
• the flake in the alot main repo could be used in CI which would fix some of
my trouble in #1617
But
• the flake is mostly for the benefit of people using the nix package manager
which is not python specific (but can be used in ci)
• we can still maintain the flake in a separate repo (like I already do), so
that's no problem if @pazz is against it.
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.*Message ID: <pazz/alot/pull/
***@***.***>
|
From my point of view we can merge as soon as @teto has fixed draft state. |
dont it's not ready yet, I wanted to get your sentiment first but I've seen @lucc active on nixpkgs before so that's a positive point. I will have a look at @lucc's flake. This PR "autogenerates" the nix code from the pyproject.toml to avoid duplicating the code dependencies but it still needs some overrides/tweaks. |
@teto our CI was defuct for quite some time and it might be that some tests are broken. You might have to disable some test cases explicitly. The alot derivation in nixpkgs does it, my flake also does it. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Otherwise it looks good to me and I can run it with nix.
flake.nix
Outdated
}; | ||
|
||
devShells.default = pkgs.mkShell { | ||
packages = [ poetry2nix.packages.${system}.poetry ]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is this supposed to be used? I tried
nix develop github:teto/alot/flake
poetry run alot
which results in an import error (configobj not found). But when I run
nix develop github:teto/alot/flake
poetry install
it fails to install the gpg and the notmuch2 bindings because it can not find the gpgme and the notmuch development packages. Should these be added here?
@teto do we even need a dedicated devShell? When I run |
Once merged, running `nix run 'github:pazz/alot'` will be able to run a master version of alot. This assumes you have the nix package manager available with flakes enabled.
Agreed, let's merge we can refine later. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can merge this
I should have reported this here earlier: I just tried to install via poetry on a new system (debian testing) and it fails with gpg related errors.
I'm on debian 12 and successfully installed the dependencies indicated in this commit using
There has been some issues/discussions about Is this simply a debian testing issue with gpgme and pip or do we need to take action? |
It's possible I missed libgpgme-dev in the list of dependencies. On nixos it appears in the python package:
maybe apt has a |
I have installed all those packages where available, but think this binary simply has been removed from debian (and Arch?):
pspdev/pspdev#44
Quoting Matthieu Coudron (2023-08-29 10:23:54)
… It's possible I missed libgpgme-dev in the list of dependencies. On nixos it
appears in the python package:
nix-locate bin/gpgme-config
libsForQt5.qgpgme.dev 5,393 x /nix/store/a33nb2h0145dc0yhwih1dzxdik7b574d-gpgme-1.20.0-dev/bin/gpgme-config
python310Packages.gpgme.dev 5,389 x /nix/store/i98bybk6d6ci3rcmmvhw7pw4mypif57q-gpgme-1.20.0-dev/bin/gpgme-config
python311Packages.gpgme.dev 5,389 x /nix/store/jjg0kr6z221mqkmm0rz5cg5da9frf88s-gpgme-1.20.0-dev/bin/gpgme-config
gpgme.dev 5,390 x /nix/store/h7x6m11chlxbd5i9jd4saxkv1jbn4yf8-gpgme-1.20.0-dev/bin/gpgme-config
maybe apt has a python3-gpgme on top of python3-gpg ?
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.*Message ID: <pazz/alot/pull/
***@***.***>
|
@lucc I am confused as to where the difference is tbh. I am also a little confused as to where we declare dependencies now. I hope not three times? By the way, If I change diff --git a/pyproject.toml b/pyproject.toml
index 52feecf6..d7cfddb3 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -29,7 +29,7 @@ urwidtrees = ">=1.0.3"
twisted = ">=18.4.0"
python-magic = "*"
configobj = ">=4.7.0"
-gpg = "*"
+gnupg = "*"
[tool.poetry.dev-dependencies]
pycodestyle = "*" On debian testing, there should be no need to install gpgme wia pip or poetry because the documented dependencies (in alot's install docs) include |
The core difference between poetry and nix to my understanding is:
I think the fuzzyness comes from the fact that we use the poetry integration for nix, i.e we let nix read the poetry.lock file in order to read and build the dependencies of alot. (If you check flake.lock -- its quite short -- you can see that it does not list any dependencies of alot) So where do we list dependencies:
|
Thank you, this clears up a lot for me. alot uses the I can install alot via
Not surprising. Now, I do have a working As side-node: the line in the flake.lock file you linked to looks as if we already do some mocking around the gpg module. |
To my understanding poetry does everything in a venv so it will not pick up your system python stuff. About my comment: I was mixing up the strings |
I can reproduce the breakage on debian with this docker file: FROM debian
RUN apt -yq update && apt install -yq python3-poetry libnotmuch-dev libmagic1
# used by the gnupg python package?
RUN apt install -yq libgpgme-dev
# not picked up by poetry?
RUN apt install -yq python3-gpg
# fails with "Could not find gpgme-config. Please install the libgpgme development package."
RUN poetry install What is the relation between the different gpg modules for python? |
#1624 (comment) couldn't be any better it's perfect.
You can disable the venv created by poetry python-poetry/poetry#110 (comment) but that feels wrong. I had tested the poetry script in an ubuntu container, not debian. Do we need gpgme-config for email signature validation ? How is it used ? |
gpgme-config is used by the python gpg package during installation. The error message stems from poetry -> pip -> gpg package. The gpg package is used for all things crypo in alot. |
when I packaged alot for poetry, I did it within a ubuntu container and I realized it was not that easy to setup (I've updated instructions in the doc in that same PR). Nix is a package manager aiming at reproducibility and it excels in it.
With nix installed one can run
nix run 'github:teto/alot/flake'
to test the PR (though it is currently failing).Likewise
nix develop 'github:teto/alot/flake'
will give you a development environment with all dependencies available.Note: this is easy to maintain out of tree. The 2 flake.* files can be moved in a contrib/ folder to not crowd the root directory.