nix-scripts/main.nix

55 lines
1.7 KiB
Nix
Raw Normal View History

{ pkgs ? import <nixpkgs> {}}:
let
2019-02-14 20:16:56 +08:00
artiqSrc = <artiqSrc>;
2019-02-14 19:31:46 +08:00
generatedNix = pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; }
''
cp --no-preserve=mode,ownership -R ${./artiq} $out
2019-02-14 19:31:46 +08:00
REV=`git --git-dir ${artiqSrc}/.git rev-parse HEAD`
HASH=`nix-hash --type sha256 --base32 ${artiqSrc}`
cat > $out/pkgs/artiq-src.nix << EOF
{ fetchgit }:
fetchgit {
url = "git://github.com/m-labs/artiq.git";
rev = "$REV";
sha256 = "$HASH";
leaveDotGit = true;
}
EOF
'';
artiqPkgs = import "${generatedNix}/default.nix" { inherit pkgs; };
boards = [
{ target = "kasli"; variant = "tester"; }
{ target = "kc705"; variant = "nist_clock"; }
];
boardJobs = pkgs.lib.lists.foldr (board: start:
let
boardBinaries = import "${generatedNix}/artiq-board.nix" { inherit pkgs; } {
target = board.target;
variant = board.variant;
};
in
start // {
"artiq-board-${board.target}-${board.variant}" = boardBinaries;
2019-02-15 17:25:57 +08:00
"conda-artiq-board-${board.target}-${board.variant}" = import "${generatedNix}/conda-artiq-board.nix" { inherit pkgs; } {
artiqSrc = import "${generatedNix}/pkgs/artiq-src.nix" { fetchgit = pkgs.fetchgit; };
boardBinaries = boardBinaries;
target = board.target;
variant = board.variant;
};
}) {} boards;
jobs = {
2019-02-15 17:23:54 +08:00
conda-artiq = import "${generatedNix}/conda-artiq.nix" { inherit pkgs; } {
artiqSrc = import "${generatedNix}/pkgs/artiq-src.nix" { fetchgit = pkgs.fetchgit; };
};
} // boardJobs // artiqPkgs;
in
jobs // {
channel = pkgs.releaseTools.channel {
name = "main";
src = generatedNix;
constituents = builtins.attrValues jobs;
};
}