All Projects → t184256 → nixpkgs-python-importer

t184256 / nixpkgs-python-importer

Licence: MIT license
Violate Nix philosophy, install Python packages mid-session with `from nixpkgs.scipy import scipy`.

Programming Languages

python
139335 projects - #7 most used programming language
Nix
1067 projects

Projects that are alternatives of or similar to nixpkgs-python-importer

nixpkgs
Nix Packages collection used in Nubank
Stars: ✭ 24 (-11.11%)
Mutual labels:  nix, nixos, nixpkgs
triton
Triton Operating System
Stars: ✭ 56 (+107.41%)
Mutual labels:  nix, nixos, nixpkgs
nix-bisect
Bisect nix builds. Status: alpha/proof of concept. You'll probably have to dig into the implementation if you want to use it. Built for personal use, lightly maintained. PRs welcome. Issues welcome, but I make no promises regarding responses or fix
Stars: ✭ 72 (+166.67%)
Mutual labels:  nix, nixos, nixpkgs
Nixpkgs
Nix Packages collection
Stars: ✭ 8,322 (+30722.22%)
Mutual labels:  nix, nixos, nixpkgs
gradle2nix
Generate Nix expressions which build Gradle-based projects.
Stars: ✭ 71 (+162.96%)
Mutual labels:  nix, nixos, nixpkgs
Home Manager
Manage a user environment using Nix [maintainer=@rycee]
Stars: ✭ 2,447 (+8962.96%)
Mutual labels:  nix, nixos, nixpkgs
dotfiles
No place like ~. Nix. All. The. Things.
Stars: ✭ 48 (+77.78%)
Mutual labels:  nix, nixos, nixpkgs
crane
A Nix library for building cargo projects. Never build twice thanks to incremental artifact caching.
Stars: ✭ 348 (+1188.89%)
Mutual labels:  nix, nixos, nixpkgs
yants
Yet Another Nix Type System | Source has moved to https://git.tazj.in/tree/nix/yants
Stars: ✭ 35 (+29.63%)
Mutual labels:  nix, nixos, nixpkgs
nixos-tutorial
one hour, hands-on
Stars: ✭ 118 (+337.04%)
Mutual labels:  nix, nixos
nix-tutorials
Tutorials for Nix and Nixpkgs. Note so far it is a proof of concept.
Stars: ✭ 23 (-14.81%)
Mutual labels:  nix, nixos
dotnix
nix stuff
Stars: ✭ 27 (+0%)
Mutual labels:  nix, nixos
nix-config
My personal nix config
Stars: ✭ 32 (+18.52%)
Mutual labels:  nix, nixos
nixops-tutorial
Tutorial for practical deployments with NixOps
Stars: ✭ 93 (+244.44%)
Mutual labels:  nix, nixos
system
The system configuration of a professional yak shaver
Stars: ✭ 42 (+55.56%)
Mutual labels:  nix, nixos
myconfig
my Linux Configuration
Stars: ✭ 23 (-14.81%)
Mutual labels:  nix, nixos
digga
A flake utility library to craft shell-, home-, and hosts- environments.
Stars: ✭ 818 (+2929.63%)
Mutual labels:  nix, nixos
nixcfg
My nix configuration(s), using flakes. It's my laptop, it's my servers, it's my everything, in code.
Stars: ✭ 44 (+62.96%)
Mutual labels:  nix, nixos
deadnix
Scan Nix files for dead code
Stars: ✭ 121 (+348.15%)
Mutual labels:  nix, nixos
nixdots
I have no idea what the hell I'm doing
Stars: ✭ 46 (+70.37%)
Mutual labels:  nix, nixos

nixpkgs-python-importer

What

An importlib hack that allows from nixpkgs.pythonpackagename import modulename.

Examples:

from nixpkgs.scipy import scipy
import nixpkgs.scipy.scipy
from nixpkgs.matplotlib.matplotlib import pyplot as plt
import nixpkgs.matplotlib.matplotlib.pyplot as plt
from nixpkgs.pillow.PIL import Image

Why

I used to be a researcher who used python and xonsh interactively a lot. While I appreciate the purity of Nix, sometimes I really want to violate it and pull in some dependency into my shell right now, without tearing my session down, editing and rebuilding an environment, and then recreating my session from history.

A convenient way of spawning a xonsh instance with an extra dependency soothes the nerves a bit, but doesn't really free me from the recreation part.

I started writing a xonsh macro that ended up being a generic Python solution with a pleasingly nice syntax. I mean, from nixpkgs.scipy import scipy. Ain't that nice?

How

importlib magic

Try

The quickest way to try it would be (on a recent NixOS):

nix run '(import <nixpkgs> {}).python3.withPackages(ps:[ps.nixpkgs])' -c python

then try from nixpkgs.pbr import pbr (or any other package).

If that doesn't work, you may also try your luck with unstable nixpkgs:

nix run -f channel:nixos-unstable '(import <nixpkgs> {}).python3.withPackages(ps:[ps.nixpkgs])' -c python
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].