# let # system = "x86_64-linux"; # in { description = "ARTIQ"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/release-20.09"; artiq-beta-src = { url = "git+https://github.com/M-Labs/artiq.git"; flake = false; }; artiq-src = { url = "git+https://github.com/M-Labs/artiq.git?ref=release-6"; flake = false; }; artiq-legacy-src = { url = "git+https://github.com/M-Labs/artiq.git?ref=release-5"; flake = false; }; sinara-systems = { url = "git+https://git.m-labs.hk/M-Labs/sinara-systems.git"; flake = false; }; }; outputs = sources@{ self, nixpkgs, sinara-systems, ... }: let systems = [ "x86_64-linux" ]; forAllSystems = nixpkgs.lib.genAttrs systems; sinaraSystemsSrc = sinara-systems.outPath; sinaraSystemsRev = sinara-systems.rev; sinaraSystemsHash = builtins.replaceStrings ["sha256-"] [""] sinara-systems.narHash; artiq-jobsets = system: artiqInputName: a6p: let pkgs = nixpkgs.legacyPackages.${system}; artiq-fast-src = let inherit (sources.${artiqInputName}) lastModified rev revCount narHash; hash = builtins.replaceStrings ["sha256-"] [""] narHash; artiqSrc = sources.${artiqInputName}.outPath; in pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; } '' cp --no-preserve=mode,ownership -R ${./artiq-fast} $out MAJOR_VERSION=`cat ${artiqSrc}/MAJOR_VERSION` if [ -e ${artiqSrc}/BETA ]; then SUFFIX=".beta" else SUFFIX="" fi cat > $out/pkgs/artiq-src.nix << EOF { fetchgit }: fetchgit { url = "git://github.com/m-labs/artiq.git"; rev = "${rev}"; sha256 = "${hash}"; } EOF echo "{ stdenv, git, fetchgit }: \"$MAJOR_VERSION.${toString revCount}.`cut -c1-8 <<< ${rev}`$SUFFIX\"" > $out/pkgs/artiq-version.nix echo "{ stdenv, git, fetchgit }: \"${toString lastModified}\"" > $out/pkgs/artiq-timestamp.nix ''; artiq-fast = import artiq-fast-src { inherit pkgs; }; artiq-board-generated = (import ./artiq-board-generated { inherit pkgs; inherit sinaraSystemsSrc sinaraSystemsRev sinaraSystemsHash; artiq-fast = artiq-fast-src; }).generated-nix; artiq-full = import ./artiq-full.nix { inherit pkgs a6p artiq-board-generated; artiq-fast = artiq-fast-src; inherit sinaraSystemsSrc sinaraSystemsRev sinaraSystemsHash; }; 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"; }; }; }