nix/artiq-board: cleanup

This commit is contained in:
Sebastien Bourdeauducq 2019-02-09 11:06:44 +08:00
parent 07ac42505b
commit 7584639acd
1 changed files with 19 additions and 20 deletions

View File

@ -1,25 +1,24 @@
{ pkgs ? import <nixpkgs> {}}:
let let
pkgs = import <nixpkgs> {}; artiqPkgs = import ./default.nix { inherit pkgs; };
fetchcargo = import <nixpkgs/pkgs/build-support/rust/fetchcargo.nix> { fetchcargo = import ./fetchcargo.nix {
inherit (pkgs) stdenv cacert git rust cargo-vendor; inherit (pkgs) stdenv cacert git cargo cargo-vendor;
}; };
myVendoredSrcFetchCargo = fetchcargo rec { cargoDeps = fetchcargo rec {
name = "myVendoredSrcFetchCargo"; name = "artiq-firmware-cargo-deps";
sourceRoot = null;
srcs = null;
src = ../artiq/firmware; src = ../artiq/firmware;
cargoUpdateHook = "";
patches = [];
sha256 = "1xzjn9i4rkd9124v2gbdplsgsvp1hlx7czdgc58n316vsnrkbr86"; sha256 = "1xzjn9i4rkd9124v2gbdplsgsvp1hlx7czdgc58n316vsnrkbr86";
}; };
myVendoredSrc = pkgs.stdenv.mkDerivation { cargoVendored = pkgs.stdenv.mkDerivation {
name = "myVendoredSrc"; name = "artiq-firmware-cargo-vendored";
src = myVendoredSrcFetchCargo; src = cargoDeps;
phases = [ "unpackPhase" "installPhase" ]; phases = [ "unpackPhase" "installPhase" ];
installPhase = '' installPhase =
mkdir -p $out/.cargo/registry ''
cat > $out/.cargo/config << EOF mkdir -p $out/registry
cat > $out/config <<-EOF
[source.crates-io] [source.crates-io]
registry = "https://github.com/rust-lang/crates.io-index" registry = "https://github.com/rust-lang/crates.io-index"
replace-with = "vendored-sources" replace-with = "vendored-sources"
@ -30,9 +29,9 @@ let
replace-with = "vendored-sources" replace-with = "vendored-sources"
[source.vendored-sources] [source.vendored-sources]
directory = "$out/.cargo/registry" directory = "$out/registry"
EOF EOF
cp -R * $out/.cargo/registry cp -R * $out/registry
''; '';
}; };
@ -44,7 +43,7 @@ in pkgs.stdenv.mkDerivation {
phases = [ "buildPhase" "installPhase" ]; phases = [ "buildPhase" "installPhase" ];
buildPhase = buildPhase =
'' ''
${buildenv}/bin/artiq-dev -c "HOME=${myVendoredSrc} python -m artiq.gateware.targets.kasli -V satellite --no-compile-gateware" ${buildenv}/bin/artiq-dev -c "CARGO_HOME=${cargoVendored} python -m artiq.gateware.targets.kasli -V satellite --no-compile-gateware"
''; '';
installPhase = installPhase =
'' ''