Skip to content

Instantly share code, notes, and snippets.

@MichaelXavier
Last active April 9, 2019 17:32
Show Gist options
  • Save MichaelXavier/d36fad521e4129b1a735b72189969136 to your computer and use it in GitHub Desktop.
Save MichaelXavier/d36fad521e4129b1a735b72189969136 to your computer and use it in GitHub Desktop.
wip conda multiplatform derivation
# Rename this if it works. Good candidate for extraction to a separate library.
# TODO: document reasoning
{ minicondaVersion ? "4.5.12"
, minicondaSha256 ?
if stdenv.isDarwin
then "8ebb463ddf46dd003616b2f6b678403a708e2c54dcc58e212bd35e257761912c"
else "e5e5b4cd2a918e0e96b395534222773f7241dc59d776db1b9f7fedfcb489157a"
, fetchurl
, stdenv
, bash
, file
#TODO: these are likely to not work on mac
, xorg
, libselinux
, condaDeps ? [ stdenv.cc xorg.libSM xorg.libICE xorg.libXrender libselinux ]
}:
let
src = fetchurl {
url =
if stdenv.isDarwin
then "https://repo.continuum.io/miniconda/Miniconda3-${minicondaVersion}-MacOSX-x86_64.sh"
else "https://repo.continuum.io/miniconda/Miniconda3-${minicondaVersion}-Linux-x86_64.sh";
sha256 = minicondaSha256;
};
in
#TODO: what if we did what the original did without the shell?
# TODO: debugging guide here: https://nixos.wiki/wiki/Nixpkgs/Create_and_debug_packages
stdenv.mkDerivation {
name = "conda";
src = src;
buildInputs = [
bash
file
] ++ condaDeps;
unpackPhase = "true";
# buildPhase
buildPhase = "true";
#TODO: we're not producing an $out/bin, the bin is in $out/.conda
#TODO: drop -xs?
#TODO: drop debugging
#TODO: AHA, sandboxing is preventing us from seeing those paths, i think i need a build phase to set the prefix to the build dir, then in install, move that artifact to $out
installPhase = ''
set -x
cp $src ./install
chmod +x ./install
bash -x install -p $out -b -f
'';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment