/tweag-python-nix

Python-Nix FFI library using the new C API

Primary LanguagePythonMIT LicenseMIT

Python bindings for Nix using CFFI

Maintainer status: maintained, experimental Compatibility: Requires NixOS/nix#8699

Getting started

$ nix develop tweag/python-nix#env
$ python
>>> import nix
>>> nix.eval("1+1")
<Nix: 2>
>>>

Hacking

$ nix develop .#
$ cd src
$ python buildFFI.py
$ python
>>> import nix

Example

import nix
pkgs = nix.eval("import nixpkgs")({})
hello2 = pkgs["hello"]["overrideAttrs"](lambda o: {
  "pname": str(o["pname"]) + "-test"
})
hello2.build()