artiq-full: replace variants list with readDir of sinara-systems #42

Merged
sb10q merged 1 commits from astro/nix-scripts:target-list into master 2021-02-12 09:32:30 +08:00
1 changed files with 30 additions and 86 deletions
Showing only changes of commit 33c33d49df - Show all commits

View File

@ -2,7 +2,10 @@
let let
sinaraSystemsSrc = <sinaraSystemsSrc>; sinaraSystemsSrc = <sinaraSystemsSrc>;
standaloneVariants = artiqVersion = import <artiq-fast/pkgs/artiq-version.nix> {
Outdated
Review

callPackage should only be used on derivations. Use import.

``callPackage`` should only be used on derivations. Use ``import``.
Outdated
Review

(I know some of the existing code also makes this mistake, we should probably clean it up)

(I know some of the existing code also makes this mistake, we should probably clean it up)
inherit (pkgs) stdenv git fetchgit;
};
variantsJson =
let let
jsonFiles = jsonFiles =
builtins.attrNames ( builtins.attrNames (
@ -11,14 +14,31 @@ let
builtins.match ".+\\.json" name != null builtins.match ".+\\.json" name != null
) (builtins.readDir sinaraSystemsSrc) ) (builtins.readDir sinaraSystemsSrc)
); );
isStandalone = jsonFile:
(builtins.fromJSON (
builtins.readFile (<sinaraSystemsSrc> + "/${jsonFile}")
)).base == "standalone";
in in
map (builtins.replaceStrings [".json"] [""]) ( builtins.listToAttrs (
builtins.filter isStandalone jsonFiles map (jsonFile: {
name = builtins.replaceStrings [".json"] [""] jsonFile;
value = builtins.fromJSON (
builtins.readFile (<sinaraSystemsSrc> + "/${jsonFile}")
);
}) jsonFiles
); );
variants =
builtins.attrNames (
pkgs.lib.filterAttrs (_: json:
pkgs.lib.strings.versionAtLeast artiqVersion (
if json ? min_artiq_version
then json.min_artiq_version
else "0"
)
) variantsJson
);
standaloneVariants =
builtins.attrNames (
pkgs.lib.filterAttrs (_: json:
json.base == "standalone"
) variantsJson
);
generatedNix = pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; } generatedNix = pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; }
'' ''
@ -49,85 +69,9 @@ let
]; ];
target = "kasli"; target = "kasli";
variants = [ variants = [${builtins.concatStringsSep " " (
"berkeley3master" builtins.map (variant: "\"${variant}\"") variants
"femto1" )}];
"femto2"
"femto3"
"freiburg1"
"innsbruck2"
"ist"
"liaf"
"luh2"
"luh3"
"mikes"
"mpq"
"nict"
"no"
"npl1"
"npl2"
"oklahoma"
"olomouc"
"oregon"
"osaka"
"ptb3master"
"ptb4"
"ptb5"
"ptb6"
"ptbal"
"ptbin"
"purpleberry"
"qe"
"qleds"
"saymamaster"
"siegen"
"sydney"
"uaarhus"
"ubirmingham"
"ucsd"
"ugranada"
"unlv"
"ustc2"
"ustc3"
"wipm6"
] ++ (pkgs.lib.lists.optionals (pkgs.lib.strings.versionAtLeast artiq-fast.artiq.version "6.0") [
"apm"
"atomionics"
"basel"
"berkeley3satellite"
"bonn1master"
"bonn1satellite"
"cu"
"cu2"
"cu3"
"hw2master"
"hw2satellite"
"hw3"
"illinois"
"innsbruck3"
"innsbruck4"
"innsbruck5"
"luh"
"nist2"
"nist3"
"nus"
"okinawa"
"ptb3satellite"
"ptb7"
"ptb8"
"purduemaster"
"purduesatellite"
"siom"
"stanford"
"stfcmaster"
"stfcsatellite"
"uamsterdam"
"ubirmingham2"
"ucsb"
"wipm7master"
"wipm7satellite"
"sydney2"
]);
standaloneVariants = [${builtins.concatStringsSep " " ( standaloneVariants = [${builtins.concatStringsSep " " (
builtins.map (variant: "\"${variant}\"") standaloneVariants builtins.map (variant: "\"${variant}\"") standaloneVariants
)}]; )}];