Skip to content
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

[Feature] Package for nix #18

Open
pbek opened this issue Oct 22, 2024 · 8 comments
Open

[Feature] Package for nix #18

pbek opened this issue Oct 22, 2024 · 8 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@pbek
Copy link

pbek commented Oct 22, 2024

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

@pbek
Copy link
Author

pbek commented Oct 22, 2024

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
Copy link
Owner

marph91 commented Oct 22, 2024

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
Copy link
Author

pbek commented Oct 22, 2024

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

As far as I read, is buildPythonApplication using pyinstaller.

@pbek
Copy link
Author

pbek commented Oct 22, 2024

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
Copy link
Author

pbek commented Oct 22, 2024

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

@marph91
Copy link
Owner

marph91 commented Oct 22, 2024

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
Copy link
Author

pbek commented Oct 23, 2024

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
Copy link
Author

pbek commented Oct 23, 2024

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!

@marph91 marph91 added the help wanted Extra attention is needed label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants