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