marph91 / jimmy

Convert your notes to Markdown
https://marph91.github.io/jimmy/
GNU General Public License v3.0
34 stars 1 forks source link

[Feature] Package for nix #18

Open pbek opened 1 month ago

pbek commented 1 month ago

It would be great to have a package for jimmy in https://github.com/NixOS/nixpkgs (the largest package repository).

pbek commented 1 month ago

I had not any luck yet with https://github.com/pbek/nixcfg/blob/main/apps/jimmy/default.nix, is there maybe a python application that you know that is built similarly and that is present on https://search.nixos.org/packages?channel=unstable?

I have no knowledge of python packaging (I didn't even know about PyInstaller) and no experience in nix python packaging. 😅

marph91 commented 1 month ago

I'm not really familiar with the NixOS build system. I will check for similar applications (but probably only tomorrow).

There are two ways to distribute the script/app:

  1. Using the executable (built with pyinstaller -> no python required)
  2. Installing the requirements via pip install -r requirements/requirements.txt and running the script python src/jimmy_cli.py.
pbek commented 1 month ago

https://github.com/pbek/nixcfg/blob/bbbed2a76f84ef8f5f84cedf9a46214d1b4ec970/apps/jimmy/default.nix#L8

As far as I read, is buildPythonApplication using pyinstaller.

pbek commented 1 month ago

Btw. yesterday, I installed nix on an Ubuntu system. 😉 https://nixos.org/download/

I also installed https://github.com/direnv/direnv.

In combination, you can use it to get a specific set of tools in a certain directory. When you leave the directory, those packages are gone again. So you can use different versions of node, ruby, php, python, ... in different projects without complications. 😉

pbek commented 1 month ago

https://wiki.nixos.org/wiki/Packaging/Python could help with the packaging.

marph91 commented 1 month ago

I tried to read around a bit, but didn't get a clue. A similar project could be https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/applications/office/zim/default.nix. But not sure if it's really similar in terms of packaging. I guess the problem is that the pyproject.toml is not used for packaging this project, but just for some configuration.

The idea behind building a single binary was to not mess around with any OS or distribution specific things and having to maintain a single release path only. Is it possible to simply execute or wrap a binary in NixOS?

pbek commented 1 month ago

The idea behind building a single binary was to not mess around with any OS or distribution specific things and having to maintain a single release path only. Is it possible to simply execute or wrap a binary in NixOS?

Those binaries still depend on e.g. static glibc paths, which doesn't work on NixOS. With nix everything is built depending on patch in the nix-store, thus every e.g. application can depend on even different version of a library.

pbek commented 1 month ago

Usually, python applications are built directly for nixpkgs. I don't know if a wrapper like for e.g. packages that directly download a .deb file would be acceptable. Nix is also present on macOS!