artiq-extrapkg/flake.nix

54 lines
1.9 KiB
Nix
Raw Normal View History

2022-02-12 17:10:14 +08:00
{
description = "Additional packages for ARTIQ";
inputs.artiq.url = git+https://github.com/m-labs/artiq.git;
outputs = { self, artiq }:
let
pkgs = import artiq.inputs.nixpkgs { system = "x86_64-linux"; };
condaDeps = with pkgs; [ zlib xorg.libSM xorg.libICE xorg.libX11 xorg.libXau xorg.libXi xorg.libXrender libselinux libGL ];
# Use the full Anaconda distribution, which already contains conda-build and its many dependencies.
condaInstaller = pkgs.fetchurl {
url = "https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh";
sha256 = "sha256-/t+eNAA5VX97XoqKhq/6nSmfXpggFEvXuSrp9+4IrGA=";
};
condaInstallerEnv = pkgs.buildFHSUserEnv {
name = "conda-installer-env";
targetPkgs = pkgs: condaDeps;
};
condaInstalled = pkgs.stdenvNoCC.mkDerivation {
name = "conda-installed";
src = condaInstaller;
buildInputs = [ condaInstallerEnv ];
phases = [ "buildPhase" "installPhase" ];
buildPhase =
''
cp $src conda-installer.sh
chmod +x conda-installer.sh
# keep the same file length to avoid breaking embedded payload offsets
sed -i 0,/unset\ LD_LIBRARY_PATH/s//\#nset\ LD_LIBRARY_PATH/ conda-installer.sh
'';
installPhase =
''
conda-installer-env -c "./conda-installer.sh -p $out -b"
substituteInPlace $out/lib/python3.9/site-packages/conda/gateways/disk/__init__.py \
--replace "os.chmod(path, 0o2775)" "pass"
'';
};
condaBuilderEnv = pkgs.buildFHSUserEnv {
name = "conda-builder-env";
targetPkgs = pkgs: condaDeps ++ [ condaInstalled ];
};
in rec {
packages.x86_64-linux = {
inherit condaBuilderEnv;
};
hydraJobs = {
inherit (packages.x86_64-linux) condaBuilderEnv;
};
};
}