nobodyinperson,
@nobodyinperson@fosstodon.org avatar

I think I have finally™️ (for the third or so time) found myself a solution for :python: #Python development on :nixos: #NixOS that allows me to just work with #pythonPoetry et. al. as on other distros.

The solution is to pre-build an FHSUserEnv in your configuration.nix, e.g. like this¹.

When starting Python dev work, I now execute fhs (it's fast!), or directly fhs -c 'poetry shell' and everything works as expected, including #PyPI wheels etc.

¹https://gitlab.com/nobodyinperson/nixconfig/-/blob/main/fhs.nix?ref_type=heads

cc @publicvoit

docRekd,

@publicvoit @nobodyinperson Have you tried https://github.com/nix-community/poetry2nix ? Did it gave you problems?

nobodyinperson,
@nobodyinperson@fosstodon.org avatar

@docRekd @publicvoit Of course. It's not a general solution to be able to do Python dev on NixOS. One needs a separate nix file per project (that alone is an absolute no-go). Even if you take the time and try to make one, still no guarantee that it works (even with preferWheels=true!). Weird errors arise with nix' typical awful error messages and at this point it's not useable for general Python dev. Maybe for specific standalone Python projects you want to #nix-ify.

publicvoit,
@publicvoit@graz.social avatar

@nobodyinperson @docRekd I feel you pain and I'm not even trying to do Python dev but only invoking my own scripts.

I started a wrapper script that wraps nix-shell and poetry so that it does "invoke this Python file" with all its Nix-specific mumbo jumbo.

In my mind, I already quite NixOS since it complicates the most normal things so that it's adding more effort than saves me from.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • python
  • kavyap
  • ngwrru68w68
  • tacticalgear
  • DreamBathrooms
  • mdbf
  • magazineikmin
  • thenastyranch
  • Youngstown
  • Durango
  • slotface
  • everett
  • vwfavf
  • rosin
  • anitta
  • Leos
  • khanakhh
  • GTA5RPClips
  • cisconetworking
  • InstantRegret
  • ethstaker
  • osvaldo12
  • tester
  • provamag3
  • modclub
  • cubers
  • normalnudes
  • megavids
  • JUstTest
  • All magazines