Skip to content

Instantly share code, notes, and snippets.

@nico202
Created June 16, 2017 09:54
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nico202/9377b3b378eab950dc05566e733ea320 to your computer and use it in GitHub Desktop.
Save nico202/9377b3b378eab950dc05566e733ea320 to your computer and use it in GitHub Desktop.
with import <nixpkgs> {};
{
repositoryName = stdenv.mkDerivation {
name = "repositoryName";
buildInputs = [
julia_05 # works with julia (v0.4) too
# Any other dependency you need
];
SSL_CERT_FILE="/etc/ssl/certs/ca-certificates.crt";
GIT_SSL_CAINFO="/etc/ssl/certs/ca-certificates.crt";
# First important part: Add here the dependencies the packages you want to install need
LD_LIBRARY_PATH="${glfw}/lib:${mesa}/lib:${freetype}/lib:${imagemagick}/lib:${portaudio}/lib:${libsndfile.out}/lib:${libxml2.out}/lib:${expat.out}/lib:${cairo.out}/lib:${pango.out}/lib:${gettext.out}/lib:${glib.out}/lib:${gtk3.out}/lib:${gdk_pixbuf.out}/lib:${cairo.out}:${tk.out}/lib:${tcl.out}/lib:${pkgs.sqlite.out}/lib:${pkgs.zlib}/lib";
shellHook = ''
unset http_proxy
# This is the seconnd important part. Set a relative julia_pkgdir path so that they are specific to this
# Nix env environment and are not global
export JULIA_PKGDIR=$(realpath ./.julia_pkgs)
mkdir -p $JULIA_PKGDIR
# You could also call julia -e "Pkg.init()" # and if you want install the packages you need
'';
};
}
@nico202
Copy link
Author

nico202 commented Dec 9, 2017

Hi, for some reason I have not received the notification for your comment

I'm not a nix-language expert, so I have a couple of scripts that I keep in every project, doing the required changes every time. If in those months you have answers for your first question, let me know.

Question #2: If on non-nixos systems with nix installed, those are needed to verify ssl certificates
Question #3: Some packages have separate dev and bin derivations, others are all together. So sometimes you need to use the .out to get the bins and .dev to get the headers. At least to my understanding. Those variables (inside the curly ${}) are resolved to nixos paths, so yes, they will get "installed" automatically (lazy evaluation resolves needed paths in order to build the derivation)
Question #4: can't remember, sorry

@AttilaVM
Copy link

It worked like a charm thank you.

I defined an environment based on your work, here. Tomorrow I will make an overlay version.

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