artiq-full: move reading standalone flag from sinara-systems to before generatedNix

This commit is contained in:
Astro 2021-01-29 23:45:37 +01:00
parent 3c1a84a07e
commit d149c66d05
1 changed files with 21 additions and 1 deletions

View File

@ -2,6 +2,23 @@
let let
sinaraSystemsSrc = <sinaraSystemsSrc>; sinaraSystemsSrc = <sinaraSystemsSrc>;
standaloneVariants =
let
jsonFiles =
builtins.attrNames (
pkgs.lib.filterAttrs (name: type:
type != "directory" &&
builtins.match ".+\\.json" name != null
) (builtins.readDir sinaraSystemsSrc)
);
isStandalone = jsonFile:
(builtins.fromJSON (
builtins.readFile "${sinaraSystemsSrc}/${jsonFile}"
)).base == "standalone";
in
map (builtins.replaceStrings [".json"] [""]) (
builtins.filter isStandalone jsonFiles
);
generatedNix = pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; } generatedNix = pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; }
'' ''
@ -111,6 +128,9 @@ let
"wipm7master" "wipm7master"
"wipm7satellite" "wipm7satellite"
]); ]);
standaloneVariants = [${builtins.concatStringsSep " " (
builtins.map (variant: "\"${variant}\"") standaloneVariants
)}];
# Splitting the build process into software+gateware does # Splitting the build process into software+gateware does
# not work when artiq embeds compiled firmware into generated # not work when artiq embeds compiled firmware into generated
# Vivado input. # Vivado input.
@ -148,7 +168,7 @@ let
boardBinaries = boardBinaries; boardBinaries = boardBinaries;
inherit target variant; inherit target variant;
}; };
} // (pkgs.lib.optionalAttrs ((builtins.fromJSON (builtins.readFile json)).base == "standalone") { } // (pkgs.lib.optionalAttrs (builtins.elem variant standaloneVariants) {
"device-db-\''${target}-\''${variant}" = pkgs.stdenv.mkDerivation { "device-db-\''${target}-\''${variant}" = pkgs.stdenv.mkDerivation {
name = "device-db-\''${target}-\''${variant}"; name = "device-db-\''${target}-\''${variant}";
buildInputs = ddbDeps; buildInputs = ddbDeps;