[WIP] Flakes #45

Closed
astro wants to merge 12 commits from astro/nix-scripts:flakes into master
1 changed files with 10 additions and 169 deletions
Showing only changes of commit 0805a58cd8 - Show all commits

179
flake.nix
View File

@ -23,7 +23,7 @@
flake = false; flake = false;
}; };
}; };
outputs = sources@{ self, nixpkgs, ... }: outputs = sources@{ self, nixpkgs, ... }:
let let
systems = [ systems = [
@ -41,14 +41,11 @@
artiq-fast-src = artiqInputName: artiq-fast-src = artiqInputName:
let let
# locked = (builtins.fromJSON (
# builtins.readFile ./flake.lock
# )).nodes.${artiqInputName}.locked;
inherit (sources.${artiqInputName}) lastModified rev narHash; inherit (sources.${artiqInputName}) lastModified rev narHash;
hash = builtins.replaceStrings ["sha256-"] [""] narHash; hash = builtins.replaceStrings ["sha256-"] [""] narHash;
artiqSrc = sources.${artiqInputName}.outPath; artiqSrc = sources.${artiqInputName}.outPath;
in pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; } '' in pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; } ''
cp --no-preserve=mode,ownership -R ${./artiq-fast} $out cp --no-preserve=mode,ownership -R ${./artiq-fast} $out
@ -93,173 +90,17 @@
sinaraSystemsSrc = sources.sinara-systems.outPath; sinaraSystemsSrc = sources.sinara-systems.outPath;
artiq-fast = artiq-fast-src artiqInputName; artiq-fast = artiq-fast-src artiqInputName;
}; };
# artiq-full1 = artiqInputName: a6p:
# let
# pythonDeps = import ./artiq-full/python-deps.nix { inherit pkgs; };
# ddbDeps = [
# artiq-fast.artiq
# (pkgs.python3.withPackages (ps: [ ps.jsonschema ]))
# ];
# artiqVersion = (artiq-fast artiqInputName).artiq.version;
# targets = import ./artiq-full/artiq-targets.nix { excluded = [
# inherit pkgs artiqVersion; # "windows-no-hardware-tests"
# sinaraSystemsSrc = sources.sinara-systems.outPath; # "extended-tests"
# }; ];
# 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
# )
# );
# vivado = import ./artiq-fast/vivado.nix {
# inherit pkgs;
# };
# artiq-board =
# if a6p
# then
# import ./artiq-full/artiq-board-vivado.nix {
# inherit pkgs vivado;
# version = artiqVersion;
# board-generated = artiq-board-generated artiqInputName;
# }
# else
# import ./artiq-fast/artiq-board.nix {
# inherit pkgs vivado;
# };
# conda-artiq-board = import ./artiq-full/conda-artiq-board.nix {
# inherit pkgs;
# };
# artiq-targets = pkgs.lib.lists.foldr (conf: start:
# let
# inherit (conf) target variant;
# json = sources.sinara-systems.outPath + "/${variant}.json";
# boardBinaries = artiq-board (conf // {
# src = json;
# });
# in
# start // {
# "artiq-board-${target}-${variant}" = boardBinaries;
# "conda-artiq-board-${target}-${variant}" = conda-artiq-board {
# boardBinaries = boardBinaries;
# inherit target variant;
# };
# } // (pkgs.lib.optionalAttrs (
# target == "kasli" &&
# builtins.elem variant standaloneVariants
# ) {
# "device-db-${target}-${variant}" = pkgs.stdenv.mkDerivation {
# name = "device-db-${target}-${variant}";
# buildInputs = ddbDeps;
# 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
# ";
# };
# })
# ) {} (builtins.attrValues targets);
# drtio-systems =
# if a6p then {
# berkeley3 = {
# master = "berkeley3master";
# satellites = {
# "1" = "berkeley3satellite";
# };
# };
# bonn1 = {
# master = "bonn1master";
# satellites = {
# "1" = "bonn1satellite";
# };
# };
# hw2 = {
# master = "hw2master";
# satellites = {
# "1" = "hw2satellite";
# };
# };
# ptb3 = {
# master = "ptb3master";
# satellites = {
# "1" = "ptb3satellite";
# };
# };
# purdue = {
# master = "purduemaster";
# satellites = {
# "1" = "purduesatellite";
# };
# };
# stfc = {
# master = "stfcmaster";
# satellites = {
# "1" = "stfcsatellite";
# };
# };
# wipm7 = {
# master = "wipm7master";
# satellites = {
# "1" = "wipm7satellite";
# };
# };
# }
# else {};
# drtio-ddbs = pkgs.lib.attrsets.mapAttrs'
# (system: crates: pkgs.lib.attrsets.nameValuePair ("device-db-" + system)
# (pkgs.stdenv.mkDerivation {
# name = "device-db-${system}";
# buildInputs = ddbDeps;
# phases = [ "buildPhase" ];
# buildPhase = ''
# mkdir \$out
# artiq_ddb_template \
# ${pkgs.lib.strings.concatStringsSep " " (pkgs.lib.attrsets.mapAttrsToList (dest: desc: "-s " + dest + " " + (sources.sinara-systems.outPath + "/${desc}.json")) crates.satellites) } \
# ${sources.sinara-systems.outPath}/${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;
# extras = import ./artiq-full/extras.nix { inherit pkgs; inherit (artiq-fast artiqInputName) sipyco asyncserial artiq; };
# artiq-full = artiq-targets // drtio-ddbs // extras // rec {
# conda-artiq-board-kasli-tester = conda-artiq-board {
# target = "kasli";
# variant = "tester";
# boardBinaries = artiq-fast.artiq-board-kasli-tester;
# };
# conda-artiq-board-kc705-nist_clock = conda-artiq-board {
# target = "kc705";
# variant = "nist_clock";
# boardBinaries = artiq-fast.artiq-board-kc705-nist_clock;
# };
# };
# sipycoManualPackages = import ./artiq-full/sipyco-manual.nix {
# inherit (pkgs) stdenv lib python3Packages texlive texinfo;
# inherit (import artiq-fast { inherit pkgs; }) sipyco;
# };
# artiqManualPackages = import ./artiq-full/artiq-manual.nix {
# inherit (pkgs) stdenv lib fetchgit git python3Packages texlive texinfo;
# inherit (pythonDeps) sphinxcontrib-wavedrom;
# inherit artiq-fast;
# };
# exampleUserEnv = import ./artiq-full/example-user-env.nix { inherit pkgs artiq-full; };
# jobs = artiq-full // sipycoManualPackages // artiqManualPackages // exampleUserEnv;
# in
# jobs;
allPackages = artiqInputName: a6p: allPackages = artiqInputName: a6p:
(artiq-fast artiqInputName) // nixpkgs.lib.filterAttrs (name: _: !builtins.elem name excluded) (
#(artiq-board-generated artiqInputName); (artiq-fast artiqInputName) //
(artiq-full artiqInputName a6p); (artiq-full artiqInputName a6p)
);
in allPackages "artiq-beta-src" true in allPackages "artiq-beta-src" true
); );