A simple example of a Nix flake to package a Python program.
| .gitignore | Initial commit | |
| flake.lock | drop flake-utils | |
| flake.nix | drop flake-utils | |
| hello.py | initial commit | |
| LICENSE | Initial commit | |
| pyproject.toml | drop flake-utils | |
| README.md | added dev shell | |
hello-flake-python
A simple example of a Nix flake to package a Python program. This package contains a single executable that prints a greeting.
Running the executable
There is no need to install anything (except nix). Simply run the command below.
nix run "git+https://codeberg.org/mhwombat/hello-flake-python"
To run a specific branch, use the command below.
nix run "git+https://codeberg.org/mhwombat/hello-flake-python?ref=main"
To run a specific branch and revision, use the command below.
nix run "git+https://codeberg.org/mhwombat/hello-flake-python?ref=main&rev=12011eaa897728c731900b236d09df92bcca818a"
Launching a shell
To get a shell with this package available, use the command below.
nix shell "git+https://codeberg.org/mhwombat/hello-flake-python"
As in the previous section, you can modify the URL to select a specific branch and revision.
Launching a development environment
If you forked or cloned this repo and want to modify the source code, you can get a suitable development environment (with Python and flake-utils) using the command below.
nix develop