From cd4a8fce8ac9cb0d132b33e965672fca378ea3d3 Mon Sep 17 00:00:00 2001 From: Stephan Maka Date: Wed, 10 Mar 2021 01:11:12 +0100 Subject: [PATCH] flake.nix: refactor for hydraJobs --- flake.nix | 49 ++++++++++++++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 17 deletions(-) diff --git a/flake.nix b/flake.nix index bb056df..2f3de3f 100644 --- a/flake.nix +++ b/flake.nix @@ -30,13 +30,12 @@ "x86_64-linux" ]; forAllSystems = nixpkgs.lib.genAttrs systems; - in rec { - packages = forAllSystems (system: + artiq-jobsets = system: artiqInputName: a6p: let pkgs = nixpkgs.legacyPackages.${system}; - artiq-fast-src = artiqInputName: + artiq-fast-src = let inherit (sources.${artiqInputName}) lastModified rev narHash; hash = builtins.replaceStrings ["sha256-"] [""] narHash; @@ -64,35 +63,51 @@ echo "{ stdenv, git, fetchgit }: \"$MAJOR_VERSION.`cut -c1-8 <<< ${rev}`$SUFFIX\"" > $out/pkgs/artiq-version.nix echo "{ stdenv, git, fetchgit }: \"${toString lastModified}\"" > $out/pkgs/artiq-timestamp.nix ''; - artiq-fast = artiqInputName: - import (artiq-fast-src artiqInputName) { + artiq-fast = + import artiq-fast-src { inherit pkgs; }; - artiq-board-generated = artiqInputName: + artiq-board-generated = (import ./artiq-board-generated { inherit pkgs; sinaraSystemsSrc = null; #sources.sinara-systems.outPath; sinaraSystemsRev = sources.sinara-systems.rev; sinaraSystemsHash = builtins.replaceStrings ["sha256-"] [""] sources.sinara-systems.narHash; - artiq-fast = artiq-fast-src artiqInputName; + artiq-fast = artiq-fast-src; }).generated-nix; - artiq-full = artiqInputName: a6p: + artiq-full = import ./artiq-full.nix { - inherit pkgs; - inherit a6p; - artiq-board-generated = artiq-board-generated artiqInputName; - artiq-fast = artiq-fast-src artiqInputName; + inherit pkgs a6p artiq-board-generated; + artiq-fast = artiq-fast-src; }; - - allPackages = artiqInputName: a6p: - (artiq-fast artiqInputName) // - (artiq-full artiqInputName a6p); - in allPackages "artiq-beta-src" true + in { + inherit artiq-fast artiq-full; + }; + in { + packages = forAllSystems (system: + builtins.foldl' (a: b: a // b) {} ( + builtins.attrValues ( + artiq-jobsets system "artiq-beta-src" true + ) + ) ); defaultPackage = forAllSystems (system: self.packages.${system}.artiq); + + hydraJobs = + let + jobset = artiqInputName: a6p: name: + forAllSystems (system: (artiq-jobsets system artiqInputName a6p).${name}); + in { + fast = jobset "artiq-src" true "artiq-fast"; + fast-beta = jobset "artiq-beta-src" true "artiq-fast"; + fast-legacy = jobset "artiq-legacy-src" false "artiq-fast"; + full = jobset "artiq-src" true "artiq-full"; + full-beta = jobset "artiq-beta-src" true "artiq-full"; + full-legacy = jobset "artiq-legacy-src" false "artiq-full"; + }; }; }