Skip to content

Instantly share code, notes, and snippets.

@jimwhite
Last active February 19, 2024 07:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jimwhite/bc44ad2e3e1b4647afd2d5c4de87ccb6 to your computer and use it in GitHub Desktop.
Save jimwhite/bc44ad2e3e1b4647afd2d5c4de87ccb6 to your computer and use it in GitHub Desktop.
Quickstart for running Python using NixOS flox.dev in Docker
# Run Docker image with NixOS and flox:
# https://flox.dev/docs/install-flox/
# docker run --pull always --rm -it ghcr.io/flox/flox
docker run -it ghcr.io/flox/flox
# Then in that shell:
# flox config --set-bool disable_metrics true
cd ~
flox init
flox install python311Packages.python
flox activate
# Which nests into another shell:
python -m venv .venv
source .venv/bin/activate
# I think https://github.com/flox-examples/hello-python is supposed to do that somehow
# but I couldn't figure out the intended commands.
# There is an issue for flox which intends to automagically make Python requirements.txt work:
# https://github.com/flox/flox/issues/1027
# Check out this video from DockerCon 2023 about Nix and Docker together:
# https://www.youtube.com/watch?v=l17oRkhgqHE
# The second/main demo of that video used this (which is a Swiss army knife of Docker and Nix features):
# https://github.com/docker/babashka-pod-docker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment