110 lines
3.4 KiB
Nix
110 lines
3.4 KiB
Nix
# let
|
|
# system = "x86_64-linux";
|
|
# in
|
|
{
|
|
description = "ARTIQ";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:nixos/nixpkgs/release-20.09";
|
|
artiq-beta-src = {
|
|
url = "github:M-Labs/artiq";
|
|
flake = false;
|
|
};
|
|
artiq-src = {
|
|
url = "github:M-Labs/artiq/release-6";
|
|
flake = false;
|
|
};
|
|
artiq-legacy-src = {
|
|
url = "github:M-Labs/artiq/release-5";
|
|
flake = false;
|
|
};
|
|
sinara-systems = {
|
|
url = "git+https://git.m-labs.hk/M-Labs/sinara-systems.git";
|
|
flake = false;
|
|
};
|
|
};
|
|
|
|
outputs = sources@{ self, nixpkgs, ... }:
|
|
let
|
|
systems = [
|
|
"x86_64-linux"
|
|
];
|
|
forAllSystems = f:
|
|
builtins.foldl' (systems: system:
|
|
systems // { ${system} = f system; }
|
|
) {} systems;
|
|
in rec {
|
|
|
|
packages = forAllSystems (system:
|
|
let
|
|
pkgs = nixpkgs.legacyPackages.${system};
|
|
|
|
artiq-fast-src = artiqInputName:
|
|
let
|
|
inherit (sources.${artiqInputName}) lastModified rev 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.`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) {
|
|
inherit pkgs;
|
|
};
|
|
|
|
artiq-board-generated = artiqInputName:
|
|
(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;
|
|
}).generated-nix;
|
|
|
|
artiq-full = artiqInputName: a6p:
|
|
import ./artiq-full.nix {
|
|
inherit pkgs;
|
|
inherit a6p;
|
|
artiq-board-generated = artiq-board-generated artiqInputName;
|
|
sinaraSystemsSrc = sources.sinara-systems.outPath;
|
|
artiq-fast = artiq-fast-src artiqInputName;
|
|
};
|
|
|
|
excluded = [
|
|
# "windows-no-hardware-tests"
|
|
# "extended-tests"
|
|
];
|
|
|
|
allPackages = artiqInputName: a6p:
|
|
nixpkgs.lib.filterAttrs (name: _: !builtins.elem name excluded) (
|
|
(artiq-fast artiqInputName) //
|
|
(artiq-full artiqInputName a6p)
|
|
);
|
|
in allPackages "artiq-beta-src" true
|
|
);
|
|
|
|
defaultPackage = forAllSystems (system: self.packages.${system}.artiq);
|
|
};
|
|
}
|