1
0
Fork 0
nix-scripts/main.nix

34 lines
1.2 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
2019-02-15 22:34:56 +08:00
echo \"5e.`cut -c1-8 <<< $REV`\" > $out/pkgs/artiq-version.nix
'';
artiqpkgs = import "${generatedNix}/default.nix" { inherit pkgs; };
jobs = builtins.mapAttrs (key: value: pkgs.lib.hydraJob value) artiqpkgs;
in
jobs // {
generated-nix = pkgs.lib.hydraJob generatedNix;
channel = pkgs.releaseTools.channel rec {
name = "main";
src = generatedNix;
constituents = builtins.attrValues jobs;
};
2019-02-17 22:43:20 +08:00
extended-tests = pkgs.runCommand "extended-tests" {
propagatedBuildInputs = [pkgs.python3.withPackages(ps: [artiqpkgs.artiq artiqpkgs.artiq-board-kc705-nist_clock])];
} "cp ${./extended-tests.py} $out;";
}