flake.nix: refactor for hydraJobs

This commit is contained in:
Astro 2021-03-10 01:11:12 +01:00
parent a5e807783a
commit cd4a8fce8a
1 changed files with 32 additions and 17 deletions

View File

@ -30,13 +30,12 @@
"x86_64-linux" "x86_64-linux"
]; ];
forAllSystems = nixpkgs.lib.genAttrs systems; forAllSystems = nixpkgs.lib.genAttrs systems;
in rec {
packages = forAllSystems (system: artiq-jobsets = system: artiqInputName: a6p:
let let
pkgs = nixpkgs.legacyPackages.${system}; pkgs = nixpkgs.legacyPackages.${system};
artiq-fast-src = artiqInputName: artiq-fast-src =
let let
inherit (sources.${artiqInputName}) lastModified rev narHash; inherit (sources.${artiqInputName}) lastModified rev narHash;
hash = builtins.replaceStrings ["sha256-"] [""] 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 }: \"$MAJOR_VERSION.`cut -c1-8 <<< ${rev}`$SUFFIX\"" > $out/pkgs/artiq-version.nix
echo "{ stdenv, git, fetchgit }: \"${toString lastModified}\"" > $out/pkgs/artiq-timestamp.nix echo "{ stdenv, git, fetchgit }: \"${toString lastModified}\"" > $out/pkgs/artiq-timestamp.nix
''; '';
artiq-fast = artiqInputName: artiq-fast =
import (artiq-fast-src artiqInputName) { import artiq-fast-src {
inherit pkgs; inherit pkgs;
}; };
artiq-board-generated = artiqInputName: artiq-board-generated =
(import ./artiq-board-generated { (import ./artiq-board-generated {
inherit pkgs; inherit pkgs;
sinaraSystemsSrc = null; #sources.sinara-systems.outPath; sinaraSystemsSrc = null; #sources.sinara-systems.outPath;
sinaraSystemsRev = sources.sinara-systems.rev; sinaraSystemsRev = sources.sinara-systems.rev;
sinaraSystemsHash = builtins.replaceStrings ["sha256-"] [""] sinaraSystemsHash = builtins.replaceStrings ["sha256-"] [""]
sources.sinara-systems.narHash; sources.sinara-systems.narHash;
artiq-fast = artiq-fast-src artiqInputName; artiq-fast = artiq-fast-src;
}).generated-nix; }).generated-nix;
artiq-full = artiqInputName: a6p: artiq-full =
import ./artiq-full.nix { import ./artiq-full.nix {
inherit pkgs; inherit pkgs a6p artiq-board-generated;
inherit a6p; artiq-fast = artiq-fast-src;
artiq-board-generated = artiq-board-generated artiqInputName;
artiq-fast = artiq-fast-src artiqInputName;
}; };
in {
allPackages = artiqInputName: a6p: inherit artiq-fast artiq-full;
(artiq-fast artiqInputName) // };
(artiq-full artiqInputName a6p); in {
in allPackages "artiq-beta-src" true 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); 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";
};
}; };
} }