You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

artiq-full.nix 5.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. { pkgs ? import <nixpkgs> {}}:
  2. let
  3. sinaraSystemsSrc = <sinaraSystemsSrc>;
  4. generatedNix = pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; }
  5. ''
  6. mkdir $out
  7. cp -a ${<artiq-fast>} $out/fast
  8. cp ${./artiq-full/conda-artiq-board.nix} $out/conda-artiq-board.nix
  9. cp ${./artiq-full/extras.nix} $out/extras.nix
  10. REV=`git --git-dir ${sinaraSystemsSrc}/.git rev-parse HEAD`
  11. SINARA_SRC_CLEAN=`mktemp -d`
  12. cp -a ${sinaraSystemsSrc}/. $SINARA_SRC_CLEAN
  13. chmod -R 755 $SINARA_SRC_CLEAN/.git
  14. chmod 755 $SINARA_SRC_CLEAN
  15. rm -rf $SINARA_SRC_CLEAN/.git
  16. HASH=`nix-hash --type sha256 --base32 $SINARA_SRC_CLEAN`
  17. cat > $out/default.nix << EOF
  18. { pkgs ? import <nixpkgs> {}}:
  19. let
  20. target = "kasli";
  21. variants = [
  22. "berkeley"
  23. "berkeley2"
  24. "duke"
  25. "duke2"
  26. "duke3"
  27. "hub"
  28. "hustmaster"
  29. "hustsatellite"
  30. "indiana"
  31. "innsbruck"
  32. "ist"
  33. "luh"
  34. "mitll"
  35. "mitll2"
  36. "mpik"
  37. "nrc"
  38. "nudt"
  39. "npl1"
  40. "npl2"
  41. "opticlock"
  42. "oregon"
  43. "ptb"
  44. "ptb2"
  45. "ptb3"
  46. "ptb4"
  47. "ptb5"
  48. "ptb6"
  49. "ptbin"
  50. "siegen"
  51. "su"
  52. "sysu"
  53. "tsinghua"
  54. "tsinghua2"
  55. "ubirmingham"
  56. "ucr"
  57. "unsw"
  58. "unsw2"
  59. "ustc"
  60. "vlbaimaster"
  61. "vlbaisatellite"
  62. "wipm"
  63. "wipm2"
  64. "wipm3"
  65. "wipm4"
  66. ];
  67. artiq-fast = import ./fast { inherit pkgs; };
  68. artiq-board = import ./fast/artiq-board.nix { inherit pkgs; };
  69. conda-artiq-board = import ./conda-artiq-board.nix { inherit pkgs; };
  70. src = pkgs.fetchgit {
  71. url = "https://git.m-labs.hk/M-Labs/sinara-systems.git";
  72. rev = "$REV";
  73. sha256 = "$HASH";
  74. };
  75. generic-kasli = pkgs.lib.lists.foldr (variant: start:
  76. let
  77. json = builtins.toPath (src + "/\''${variant}.json");
  78. boardBinaries = artiq-board {
  79. inherit target variant;
  80. buildCommand = "python -m artiq.gateware.targets.kasli_generic \''${json}";
  81. };
  82. in
  83. start // {
  84. "artiq-board-\''${target}-\''${variant}" = boardBinaries;
  85. "conda-artiq-board-\''${target}-\''${variant}" = conda-artiq-board {
  86. boardBinaries = boardBinaries;
  87. inherit target variant;
  88. };
  89. } // (pkgs.lib.optionalAttrs ((builtins.fromJSON (builtins.readFile json)).base == "standalone") {
  90. "device-db-\''${target}-\''${variant}" = pkgs.stdenv.mkDerivation {
  91. name = "device-db-\''${target}-\''${variant}";
  92. buildInputs = [ artiq-fast.artiq ];
  93. phases = [ "buildPhase" ];
  94. buildPhase = "
  95. mkdir \$out
  96. artiq_ddb_template \''${json} -o \$out/device_db.py
  97. mkdir \$out/nix-support
  98. echo file device_db_template \$out/device_db.py >> \$out/nix-support/hydra-build-products
  99. ";
  100. };
  101. })) {} variants;
  102. extras = import ./extras.nix { inherit pkgs; inherit (artiq-fast) asyncserial artiq; };
  103. in
  104. artiq-fast // extras // generic-kasli // rec {
  105. artiq-board-sayma-satellite = artiq-board {
  106. target = "sayma";
  107. variant = "satellite";
  108. buildCommand = "python -m artiq.gateware.targets.sayma_rtm && python -m artiq.gateware.targets.sayma_amc -V satellite";
  109. extraInstallCommands = "cp artiq_sayma/rtm_gateware/rtm.bit \$TARGET_DIR";
  110. };
  111. artiq-board-metlino-master = artiq-board {
  112. target = "metlino";
  113. variant = "master";
  114. buildCommand = "python -m artiq.gateware.targets.metlino";
  115. };
  116. artiq-board-kc705-nist_qc2 = artiq-board {
  117. target = "kc705";
  118. variant = "nist_qc2";
  119. };
  120. conda-artiq-board-kc705-nist_clock = conda-artiq-board {
  121. target = "kc705";
  122. variant = "nist_clock";
  123. boardBinaries = artiq-fast.artiq-board-kc705-nist_clock;
  124. };
  125. conda-artiq-board-kc705-nist_qc2 = conda-artiq-board {
  126. target = "kc705";
  127. variant = "nist_qc2";
  128. boardBinaries = artiq-board-kc705-nist_qc2;
  129. };
  130. }
  131. EOF
  132. '';
  133. pythonDeps = import ./artiq-full/python-deps.nix { inherit pkgs; };
  134. manualPackages = import ./artiq-full/manual.nix {
  135. inherit (pkgs) stdenv lib fetchgit git python3Packages texlive texinfo;
  136. inherit (pythonDeps) sphinxcontrib-wavedrom;
  137. };
  138. jobs = (import generatedNix { inherit pkgs; }) // manualPackages // {
  139. # This is in the example in the ARTIQ manual - precompile it to speed up
  140. # installation for users.
  141. matplotlib-qt = pkgs.lib.hydraJob (pkgs.python3Packages.matplotlib.override { enableQt = true; });
  142. # For Raspberry Pi JTAG servers
  143. openocd-aarch64 = pkgs.lib.hydraJob ((import <nixpkgs> { system = "aarch64-linux"; }).callPackage ./artiq-fast/pkgs/openocd.nix {});
  144. };
  145. in
  146. builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) jobs // {
  147. artiq-full = pkgs.releaseTools.channel {
  148. name = "artiq-full";
  149. src = generatedNix;
  150. constituents = builtins.attrValues jobs;
  151. };
  152. conda-channel = import ./artiq-full/conda-channel.nix { inherit pkgs; } { inherit jobs; };
  153. }