install conda

This commit is contained in:
Sebastien Bourdeauducq 2022-02-12 17:10:14 +08:00
commit d2d79b180c
2 changed files with 190 additions and 0 deletions

137
flake.lock Normal file
View File

@ -0,0 +1,137 @@
{
"nodes": {
"artiq": {
"inputs": {
"mozilla-overlay": "mozilla-overlay",
"nixpkgs": "nixpkgs",
"sipyco": "sipyco",
"src-migen": "src-migen",
"src-misoc": "src-misoc",
"src-pythonparser": "src-pythonparser"
},
"locked": {
"lastModified": 1644635081,
"narHash": "sha256-d7rDZjHK5znKtUT72uVI4eegoRWtAqkJamyHQ+7FuZg=",
"ref": "master",
"rev": "b3b73948a256e2d738f05948671dacbd55dcf557",
"revCount": 7968,
"type": "git",
"url": "https://github.com/m-labs/artiq.git"
},
"original": {
"type": "git",
"url": "https://github.com/m-labs/artiq.git"
}
},
"mozilla-overlay": {
"flake": false,
"locked": {
"lastModified": 1643634764,
"narHash": "sha256-EcFlgzZnZSHwZixELYV1pa267t+u5mCeLhSNBeAA/+c=",
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"rev": "f233fdc4ff6ba2ffeb1e3e3cd6d63bb1297d6996",
"type": "github"
},
"original": {
"owner": "mozilla",
"repo": "nixpkgs-mozilla",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1644472683,
"narHash": "sha256-sP6iM4NksOYO6NFfTJ96cg+ClPnq6cdY30xKA1iYtyU=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7adc9c14ec74b27358a8df9b973087e351425a79",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-21.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"artiq": "artiq"
}
},
"sipyco": {
"inputs": {
"nixpkgs": [
"artiq",
"nixpkgs"
]
},
"locked": {
"lastModified": 1644634510,
"narHash": "sha256-5p88NKK/DTdb0F0+/7uObBohthdxHWLl782AaiPRf8E=",
"owner": "m-labs",
"repo": "sipyco",
"rev": "e9e69527927761544ab6d62f751e1ff512d1e661",
"type": "github"
},
"original": {
"owner": "m-labs",
"repo": "sipyco",
"type": "github"
}
},
"src-migen": {
"flake": false,
"locked": {
"lastModified": 1639659493,
"narHash": "sha256-qpVj/yJf4hDDc99XXpVPH4EbLC8aCmEtACn5qNc3DGI=",
"owner": "m-labs",
"repo": "migen",
"rev": "ac703010eaa06ac9b6e32f97c6fa98b15de22b31",
"type": "github"
},
"original": {
"owner": "m-labs",
"repo": "migen",
"type": "github"
}
},
"src-misoc": {
"flake": false,
"locked": {
"lastModified": 1641889368,
"narHash": "sha256-0Ai25lry9ju1HxFmfMRNKG8mamBqvw+kvDfpuK8Dtjo=",
"ref": "master",
"rev": "7242dc5a41732135425acc4871487461dfae6c66",
"revCount": 2419,
"submodules": true,
"type": "git",
"url": "https://github.com/m-labs/misoc.git"
},
"original": {
"submodules": true,
"type": "git",
"url": "https://github.com/m-labs/misoc.git"
}
},
"src-pythonparser": {
"flake": false,
"locked": {
"lastModified": 1628745371,
"narHash": "sha256-p6TgeeaK4NEmbhimEXp31W8hVRo4DgWmcCoqZ+UdN60=",
"owner": "m-labs",
"repo": "pythonparser",
"rev": "5413ee5c9f8760e95c6acd5d6e88dabb831ad201",
"type": "github"
},
"original": {
"owner": "m-labs",
"repo": "pythonparser",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

53
flake.nix Normal file
View File

@ -0,0 +1,53 @@
{
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;
};
};
}