Invoke reproducible Nix shells from Python.
Project description
py-nix-shell
Invoke commands sourced from Nix. This is mainly intended for those who vend cli tools inside environments that often support Nix and need to be able to reproducibly invoke those tools.
If folks don't have Nix, it will attempt to run the command anyways, and then provide an information install-error style message (either packages to install or a suggestion to install Nix).
This is a drop-in replacement for subprocess -- so you can
substitute your calls from subprocess.<method> to
nix_shell.<method>.
If Nix is not installed, this (by default) falls back to a non-Nix shell.
Installation
pip install nix-shell
Usage
import nix_shell
# nix_shell supports existing subprocess commands
# if the command name matches the nixpkgs name, use that
# see https://search.nixos.org/packages for a list of packages
nix_shell.run(["curl", "https://google.com"])
# you can also specify the nix packages to install
nix_shell.run(["curl", "https://google.com"], packages=["curlMinimal"])
# you can also use a dev environment from a flake
nix_shell.run(["curl", "https://google.com"], flake="github:chadac/py-nix-shell#sample-curl-env")
# this supports
It is also possible to specify a common environment to run commands under:
import nix_shell
nix = nix_shell.from_flake("/path/to/my/flake.nix")
nix.run(["curl", "https://google.com"])
nix_shell.mk_shell(packages=["git"])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nix_shell-0.0.3.tar.gz.
File metadata
- Download URL: nix_shell-0.0.3.tar.gz
- Upload date:
- Size: 18.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c8665b0dd2a11d152422ead7c1618398ffc9d1433202b3f2b2499a67074dff72
|
|
| MD5 |
cdf4fae0d1882c0647f1c74d6538b86e
|
|
| BLAKE2b-256 |
c9a8d9e6fea35e5bb2d7b49086eb1556f98b587c204d5b518868c4e11019d144
|
Provenance
The following attestation bundles were made for nix_shell-0.0.3.tar.gz:
Publisher:
publish.yaml on chadac/py-nix-shell
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nix_shell-0.0.3.tar.gz -
Subject digest:
c8665b0dd2a11d152422ead7c1618398ffc9d1433202b3f2b2499a67074dff72 - Sigstore transparency entry: 373678822
- Sigstore integration time:
-
Permalink:
chadac/py-nix-shell@91042afa83a5254d59cd0a3cd8cf1b1e2ad50a3c -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/chadac
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@91042afa83a5254d59cd0a3cd8cf1b1e2ad50a3c -
Trigger Event:
push
-
Statement type:
File details
Details for the file nix_shell-0.0.3-py3-none-any.whl.
File metadata
- Download URL: nix_shell-0.0.3-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb86eb690fdc4a3918b151f4d030d8f47890f377fece2d64ec8f56b59034156c
|
|
| MD5 |
1af683702dc025f569b4517e8c8888be
|
|
| BLAKE2b-256 |
61de8239c0e01c4393bdf3cb7a942c96358fd64569c167ee65ffbd244b74fbde
|
Provenance
The following attestation bundles were made for nix_shell-0.0.3-py3-none-any.whl:
Publisher:
publish.yaml on chadac/py-nix-shell
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nix_shell-0.0.3-py3-none-any.whl -
Subject digest:
fb86eb690fdc4a3918b151f4d030d8f47890f377fece2d64ec8f56b59034156c - Sigstore transparency entry: 373678864
- Sigstore integration time:
-
Permalink:
chadac/py-nix-shell@91042afa83a5254d59cd0a3cd8cf1b1e2ad50a3c -
Branch / Tag:
refs/tags/v0.0.3 - Owner: https://github.com/chadac
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@91042afa83a5254d59cd0a3cd8cf1b1e2ad50a3c -
Trigger Event:
push
-
Statement type: