artiq-full.nix: use sinaraSystemsSrc just as build input #40
@ -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;
|
||||||
@ -221,7 +241,7 @@ let
|
|||||||
buildPhase = "
|
buildPhase = "
|
||||||
mkdir \$out
|
mkdir \$out
|
||||||
artiq_ddb_template \
|
artiq_ddb_template \
|
||||||
\''${pkgs.lib.strings.concatStringsSep " " (pkgs.lib.attrsets.mapAttrsToList (dest: desc: "-s " + dest + " " + src + "/" + desc + ".json") crates.satellites) } \
|
\''${pkgs.lib.strings.concatStringsSep " " (pkgs.lib.attrsets.mapAttrsToList (dest: desc: "-s " + dest + " " + (src + "/\''${desc}.json")) crates.satellites) } \
|
||||||
\''${src}/\''${crates.master}.json -o \$out/device_db.py
|
\''${src}/\''${crates.master}.json -o \$out/device_db.py
|
||||||
mkdir \$out/nix-support
|
mkdir \$out/nix-support
|
||||||
echo file device_db_template \$out/device_db.py >> \$out/nix-support/hydra-build-products
|
echo file device_db_template \$out/device_db.py >> \$out/nix-support/hydra-build-products
|
||||||
|
Loading…
Reference in New Issue
Block a user