2021-09-12 18:35:03 +08:00
|
|
|
{ pkgs ? import <nixpkgs> { overlays = [ (import ./artiq-fast/mozilla-overlay.nix) ]; }
|
2021-09-12 18:35:26 +08:00
|
|
|
, use-generated ? <use-generated>
|
2021-01-28 03:06:05 +08:00
|
|
|
}:
|
2019-02-15 23:06:00 +08:00
|
|
|
|
2019-02-15 23:39:57 +08:00
|
|
|
let
|
2021-01-28 03:06:05 +08:00
|
|
|
sinaraSystemsRev = builtins.readFile <artiq-board-generated/sinara-rev.txt>;
|
|
|
|
sinaraSystemsHash = builtins.readFile <artiq-board-generated/sinara-hash.txt>;
|
|
|
|
sinaraSystemsSrc =
|
2021-09-12 18:35:26 +08:00
|
|
|
if use-generated
|
2021-01-28 03:06:05 +08:00
|
|
|
then pkgs.fetchgit {
|
2022-02-14 15:28:48 +08:00
|
|
|
url = "https://git.m-labs.hk/M-Labs/sinara-systems-legacy.git";
|
2021-01-28 03:06:05 +08:00
|
|
|
rev = sinaraSystemsRev;
|
|
|
|
sha256 = sinaraSystemsHash;
|
|
|
|
}
|
|
|
|
else <sinaraSystemsSrc>;
|
|
|
|
artiq-fast =
|
2021-09-12 18:35:26 +08:00
|
|
|
if use-generated
|
2021-01-28 03:06:05 +08:00
|
|
|
then <artiq-board-generated/fast>
|
|
|
|
else <artiq-fast>;
|
|
|
|
artiqVersion = import (artiq-fast + "/pkgs/artiq-version.nix") {
|
2021-02-10 08:46:59 +08:00
|
|
|
inherit (pkgs) stdenv git fetchgit;
|
|
|
|
};
|
2021-01-28 03:06:05 +08:00
|
|
|
targets = import ./artiq-full/artiq-targets.nix {
|
|
|
|
inherit pkgs artiqVersion sinaraSystemsSrc;
|
|
|
|
};
|
|
|
|
kasliVariants = map ({ variant, ... }: variant) (
|
|
|
|
builtins.filter ({ target, ... }: target == "kasli") (
|
|
|
|
builtins.attrValues targets
|
|
|
|
)
|
|
|
|
);
|
|
|
|
standaloneVariants = map ({ variant, ... }: variant) (
|
|
|
|
builtins.filter ({ target, standalone ? false, ... }: target == "kasli" && standalone) (
|
|
|
|
builtins.attrValues targets
|
|
|
|
)
|
|
|
|
);
|
|
|
|
serializedTargets = pkgs.lib.generators.toPretty {} (
|
|
|
|
map (conf:
|
|
|
|
if conf ? buildCommand
|
|
|
|
then conf // {
|
|
|
|
buildCommand = builtins.replaceStrings ["$"] ["\\\\\\$"] conf.buildCommand;
|
|
|
|
}
|
|
|
|
else conf
|
|
|
|
) (builtins.attrValues targets)
|
|
|
|
);
|
2019-02-15 23:39:57 +08:00
|
|
|
|
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
|
|
|
|
2021-09-12 18:35:26 +08:00
|
|
|
${if use-generated
|
2021-01-28 03:06:05 +08:00
|
|
|
then ''
|
|
|
|
cp -a ${<artiq-board-generated>} $out/board-generated
|
|
|
|
ln -s board-generated/fast $out/fast
|
|
|
|
''
|
|
|
|
else "cp -a ${<artiq-fast>} $out/fast"}
|
|
|
|
cp ${./artiq-full}/artiq-board-vivado.nix $out
|
2020-12-22 08:21:43 +08:00
|
|
|
cp ${./artiq-full}/generate-identifier.py $out
|
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
|
|
|
|
2021-09-12 18:35:26 +08:00
|
|
|
${if use-generated
|
2021-01-28 03:06:05 +08:00
|
|
|
then ''
|
|
|
|
REV=${sinaraSystemsRev}
|
|
|
|
HASH=${sinaraSystemsHash}
|
|
|
|
''
|
|
|
|
else ''
|
|
|
|
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
|
2021-09-12 19:00:37 +08:00
|
|
|
{ pkgs ? import <nixpkgs> { overlays = [ (import ./fast/mozilla-overlay.nix) ]; }}:
|
2019-02-15 23:39:57 +08:00
|
|
|
|
2019-02-15 23:50:44 +08:00
|
|
|
let
|
2021-09-12 18:35:26 +08:00
|
|
|
artiq-fast = import ${if use-generated then "./board-generated" else "."}/fast { inherit pkgs; };
|
2021-01-15 16:36:48 +08:00
|
|
|
ddbDeps = [
|
|
|
|
artiq-fast.artiq
|
|
|
|
(pkgs.python3.withPackages (ps: [ ps.jsonschema ]))
|
|
|
|
];
|
2019-12-03 11:46:01 +08:00
|
|
|
|
2021-01-28 03:06:05 +08:00
|
|
|
kasliVariants = [${builtins.concatStringsSep " " (
|
|
|
|
builtins.map (variant: "\"${variant}\"") kasliVariants
|
2021-02-10 08:46:59 +08:00
|
|
|
)}];
|
2021-01-30 06:45:37 +08:00
|
|
|
standaloneVariants = [${builtins.concatStringsSep " " (
|
|
|
|
builtins.map (variant: "\"${variant}\"") standaloneVariants
|
|
|
|
)}];
|
2019-02-16 00:24:20 +08:00
|
|
|
|
2021-09-12 18:35:26 +08:00
|
|
|
vivado = import ${if use-generated then "./board-generated" else "."}/fast/vivado.nix {
|
2021-01-28 03:06:05 +08:00
|
|
|
inherit pkgs;
|
|
|
|
};
|
|
|
|
artiq-board =
|
2021-09-12 18:35:26 +08:00
|
|
|
${if use-generated
|
2021-01-28 03:06:05 +08:00
|
|
|
then ''
|
|
|
|
import ./artiq-board-vivado.nix {
|
|
|
|
inherit pkgs vivado;
|
|
|
|
version = artiq-fast.artiq.version;
|
|
|
|
board-generated = import ./board-generated {
|
|
|
|
inherit pkgs;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
''
|
|
|
|
else ''
|
|
|
|
import ./fast/artiq-board.nix {
|
|
|
|
inherit pkgs vivado;
|
2021-09-12 19:00:37 +08:00
|
|
|
rustPlatform = import ./fast/rust-platform.nix { inherit pkgs; };
|
2021-01-28 03:06:05 +08:00
|
|
|
}
|
|
|
|
''};
|
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 {
|
2022-02-14 15:28:48 +08:00
|
|
|
url = "https://git.m-labs.hk/M-Labs/sinara-systems-legacy.git";
|
2019-02-16 00:24:20 +08:00
|
|
|
rev = "$REV";
|
|
|
|
sha256 = "$HASH";
|
2019-02-15 23:50:44 +08:00
|
|
|
};
|
2021-01-28 03:06:05 +08:00
|
|
|
artiq-targets = pkgs.lib.lists.foldr (conf: start:
|
2019-02-16 00:24:20 +08:00
|
|
|
let
|
2021-01-28 03:06:05 +08:00
|
|
|
inherit (conf) target variant;
|
|
|
|
json = src + "/\''${variant}.json";
|
|
|
|
boardBinaries = artiq-board (conf // {
|
2020-07-13 00:23:45 +08:00
|
|
|
src = json;
|
2021-01-28 03:06:05 +08:00
|
|
|
});
|
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
|
|
|
};
|
2021-01-28 03:06:05 +08:00
|
|
|
} // (pkgs.lib.optionalAttrs (
|
|
|
|
target == "kasli" &&
|
|
|
|
builtins.elem variant standaloneVariants
|
|
|
|
) {
|
2019-02-22 23:46:16 +08:00
|
|
|
"device-db-\''${target}-\''${variant}" = pkgs.stdenv.mkDerivation {
|
|
|
|
name = "device-db-\''${target}-\''${variant}";
|
2021-01-15 16:36:48 +08:00
|
|
|
buildInputs = ddbDeps;
|
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
|
|
|
|
";
|
|
|
|
};
|
2021-01-28 03:06:05 +08:00
|
|
|
})
|
|
|
|
) {} ${serializedTargets};
|
2019-10-15 11:16:11 +08:00
|
|
|
drtio-systems = {
|
2021-09-12 18:35:26 +08:00
|
|
|
${pkgs.lib.optionalString use-generated ''
|
2021-04-07 13:54:04 +08:00
|
|
|
ap = {
|
|
|
|
master = "apmaster";
|
|
|
|
satellites = {
|
|
|
|
"1" = "apsatellite1";
|
|
|
|
"2" = "apsatellite2";
|
|
|
|
};
|
|
|
|
};
|
2021-01-28 03:06:05 +08:00
|
|
|
berkeley3 = {
|
|
|
|
master = "berkeley3master";
|
|
|
|
satellites = {
|
|
|
|
"1" = "berkeley3satellite";
|
|
|
|
};
|
2020-12-28 16:05:03 +08:00
|
|
|
};
|
2022-06-16 22:45:11 +08:00
|
|
|
bonn = {
|
|
|
|
master = "bonn2master";
|
|
|
|
satellites = {
|
|
|
|
"1" = "bonn2satellite";
|
|
|
|
};
|
|
|
|
};
|
2021-11-09 18:38:04 +08:00
|
|
|
npl3 = {
|
|
|
|
master = "npl3master";
|
|
|
|
satellites = {
|
|
|
|
"1" = "npl3satellite";
|
|
|
|
};
|
|
|
|
};
|
2021-10-25 22:16:05 +08:00
|
|
|
npl5 = {
|
|
|
|
master = "npl5master";
|
|
|
|
satellites = {
|
|
|
|
"1" = "npl5satellite";
|
|
|
|
};
|
|
|
|
};
|
2021-01-28 03:06:05 +08:00
|
|
|
ptb3 = {
|
|
|
|
master = "ptb3master";
|
|
|
|
satellites = {
|
|
|
|
"1" = "ptb3satellite";
|
|
|
|
};
|
2020-11-16 16:42:32 +08:00
|
|
|
};
|
2021-11-17 02:56:52 +08:00
|
|
|
roa1 = {
|
|
|
|
master = "roa1master";
|
|
|
|
satellites = {
|
|
|
|
"1" = "roa1satellite";
|
|
|
|
};
|
|
|
|
};
|
2021-10-13 17:13:49 +08:00
|
|
|
sias = {
|
|
|
|
master = "siasmaster";
|
|
|
|
satellites = {
|
|
|
|
"1" = "siassatellite";
|
2021-01-28 03:06:05 +08:00
|
|
|
};
|
2020-07-23 17:01:13 +08:00
|
|
|
};
|
2021-01-28 03:06:05 +08:00
|
|
|
stfc = {
|
|
|
|
master = "stfcmaster";
|
|
|
|
satellites = {
|
|
|
|
"1" = "stfcsatellite";
|
|
|
|
};
|
2021-01-15 13:05:22 +08:00
|
|
|
};
|
2021-05-21 11:43:41 +08:00
|
|
|
ubirmingham3 = {
|
|
|
|
master = "ubirmingham3master";
|
|
|
|
satellites = {
|
|
|
|
"1" = "ubirmingham3satellite";
|
|
|
|
};
|
|
|
|
};
|
2021-09-14 17:08:06 +08:00
|
|
|
ustc5 = {
|
|
|
|
master = "ustc5master";
|
|
|
|
satellites = {
|
|
|
|
"1" = "ustc5satellite";
|
|
|
|
};
|
|
|
|
};
|
2021-01-28 03:06:05 +08:00
|
|
|
''}
|
|
|
|
};
|
2019-10-15 11:16:11 +08:00
|
|
|
drtio-ddbs = pkgs.lib.attrsets.mapAttrs'
|
|
|
|
(system: crates: pkgs.lib.attrsets.nameValuePair ("device-db-" + system)
|
|
|
|
(pkgs.stdenv.mkDerivation {
|
|
|
|
name = "device-db-\''${system}";
|
2021-01-15 16:36:48 +08:00
|
|
|
buildInputs = ddbDeps;
|
2019-10-15 11:16:11 +08:00
|
|
|
phases = [ "buildPhase" ];
|
|
|
|
buildPhase = "
|
|
|
|
mkdir \$out
|
|
|
|
artiq_ddb_template \
|
2021-02-02 10:57:38 +08:00
|
|
|
\''${pkgs.lib.strings.concatStringsSep " " (pkgs.lib.attrsets.mapAttrsToList (dest: desc: "-s " + dest + " " + (src + "/\''${desc}.json")) crates.satellites) } \
|
2019-10-15 11:16:11 +08:00
|
|
|
\''${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;
|
2021-08-12 13:00:19 +08:00
|
|
|
extras = import ./extras.nix { inherit pkgs; inherit (artiq-fast) sipyco asyncserial artiq; };
|
2019-02-19 20:47:44 +08:00
|
|
|
in
|
2021-01-28 03:06:05 +08:00
|
|
|
artiq-fast // artiq-targets // drtio-ddbs // extras // rec {
|
2020-05-26 17:00:25 +08:00
|
|
|
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;
|
|
|
|
};
|
2021-01-28 03:06:05 +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-11-12 10:43:50 +08:00
|
|
|
sipycoManualPackages = import ./artiq-full/sipyco-manual.nix {
|
|
|
|
inherit (pkgs) stdenv lib python3Packages texlive texinfo;
|
2021-01-28 03:06:05 +08:00
|
|
|
inherit (import artiq-fast { inherit pkgs; }) sipyco;
|
2019-11-12 10:43:50 +08:00
|
|
|
};
|
|
|
|
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;
|
2021-01-28 03:06:05 +08:00
|
|
|
inherit artiq-fast;
|
2019-07-17 20:02:06 +08:00
|
|
|
};
|
2021-01-15 17:23:19 +08:00
|
|
|
artiq-full = import generatedNix { inherit pkgs; };
|
|
|
|
exampleUserEnv = import ./artiq-full/example-user-env.nix { inherit pkgs artiq-full; };
|
|
|
|
jobs = artiq-full // sipycoManualPackages // artiqManualPackages // exampleUserEnv;
|
2019-02-15 23:39:57 +08:00
|
|
|
in
|
2019-07-17 22:48:14 +08:00
|
|
|
builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) jobs // {
|
2019-07-17 20:03:36 +08:00
|
|
|
artiq-full = pkgs.releaseTools.channel {
|
|
|
|
name = "artiq-full";
|
2019-02-16 00:24:20 +08:00
|
|
|
src = generatedNix;
|
2020-07-02 20:34:06 +08:00
|
|
|
constituents = [];
|
2019-02-16 00:24:20 +08:00
|
|
|
};
|
2021-02-15 21:18:25 +08:00
|
|
|
conda-channel = import ./artiq-full/conda-channel.nix { inherit pkgs artiq-fast; } { inherit jobs; };
|
2019-02-16 00:24:20 +08:00
|
|
|
}
|