From 5526e491cf2974105dff791060ed6d6c5fd8d5f6 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 17 Jul 2019 23:50:06 +0800 Subject: [PATCH] expose condaBuilderEnv --- artiq-fast/conda-build.nix | 28 +--------------------------- artiq-fast/conda-builder-env.nix | 29 +++++++++++++++++++++++++++++ 2 files changed, 30 insertions(+), 27 deletions(-) create mode 100644 artiq-fast/conda-builder-env.nix diff --git a/artiq-fast/conda-build.nix b/artiq-fast/conda-build.nix index 581b0dd..fd4b394 100644 --- a/artiq-fast/conda-build.nix +++ b/artiq-fast/conda-build.nix @@ -4,36 +4,10 @@ { pkgs }: { name, src, recipe ? "fake-conda"}: -with pkgs; - let - condaDeps = [ stdenv.cc xorg.libSM xorg.libICE xorg.libXrender libselinux ]; - # Use the full Anaconda distribution, which already contains conda-build and its many dependencies, - # so we don't have to manually deal with them. - condaInstaller = fetchurl { - url = "https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh"; - sha256 = "0fmpdd5876ylds98mydmv5klnwlzasa461k0l1f4vhbw96vm3j25"; - }; - condaSrcChmod = runCommand "conda-src-chmod" { } "mkdir $out; cp ${condaInstaller} $out/conda-installer.sh; chmod +x $out/conda-installer.sh"; - condaInstallerEnv = buildFHSUserEnv { - name = "conda-installer-env"; - targetPkgs = pkgs: ([ condaSrcChmod ] ++ condaDeps); - }; - - condaInstalled = runCommand "conda-installed" { } - '' - ${condaInstallerEnv}/bin/conda-installer-env -c "${condaSrcChmod}/conda-installer.sh -p $out -b" - substituteInPlace $out/lib/python3.7/site-packages/conda/gateways/disk/__init__.py \ - --replace "os.chmod(path, 0o2775)" "pass" - ''; - condaBuilderEnv = buildFHSUserEnv { - name = "conda-builder-env"; - targetPkgs = pkgs: [ condaInstalled ] ++ condaDeps; - }; - + condaBuilderEnv = import ./conda-builder-env { inherit pkgs; }; in stdenv.mkDerivation { inherit name src; - buildInputs = [ condaBuilderEnv ]; buildCommand = '' HOME=`pwd` diff --git a/artiq-fast/conda-builder-env.nix b/artiq-fast/conda-builder-env.nix new file mode 100644 index 0000000..e54a8a5 --- /dev/null +++ b/artiq-fast/conda-builder-env.nix @@ -0,0 +1,29 @@ +{ pkgs }: + +with pkgs; + +let + condaDeps = [ stdenv.cc xorg.libSM xorg.libICE xorg.libXrender libselinux ]; + # Use the full Anaconda distribution, which already contains conda-build and its many dependencies, + # so we don't have to manually deal with them. + condaInstaller = fetchurl { + url = "https://repo.anaconda.com/archive/Anaconda3-2019.03-Linux-x86_64.sh"; + sha256 = "0fmpdd5876ylds98mydmv5klnwlzasa461k0l1f4vhbw96vm3j25"; + }; + condaSrcChmod = runCommand "conda-src-chmod" { } "mkdir $out; cp ${condaInstaller} $out/conda-installer.sh; chmod +x $out/conda-installer.sh"; + condaInstallerEnv = buildFHSUserEnv { + name = "conda-installer-env"; + targetPkgs = pkgs: ([ condaSrcChmod ] ++ condaDeps); + }; + + condaInstalled = runCommand "conda-installed" { } + '' + ${condaInstallerEnv}/bin/conda-installer-env -c "${condaSrcChmod}/conda-installer.sh -p $out -b" + substituteInPlace $out/lib/python3.7/site-packages/conda/gateways/disk/__init__.py \ + --replace "os.chmod(path, 0o2775)" "pass" + ''; +in + buildFHSUserEnv { + name = "conda-builder-env"; + targetPkgs = pkgs: [ condaInstalled ] ++ condaDeps; + }