back to using fetchgit for artiq-src

This commit is contained in:
Sebastien Bourdeauducq 2019-02-14 19:31:46 +08:00
parent 62b80bfe82
commit 23c61f3d95
3 changed files with 18 additions and 7 deletions

View File

@ -9,7 +9,7 @@ let
fetchcargo = import ./fetchcargo.nix { fetchcargo = import ./fetchcargo.nix {
inherit (pkgs) stdenv cacert git cargo cargo-vendor; inherit (pkgs) stdenv cacert git cargo cargo-vendor;
}; };
artiqSrc = import ./pkgs/artiq-src.nix; artiqSrc = import ./pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; };
cargoDeps = fetchcargo rec { cargoDeps = fetchcargo rec {
name = "artiq-firmware-cargo-deps"; name = "artiq-firmware-cargo-deps";
src = "${artiqSrc}/artiq/firmware"; src = "${artiqSrc}/artiq/firmware";

View File

@ -1,4 +1,4 @@
{ stdenv, git, fetchFromGitHub, python3Packages, qt5Full, binutils-or1k, llvm-or1k, llvmlite, python3 }: { stdenv, git, fetchFromGitHub, fetchgit, python3Packages, qt5Full, binutils-or1k, llvm-or1k, llvmlite, python3 }:
let let
@ -65,7 +65,7 @@ in
python3Packages.buildPythonPackage rec { python3Packages.buildPythonPackage rec {
name = "artiq"; name = "artiq";
src = import ./artiq-src.nix; src = import ./artiq-src.nix { inherit fetchgit; };
buildInputs = [ git ]; buildInputs = [ git ];
propagatedBuildInputs = with python3Packages; [ binutils-or1k llvm-or1k llvmlite levenshtein pyqtgraph-qt5 aiohttp pygit2 pythonparser numpy dateutil quamash scipy prettytable pyserial asyncserial h5py cython regex qt5Full pyqt5 ]; propagatedBuildInputs = with python3Packages; [ binutils-or1k llvm-or1k llvmlite levenshtein pyqtgraph-qt5 aiohttp pygit2 pythonparser numpy dateutil quamash scipy prettytable pyserial asyncserial h5py cython regex qt5Full pyqt5 ];
checkPhase = "python -m unittest discover -v artiq.test"; checkPhase = "python -m unittest discover -v artiq.test";

View File

@ -1,10 +1,21 @@
{ pkgs ? import <nixpkgs> {}}: { pkgs ? import <nixpkgs> {}}:
let let
artiqSrc = builtins.toString <artiqSrc>; artiqSrc = builtins.toString <artiqSrc>;
generatedNix = pkgs.runCommand "generated-nix" { } generatedNix = pkgs.runCommand "generated-nix" { buildInputs = [ pkgs.nix pkgs.git ]; }
'' ''
cp --no-preserve=mode,ownership -R ${./artiq} $out cp --no-preserve=mode,ownership -R ${./artiq} $out
echo ${artiqSrc} > $out/pkgs/artiq-src.nix 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";
deepClone = true;
leaveDotGit = true;
}
EOF
''; '';
artiqPkgs = import "${generatedNix}/default.nix" { inherit pkgs; }; artiqPkgs = import "${generatedNix}/default.nix" { inherit pkgs; };
@ -22,7 +33,7 @@ let
start // { start // {
"artiq-board-${board.target}-${board.variant}" = boardBinaries; "artiq-board-${board.target}-${board.variant}" = boardBinaries;
"conda-artiq-board-${board.target}-${board.variant}" = import "${generatedNix}/conda-board.nix" { inherit pkgs; } { "conda-artiq-board-${board.target}-${board.variant}" = import "${generatedNix}/conda-board.nix" { inherit pkgs; } {
artiqSrc = import "${generatedNix}/pkgs/artiq-src.nix"; artiqSrc = import "${generatedNix}/pkgs/artiq-src.nix" { fetchgit = pkgs.fetchgit; };
boardBinaries = boardBinaries; boardBinaries = boardBinaries;
target = board.target; target = board.target;
variant = board.variant; variant = board.variant;
@ -32,7 +43,7 @@ let
jobs = { jobs = {
conda-artiq = import "${generatedNix}/conda-build.nix" { inherit pkgs; } { conda-artiq = import "${generatedNix}/conda-build.nix" { inherit pkgs; } {
name = "conda-artiq"; name = "conda-artiq";
src = import "${generatedNix}/pkgs/artiq-src.nix"; src = import "${generatedNix}/pkgs/artiq-src.nix" { fetchgit = pkgs.fetchgit; };
recipe = "conda/artiq"; recipe = "conda/artiq";
}; };
} // boardJobs // artiqPkgs; } // boardJobs // artiqPkgs;