1
0
Fork 0
nix-scripts/artiq-full.nix

139 lines
4.8 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
2019-07-17 22:36:44 +08:00
cp ${./artiq-full/conda-artiq-board.nix} $out/conda-artiq-board.nix
2019-07-17 20:22:13 +08:00
cp ${./artiq-full/extras.nix} $out/extras.nix
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-02-16 00:24:20 +08:00
target = "kasli";
variants = [
"berkeley"
"berkeley2"
"duke"
"duke2"
2019-07-17 14:00:09 +08:00
"duke3"
"hub"
"hustmaster"
"hustsatellite"
"ist"
"luh"
"mitll"
"mitll2"
"mpik"
"nrc"
"nudt"
"ptb"
"ptb2"
"ptb3"
"su"
"sysu"
"tsinghua"
"tsinghua2"
"ubirmingham"
"ucr"
"unsw"
"unsw2"
"ustc"
"vlbaimaster"
"vlbaisatellite"
"wipm"
"wipm2"
"wipm3"
];
2019-02-16 00:24:20 +08:00
2019-07-17 19:35:29 +08:00
artiq-fast = import ./fast { inherit pkgs; };
artiq-board = import ./fast/artiq-board.nix { inherit pkgs; };
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;
buildCommand = "python -m artiq.gateware.targets.kasli_generic \''${json}";
};
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;
2019-07-17 20:22:13 +08:00
extras = import ./extras.nix { inherit pkgs; inherit (artiq-fast) asyncserial artiq; };
2019-02-19 20:47:44 +08:00
in
2019-07-17 20:22:13 +08:00
artiq-fast // extras // generic-kasli // {
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_rtm && python -m artiq.gateware.targets.sayma_amc -V satellite";
2019-02-20 13:55:01 +08:00
extraInstallCommands = "cp artiq_sayma/rtm_gateware/rtm.bit \$TARGET_DIR";
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-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-02-19 20:47:44 +08:00
}
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-07-17 20:02:06 +08:00
manualPackages = import ./artiq-full/manual.nix {
inherit (pkgs) stdenv lib fetchgit git python3Packages texlive texinfo;
inherit (pythonDeps) sphinxcontrib-wavedrom;
};
2019-07-17 22:48:14 +08:00
jobs = (import generatedNix { inherit pkgs; }) // manualPackages // {
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; });
# For Raspberry Pi JTAG servers
openocd-aarch64 = pkgs.lib.hydraJob ((import <nixpkgs> { system = "aarch64-linux"; }).callPackage ./artiq-fast/pkgs/openocd.nix {});
};
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 = builtins.attrValues jobs;
};
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
}