Skip to content

Instantly share code, notes, and snippets.

@RobBlackwell
Last active November 10, 2020 18:04
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 RobBlackwell/0613bc7ff68e1e0f5e804b924857182c to your computer and use it in GitHub Desktop.
Save RobBlackwell/0613bc7ff68e1e0f5e804b924857182c to your computer and use it in GitHub Desktop.

Patch Julia

find /nix -name '*ld-linux-x86-64.so.2'
/nix/store/68sa3m89shpfaqq1b9xp5p1360vqhwx6-glibc-2.25/lib/ld-linux-x86-64.so.2

set -x the_interpreter "/nix/store/68sa3m89shpfaqq1b9xp5p1360vqhwx6-glibc-2.25/lib/ld-linux-x86-64.so.2"

patchelf --set-interpreter $the_interpreter julia

shell.nix for sbcl with SSL for Hunchentoot

{ pkgs ? import <nixpkgs> {} }:
with pkgs; mkShell {
  buildInputs = [sbcl openssl];
  shellHook = ''
            export LD_LIBRARY_PATH="${stdenv.lib.makeLibraryPath [openssl]}"
'';            
}              

shell.nix for pip enabled Python

# On NIX enabled systems, just run `nix-shell`
# From https://nixos.org/manual/nixpkgs/stable/#python

with import <nixpkgs> { };

let
  pythonPackages = python3Packages;
in pkgs.mkShell rec {
  name = "impurePythonEnv";
  venvDir = "./.venv";
  buildInputs = [
    # A Python interpreter including the 'venv' module is required to bootstrap
    # the environment.
    pythonPackages.python

    # This execute some shell code to initialize a venv in $venvDir before
    # dropping into the shell
    pythonPackages.venvShellHook

    # Those are dependencies that we would like to use from nixpkgs, which will
    # add them to PYTHONPATH and thus make them accessible from within the venv.
    pythonPackages.matplotlib
    pythonPackages.numpy
    pythonPackages.pandas
    pythonPackages.geopy
    pythonPackages.scipy
    pythonPackages.future
    pythonPackages.toml
    pythonPackages.scikitimage
    pythonPackages.opencv4
    pythonPackages.ipython

    # In this particular example, in order to compile any binary extensions they may
    # require, the Python modules listed in the hypothetical requirements.txt need
    # the following packages to be installed locally:
    taglib
    openssl
    git
    libxml2
    libxslt
    libzip
    zlib
  ];

  # Run this command, only after creating the virtual environment
  postVenvCreation = ''
    unset SOURCE_DATE_EPOCH
    pip install -r requirements.txt
  '';

  # Now we can execute any commands within the virtual environment.
  # This is optional and can be left out to run pip manually.
  postShellHook = ''
    # allow pip to install wheels
    unset SOURCE_DATE_EPOCH
  '';

}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment