Skip to content

Use Nix to get Python #1040

Open
Open

Description

@Enzime

I don't have Python installed globally on my NixOS server so it would be nice if the following command just worked out of the box:

client$ sshuttle --dns -r <server> 0.0.0.0/0

Instead I need to first connect to <server> and get the path to Python:

server$ nix build nixpkgs#python3 --print-out-paths
/nix/store/3p3agnh4792y8bgjp0s8xx5bym1ahpks-python3-3.12.9

Then I can pass it using --python:

client$ sshuttle --dns -r <server> 0.0.0.0/0 --python /nix/store/3p3agnh4792y8bgjp0s8xx5bym1ahpks-python3-3.12.9/bin/python

Activity

  1. afrepues commented on Apr 15, 2025

    @afrepues

    Have you tried using nix-shell --run python -p python as the python interpreter?

  2. brianmay commented on Apr 15, 2025

    @brianmay
    Member
    nix develop
    

    Should also work. This will also allow access to uv. Not that uv is particularly important right now unless you want the dev/docs dependencies.

  3. Enzime commented on Apr 22, 2025

    @Enzime
    Author

    I don't think running these commands helped as the server I'm trying to run on doesn't have Python yet, so it would be nice if sshuttle could autodetect if Nix is available after SSH'ing into the server and then run nix-shell --run python -p python to get the Python interpreter

  4. brianmay commented on Apr 22, 2025

    @brianmay
    Member

    Oh, so you want it to auto-detect python using NixOS on the server?

    Seems an interesting idea.

    But you need to have some language that you can rely on being on the server already to do this detection.

    Possibly Posix shell. Actually that is what we do already. Although - currently - is not pretty, and it becoming more and more complicated :-(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions