nix-scripts/artiq-full.nix

284 lines
9.0 KiB
Nix
Raw Normal View History

{ pkgs ? import <nixpkgs> {}}:
2019-02-15 23:06:00 +08:00
let
2019-02-16 00:24:20 +08:00
sinaraSystemsSrc = <sinaraSystemsSrc>;
2019-02-16 00:24:20 +08:00
generatedNix = pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; }
''
mkdir $out
2019-07-17 19:35:29 +08:00
cp -a ${<artiq-fast>} $out/fast
2020-11-23 23:23:02 +08:00
cp ${./artiq-full}/conda-artiq-board.nix $out
cp ${./artiq-full}/extras.nix $out
cp ${./artiq-full}/*.patch $out
2019-07-17 19:35:29 +08:00
2019-02-16 00:24:20 +08:00
REV=`git --git-dir ${sinaraSystemsSrc}/.git rev-parse HEAD`
SINARA_SRC_CLEAN=`mktemp -d`
cp -a ${sinaraSystemsSrc}/. $SINARA_SRC_CLEAN
chmod -R 755 $SINARA_SRC_CLEAN/.git
chmod 755 $SINARA_SRC_CLEAN
rm -rf $SINARA_SRC_CLEAN/.git
HASH=`nix-hash --type sha256 --base32 $SINARA_SRC_CLEAN`
2019-02-16 00:24:20 +08:00
cat > $out/default.nix << EOF
{ pkgs ? import <nixpkgs> {}}:
let
2019-12-03 11:46:01 +08:00
artiq-fast = import ./fast { inherit pkgs; };
2019-02-16 00:24:20 +08:00
target = "kasli";
variants = [
"berkeley3"
2020-03-09 02:21:02 +08:00
"femto1"
"femto2"
"femto3"
2019-12-18 01:17:46 +08:00
"freiburg1"
2020-02-09 18:13:43 +08:00
"griffith"
"hub"
2019-11-26 18:58:29 +08:00
"innsbruck2"
2020-05-30 14:10:23 +08:00
"ist"
2020-02-19 14:37:59 +08:00
"liaf"
2020-01-07 01:05:53 +08:00
"luh2"
2020-05-28 22:54:10 +08:00
"luh3"
2020-02-15 00:17:32 +08:00
"mikes"
2020-01-31 17:26:19 +08:00
"mitll3"
2020-02-06 16:59:37 +08:00
"mitll4master"
"mitll4satellite"
"mpik"
2019-09-27 16:39:49 +08:00
"mpq"
2020-01-21 15:46:02 +08:00
"nict"
"nist"
2020-10-12 17:45:44 +08:00
"nist2"
2020-04-04 20:27:04 +08:00
"no"
2019-08-02 17:24:35 +08:00
"npl1"
"npl2"
2020-04-18 18:35:03 +08:00
"oklahoma"
2020-03-16 18:18:09 +08:00
"olomouc"
2019-08-09 01:17:17 +08:00
"opticlock"
2019-09-11 15:55:33 +08:00
"oregon"
2020-05-28 17:20:42 +08:00
"osaka"
"ptb"
2020-11-16 16:42:32 +08:00
"ptb3master"
2019-08-06 00:59:51 +08:00
"ptb4"
2019-08-06 23:34:30 +08:00
"ptb5"
2019-09-11 01:40:26 +08:00
"ptb6"
2019-10-23 19:21:37 +08:00
"ptbal"
"ptbin"
2020-07-10 18:42:31 +08:00
"purpleberry"
2020-04-01 21:52:13 +08:00
"qe"
2020-07-02 22:34:15 +08:00
"qleds"
2020-01-23 19:34:43 +08:00
"rice"
2019-10-04 21:20:13 +08:00
"saymamaster"
2019-08-06 00:59:51 +08:00
"siegen"
2020-06-08 18:46:02 +08:00
"sydney"
2020-05-19 23:15:39 +08:00
"uaarhus"
"ubirmingham"
2020-09-18 10:05:27 +08:00
"ucsd"
2020-05-19 23:15:39 +08:00
"ugranada"
2020-03-05 14:09:54 +08:00
"unlv"
2020-03-19 17:32:40 +08:00
"ustc2"
2020-10-14 11:57:34 +08:00
"ustc3"
"vlbaimaster"
"vlbaisatellite"
"wipm"
2020-10-22 17:35:21 +08:00
"wipm6"
2019-12-04 19:37:24 +08:00
] ++ (pkgs.lib.lists.optionals (pkgs.lib.strings.versionAtLeast artiq-fast.artiq.version "6.0") [
2020-11-30 18:25:22 +08:00
"apm"
2020-10-21 18:28:22 +08:00
"atomionics"
2020-12-08 21:24:07 +08:00
"basel"
2019-12-03 11:46:01 +08:00
"bonn1master"
"bonn1satellite"
"hw2master"
"hw2satellite"
2020-11-18 01:55:03 +08:00
"innsbruck3"
2020-11-26 22:56:10 +08:00
"innsbruck4"
2020-08-20 17:21:20 +08:00
"luh"
2020-11-16 16:42:32 +08:00
"ptb3satellite"
2020-11-24 00:10:49 +08:00
"ptb7"
2020-12-02 23:22:35 +08:00
"ptb8"
"purduemaster"
"purduesatellite"
2020-10-15 15:12:00 +08:00
"siom"
2020-03-11 17:45:07 +08:00
"uamsterdam"
2020-11-26 22:56:10 +08:00
"ubirmingham2"
2019-12-03 11:46:01 +08:00
]);
2019-02-16 00:24:20 +08:00
vivado = import ./fast/vivado.nix { inherit pkgs; };
artiq-board-import =
if pkgs.lib.strings.versionAtLeast artiq-fast.artiq.version "6.0"
then ./fast/artiq-board.nix
else ./fast/artiq-board-legacy.nix;
artiq-board = import artiq-board-import { inherit pkgs vivado; };
2019-07-17 22:36:44 +08:00
conda-artiq-board = import ./conda-artiq-board.nix { inherit pkgs; };
2019-02-16 00:24:20 +08:00
src = pkgs.fetchgit {
2019-05-07 15:58:33 +08:00
url = "https://git.m-labs.hk/M-Labs/sinara-systems.git";
2019-02-16 00:24:20 +08:00
rev = "$REV";
sha256 = "$HASH";
};
2019-02-19 20:47:44 +08:00
generic-kasli = pkgs.lib.lists.foldr (variant: start:
2019-02-16 00:24:20 +08:00
let
json = builtins.toPath (src + "/\''${variant}.json");
2019-02-16 00:24:20 +08:00
boardBinaries = artiq-board {
inherit target variant;
src = json;
buildCommand = "python -m artiq.gateware.targets.kasli_generic \$src";
2019-02-16 00:24:20 +08:00
};
in
start // {
"artiq-board-\''${target}-\''${variant}" = boardBinaries;
"conda-artiq-board-\''${target}-\''${variant}" = conda-artiq-board {
boardBinaries = boardBinaries;
inherit target variant;
2019-02-22 23:46:16 +08:00
};
2019-05-09 16:34:31 +08:00
} // (pkgs.lib.optionalAttrs ((builtins.fromJSON (builtins.readFile json)).base == "standalone") {
2019-02-22 23:46:16 +08:00
"device-db-\''${target}-\''${variant}" = pkgs.stdenv.mkDerivation {
name = "device-db-\''${target}-\''${variant}";
buildInputs = [ artiq-fast.artiq ];
2019-02-22 23:46:16 +08:00
phases = [ "buildPhase" ];
buildPhase = "
mkdir \$out
artiq_ddb_template \''${json} -o \$out/device_db.py
mkdir \$out/nix-support
echo file device_db_template \$out/device_db.py >> \$out/nix-support/hydra-build-products
";
};
})) {} variants;
drtio-systems = {
2020-02-06 16:59:37 +08:00
mitll4 = {
master = "mitll4master";
satellites = {
"1" = "mitll4satellite";
};
};
vlbai = {
master = "vlbaimaster";
satellites = {
"1" = "vlbaisatellite";
};
};
2019-12-04 19:37:24 +08:00
} // (pkgs.lib.optionalAttrs (pkgs.lib.strings.versionAtLeast artiq-fast.artiq.version "6.0") {
2019-12-03 11:46:01 +08:00
bonn1 = {
master = "bonn1master";
satellites = {
"1" = "bonn1satellite";
};
};
hw2 = {
master = "hw2master";
satellites = {
"1" = "hw2satellite";
};
};
2020-11-16 16:42:32 +08:00
ptb3 = {
master = "ptb3master";
satellites = {
"1" = "ptb3satellite";
};
};
purdue = {
master = "purduemaster";
satellites = {
"1" = "purduesatellite";
};
};
2019-12-03 11:46:01 +08:00
});
drtio-ddbs = pkgs.lib.attrsets.mapAttrs'
(system: crates: pkgs.lib.attrsets.nameValuePair ("device-db-" + system)
(pkgs.stdenv.mkDerivation {
name = "device-db-\''${system}";
buildInputs = [ artiq-fast.artiq ];
phases = [ "buildPhase" ];
buildPhase = "
mkdir \$out
artiq_ddb_template \
\''${pkgs.lib.strings.concatStringsSep " " (pkgs.lib.attrsets.mapAttrsToList (dest: desc: "-s " + dest + " " + src + "/" + desc + ".json") crates.satellites) } \
\''${src}/\''${crates.master}.json -o \$out/device_db.py
mkdir \$out/nix-support
echo file device_db_template \$out/device_db.py >> \$out/nix-support/hydra-build-products
";
})) drtio-systems;
2019-11-07 19:34:36 +08:00
extras = import ./extras.nix { inherit pkgs; inherit (artiq-fast) sipyco asyncserial artiq; };
2019-02-19 20:47:44 +08:00
in
artiq-fast // generic-kasli // drtio-ddbs // extras // rec {
artiq-board-sayma-rtm = artiq-board {
target = "sayma";
variant = "rtm";
buildCommand = "python -m artiq.gateware.targets.sayma_rtm";
};
2019-02-19 20:47:44 +08:00
artiq-board-sayma-satellite = artiq-board {
target = "sayma";
variant = "satellite";
buildCommand = "python -m artiq.gateware.targets.sayma_amc";
2019-02-19 20:47:44 +08:00
};
2019-05-19 11:44:53 +08:00
artiq-board-metlino-master = artiq-board {
target = "metlino";
variant = "master";
buildCommand = "python -m artiq.gateware.targets.metlino";
};
2019-07-18 09:41:33 +08:00
artiq-board-kc705-nist_qc2 = artiq-board {
target = "kc705";
variant = "nist_qc2";
};
conda-artiq-board-sayma-rtm = conda-artiq-board {
target = "sayma";
variant = "rtm";
boardBinaries = artiq-board-sayma-rtm;
};
conda-artiq-board-sayma-satellite = conda-artiq-board {
target = "sayma";
variant = "satellite";
boardBinaries = artiq-board-sayma-satellite;
};
conda-artiq-board-metlino-master = conda-artiq-board {
target = "metlino";
variant = "master";
boardBinaries = artiq-board-metlino-master;
};
conda-artiq-board-kasli-tester = conda-artiq-board {
target = "kasli";
variant = "tester";
boardBinaries = artiq-fast.artiq-board-kasli-tester;
};
2019-07-17 22:36:44 +08:00
conda-artiq-board-kc705-nist_clock = conda-artiq-board {
target = "kc705";
variant = "nist_clock";
boardBinaries = artiq-fast.artiq-board-kc705-nist_clock;
};
2019-07-18 09:41:33 +08:00
conda-artiq-board-kc705-nist_qc2 = conda-artiq-board {
target = "kc705";
variant = "nist_qc2";
boardBinaries = artiq-board-kc705-nist_qc2;
};
} // (pkgs.lib.optionalAttrs (pkgs.lib.strings.versionAtLeast artiq-fast.artiq.version "6.0") rec {
artiq-board-sayma-satellite-st = artiq-board {
target = "sayma";
variant = "satellite";
buildCommand = "python -m artiq.gateware.targets.sayma_amc --sfp --jdcg-type syncdds";
};
})
2019-02-16 00:24:20 +08:00
EOF
'';
2019-07-17 22:41:43 +08:00
pythonDeps = import ./artiq-full/python-deps.nix { inherit pkgs; };
2019-11-12 10:43:50 +08:00
sipycoManualPackages = import ./artiq-full/sipyco-manual.nix {
inherit (pkgs) stdenv lib python3Packages texlive texinfo;
inherit (import <artiq-fast> { inherit pkgs; }) sipyco;
};
artiqManualPackages = import ./artiq-full/artiq-manual.nix {
2019-07-17 20:02:06 +08:00
inherit (pkgs) stdenv lib fetchgit git python3Packages texlive texinfo;
inherit (pythonDeps) sphinxcontrib-wavedrom;
};
2019-11-12 10:43:50 +08:00
jobs = (import generatedNix { inherit pkgs; }) // sipycoManualPackages // artiqManualPackages // {
2019-07-17 19:21:06 +08:00
# This is in the example in the ARTIQ manual - precompile it to speed up
# installation for users.
matplotlib-qt = pkgs.lib.hydraJob (pkgs.python3Packages.matplotlib.override { enableQt = true; });
};
in
2019-07-17 22:48:14 +08:00
builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) jobs // {
artiq-full = pkgs.releaseTools.channel {
name = "artiq-full";
2019-02-16 00:24:20 +08:00
src = generatedNix;
constituents = [];
2019-02-16 00:24:20 +08:00
};
2019-07-18 00:08:35 +08:00
conda-channel = import ./artiq-full/conda-channel.nix { inherit pkgs; } { inherit jobs; };
2019-02-16 00:24:20 +08:00
}