Skip to content

Instantly share code, notes, and snippets.

@uskudnik
Created January 8, 2018 17:56
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 uskudnik/172af4ba1b2480eb3af96323be85b3c8 to your computer and use it in GitHub Desktop.
Save uskudnik/172af4ba1b2480eb3af96323be85b3c8 to your computer and use it in GitHub Desktop.
pynacl-nix-example
$ cat shell.nix
let channels = rec {
pkgs = import <nixpkgs> {};
pkgs-unstable = import (fetchTarball https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz) {};
};
in with channels;
let dependencies = rec {
_python = pkgs.python27Full;
_pip = pkgs.python27Packages.pip;
_virtualenv = pkgs.python27Packages.virtualenv;
_ipython = pkgs.python27Packages.ipython;
_ipdb = pkgs.python27Packages.ipdb;
_pynacl = pkgs.python27Packages.pynacl;
};
in with dependencies;
pkgs.stdenv.mkDerivation rec {
name = "env";
env = pkgs.buildEnv {
name = name;
paths = buildInputs;
};
buildInputs = [
(pkgs.python27.buildEnv.override {
ignoreCollisions = true;
extraLibs = [
_pip
_ipython
_ipdb
_pynacl
];
})
];
shellHook = ''
# set SOURCE_DATE_EPOCH so that we can use python wheels
SOURCE_DATE_EPOCH=$(date +%s)
BASE_PATH=$PWD
'';
}
####
$ nix-shell
[nix-shell:~/dev/pynacl-example]$ ipython
Python 2.7.14 (default, Sep 16 2017, 17:49:51)
Type "copyright", "credits" or "license" for more information.
IPython 5.3.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: import nacl
In [2]:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment