From 7d740fd4643206ac66a7dc435664793b0c8eff76 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 4 Apr 2020 13:02:18 +0800 Subject: [PATCH] lock cargo and cargo-vendor With nixpkgs 20.03, the provided cargo package can no longer use the old rustc-or1k. --- artiq-fast/artiq-board.nix | 7 +- artiq-fast/default.nix | 4 +- artiq-fast/pkgs/rust/cargo-vendor-carnix.nix | 693 ++++++++++++++++++ artiq-fast/pkgs/rust/cargo-vendor.nix | 10 + artiq-fast/pkgs/rust/cargo.nix | 61 ++ .../{default.nix => rustc-with-crates.nix} | 20 +- artiq-fast/shell-dev.nix | 2 +- 7 files changed, 784 insertions(+), 13 deletions(-) create mode 100644 artiq-fast/pkgs/rust/cargo-vendor-carnix.nix create mode 100644 artiq-fast/pkgs/rust/cargo-vendor.nix create mode 100644 artiq-fast/pkgs/rust/cargo.nix rename artiq-fast/pkgs/rust/{default.nix => rustc-with-crates.nix} (88%) diff --git a/artiq-fast/artiq-board.nix b/artiq-fast/artiq-board.nix index eac5554..f74b0c9 100644 --- a/artiq-fast/artiq-board.nix +++ b/artiq-fast/artiq-board.nix @@ -9,8 +9,10 @@ let artiqSrc = import ./pkgs/artiq-src.nix { fetchgit = pkgs.fetchgit; }; + artiqpkgs = import ./default.nix { inherit pkgs; }; fetchcargo = import ./fetchcargo.nix { - inherit (pkgs) stdenv cacert git cargo cargo-vendor; + inherit (pkgs) stdenv cacert git; + inherit (artiqpkgs) cargo cargo-vendor; }; cargoDeps = fetchcargo rec { name = "artiq-firmware-cargo-deps"; @@ -43,7 +45,6 @@ let }; vivado = import ./vivado.nix { inherit pkgs; }; - artiqpkgs = import ./default.nix { inherit pkgs; }; # Board packages are Python modules so that they get added to the ARTIQ Python # environment, and artiq_flash finds them. @@ -55,7 +56,7 @@ in pkgs.python3Packages.toPythonModule (pkgs.stdenv.mkDerivation rec { vivado pkgs.gnumake (pkgs.python3.withPackages(ps: with ps; [ jinja2 numpy artiqpkgs.migen artiqpkgs.microscope artiqpkgs.misoc artiqpkgs.jesd204b artiqpkgs.artiq ])) - pkgs.cargo + artiqpkgs.cargo artiqpkgs.rustc artiqpkgs.binutils-or1k artiqpkgs.llvm-or1k diff --git a/artiq-fast/default.nix b/artiq-fast/default.nix index 638baa0..8087e04 100644 --- a/artiq-fast/default.nix +++ b/artiq-fast/default.nix @@ -22,11 +22,13 @@ let binutils-or1k = callPackage ./pkgs/binutils.nix { platform = "or1k"; target = "or1k-linux"; }; binutils-arm = callPackage ./pkgs/binutils.nix { platform = "arm"; target = "armv7-unknown-linux-gnueabihf"; }; llvm-or1k = callPackage ./pkgs/llvm-or1k.nix {}; - rustc = callPackage ./pkgs/rust + rustc = callPackage ./pkgs/rust/rustc-with-crates.nix ((stdenv.lib.optionalAttrs (stdenv.cc.isGNU && stdenv.hostPlatform.isi686) { stdenv = overrideCC stdenv gcc6; # with gcc-7: undefined reference to `__divmoddi4' }) // { inherit llvm-or1k; }); + cargo = callPackage ./pkgs/rust/cargo.nix { inherit rustc; }; + cargo-vendor = callPackage ./pkgs/rust/cargo-vendor.nix {}; llvmlite-artiq = callPackage ./pkgs/llvmlite-artiq.nix { inherit llvm-or1k; }; libartiq-support = callPackage ./pkgs/libartiq-support.nix { inherit rustc; }; artiq = callPackage ./pkgs/artiq.nix { inherit binutils-or1k llvm-or1k llvmlite-artiq libartiq-support lit outputcheck; }; diff --git a/artiq-fast/pkgs/rust/cargo-vendor-carnix.nix b/artiq-fast/pkgs/rust/cargo-vendor-carnix.nix new file mode 100644 index 0000000..9af5cbe --- /dev/null +++ b/artiq-fast/pkgs/rust/cargo-vendor-carnix.nix @@ -0,0 +1,693 @@ +# Generated by carnix 0.10.0: carnix generate-nix --src . +{ lib, buildPlatform, buildRustCrate, buildRustCrateHelpers, cratesIO, fetchgit }: +with buildRustCrateHelpers; +let inherit (lib.lists) fold; + inherit (lib.attrsets) recursiveUpdate; +in +rec { + crates = cratesIO // rec { +# cargo-vendor-0.1.23 + + crates.cargo_vendor."0.1.23" = deps: { features?(features_.cargo_vendor."0.1.23" deps {}) }: buildRustCrate { + crateName = "cargo-vendor"; + version = "0.1.23"; + description = "A Cargo subcommand to vendor all crates.io dependencies onto the local\nfilesystem.\n"; + authors = [ "Alex Crichton " ]; + edition = "2018"; + src = exclude [ ".git" "target" ] ./.; + dependencies = mapFeatures features ([ + (cratesIO.crates."cargo"."${deps."cargo_vendor"."0.1.23"."cargo"}" deps) + (cratesIO.crates."docopt"."${deps."cargo_vendor"."0.1.23"."docopt"}" deps) + (cratesIO.crates."env_logger"."${deps."cargo_vendor"."0.1.23"."env_logger"}" deps) + (cratesIO.crates."failure"."${deps."cargo_vendor"."0.1.23"."failure"}" deps) + (cratesIO.crates."serde"."${deps."cargo_vendor"."0.1.23"."serde"}" deps) + (cratesIO.crates."serde_json"."${deps."cargo_vendor"."0.1.23"."serde_json"}" deps) + (cratesIO.crates."toml"."${deps."cargo_vendor"."0.1.23"."toml"}" deps) + ] + ++ (if features.cargo_vendor."0.1.23".openssl or false then [ (cratesIO.crates.openssl."${deps."cargo_vendor"."0.1.23".openssl}" deps) ] else [])); + features = mkFeatures (features."cargo_vendor"."0.1.23" or {}); + }; + features_.cargo_vendor."0.1.23" = deps: f: updateFeatures f (rec { + cargo."${deps.cargo_vendor."0.1.23".cargo}".default = true; + cargo_vendor."0.1.23".default = (f.cargo_vendor."0.1.23".default or true); + docopt."${deps.cargo_vendor."0.1.23".docopt}".default = true; + env_logger."${deps.cargo_vendor."0.1.23".env_logger}".default = true; + failure."${deps.cargo_vendor."0.1.23".failure}".default = true; + openssl = fold recursiveUpdate {} [ + { "${deps.cargo_vendor."0.1.23".openssl}"."vendored" = + (f.openssl."${deps.cargo_vendor."0.1.23".openssl}"."vendored" or false) || + (cargo_vendor."0.1.23"."vendored-openssl" or false) || + (f."cargo_vendor"."0.1.23"."vendored-openssl" or false); } + { "${deps.cargo_vendor."0.1.23".openssl}".default = true; } + ]; + serde = fold recursiveUpdate {} [ + { "${deps.cargo_vendor."0.1.23".serde}"."derive" = true; } + { "${deps.cargo_vendor."0.1.23".serde}".default = true; } + ]; + serde_json."${deps.cargo_vendor."0.1.23".serde_json}".default = true; + toml."${deps.cargo_vendor."0.1.23".toml}".default = true; + }) [ + (cratesIO.features_.cargo."${deps."cargo_vendor"."0.1.23"."cargo"}" deps) + (cratesIO.features_.docopt."${deps."cargo_vendor"."0.1.23"."docopt"}" deps) + (cratesIO.features_.env_logger."${deps."cargo_vendor"."0.1.23"."env_logger"}" deps) + (cratesIO.features_.failure."${deps."cargo_vendor"."0.1.23"."failure"}" deps) + (cratesIO.features_.openssl."${deps."cargo_vendor"."0.1.23"."openssl"}" deps) + (cratesIO.features_.serde."${deps."cargo_vendor"."0.1.23"."serde"}" deps) + (cratesIO.features_.serde_json."${deps."cargo_vendor"."0.1.23"."serde_json"}" deps) + (cratesIO.features_.toml."${deps."cargo_vendor"."0.1.23"."toml"}" deps) + ]; + + +# end + + }; + + cargo_vendor = crates.crates.cargo_vendor."0.1.23" deps; + __all = [ (cargo_vendor {}) ]; + deps.adler32."1.0.3" = {}; + deps.aho_corasick."0.7.3" = { + memchr = "2.2.0"; + }; + deps.ansi_term."0.11.0" = { + winapi = "0.3.7"; + }; + deps.atty."0.2.11" = { + termion = "1.5.1"; + libc = "0.2.51"; + winapi = "0.3.7"; + }; + deps.autocfg."0.1.2" = {}; + deps.backtrace."0.3.15" = { + cfg_if = "0.1.7"; + rustc_demangle = "0.1.14"; + autocfg = "0.1.2"; + backtrace_sys = "0.1.28"; + libc = "0.2.51"; + winapi = "0.3.7"; + }; + deps.backtrace_sys."0.1.28" = { + libc = "0.2.51"; + cc = "1.0.35"; + }; + deps.bitflags."1.0.4" = {}; + deps.bstr."0.1.2" = { + memchr = "2.2.0"; + }; + deps.build_const."0.2.1" = {}; + deps.byteorder."1.3.1" = {}; + deps.bytes."0.4.12" = { + byteorder = "1.3.1"; + iovec = "0.1.2"; + }; + deps.bytesize."1.0.0" = {}; + deps.cargo."0.35.0" = { + atty = "0.2.11"; + byteorder = "1.3.1"; + bytesize = "1.0.0"; + clap = "2.33.0"; + crates_io = "0.23.0"; + crossbeam_utils = "0.6.5"; + crypto_hash = "0.3.3"; + curl = "0.4.21"; + curl_sys = "0.4.18"; + env_logger = "0.6.1"; + failure = "0.1.5"; + filetime = "0.2.4"; + flate2 = "1.0.7"; + fs2 = "0.4.3"; + git2 = "0.8.0"; + git2_curl = "0.9.0"; + glob = "0.2.11"; + hex = "0.3.2"; + home = "0.3.4"; + ignore = "0.4.7"; + im_rc = "12.3.4"; + jobserver = "0.1.13"; + lazy_static = "1.3.0"; + lazycell = "1.2.1"; + libc = "0.2.51"; + libgit2_sys = "0.7.11"; + log = "0.4.6"; + num_cpus = "1.10.0"; + opener = "0.3.2"; + rustc_workspace_hack = "1.0.0"; + rustfix = "0.4.5"; + same_file = "1.0.4"; + semver = "0.9.0"; + serde = "1.0.90"; + serde_ignored = "0.0.4"; + serde_json = "1.0.39"; + shell_escape = "0.1.4"; + tar = "0.4.22"; + tempfile = "3.0.7"; + termcolor = "1.0.4"; + toml = "0.4.10"; + unicode_width = "0.1.5"; + url = "1.7.2"; + url_serde = "0.2.0"; + core_foundation = "0.6.4"; + fwdansi = "1.0.1"; + miow = "0.3.3"; + winapi = "0.3.7"; + }; + deps.cargo_vendor."0.1.23" = { + cargo = "0.35.0"; + docopt = "1.1.0"; + env_logger = "0.6.1"; + failure = "0.1.5"; + openssl = "0.10.20"; + serde = "1.0.90"; + serde_json = "1.0.39"; + toml = "0.5.0"; + }; + deps.cc."1.0.35" = {}; + deps.cfg_if."0.1.7" = {}; + deps.clap."2.33.0" = { + atty = "0.2.11"; + bitflags = "1.0.4"; + strsim = "0.8.0"; + textwrap = "0.11.0"; + unicode_width = "0.1.5"; + vec_map = "0.8.1"; + ansi_term = "0.11.0"; + }; + deps.cloudabi."0.0.3" = { + bitflags = "1.0.4"; + }; + deps.commoncrypto."0.2.0" = { + commoncrypto_sys = "0.2.0"; + }; + deps.commoncrypto_sys."0.2.0" = { + libc = "0.2.51"; + }; + deps.core_foundation."0.6.4" = { + core_foundation_sys = "0.6.2"; + libc = "0.2.51"; + }; + deps.core_foundation_sys."0.6.2" = {}; + deps.crates_io."0.23.0" = { + curl = "0.4.21"; + failure = "0.1.5"; + http = "0.1.17"; + serde = "1.0.90"; + serde_derive = "1.0.90"; + serde_json = "1.0.39"; + url = "1.7.2"; + }; + deps.crc."1.8.1" = { + build_const = "0.2.1"; + }; + deps.crc32fast."1.2.0" = { + cfg_if = "0.1.7"; + }; + deps.crossbeam_channel."0.3.8" = { + crossbeam_utils = "0.6.5"; + smallvec = "0.6.9"; + }; + deps.crossbeam_utils."0.6.5" = { + cfg_if = "0.1.7"; + lazy_static = "1.3.0"; + }; + deps.crypto_hash."0.3.3" = { + hex = "0.3.2"; + commoncrypto = "0.2.0"; + openssl = "0.10.20"; + winapi = "0.3.7"; + }; + deps.curl."0.4.21" = { + curl_sys = "0.4.18"; + libc = "0.2.51"; + socket2 = "0.3.8"; + openssl_probe = "0.1.2"; + openssl_sys = "0.9.43"; + kernel32_sys = "0.2.2"; + schannel = "0.1.15"; + winapi = "0.2.8"; + }; + deps.curl_sys."0.4.18" = { + libc = "0.2.51"; + libnghttp2_sys = "0.1.1"; + libz_sys = "1.0.25"; + cc = "1.0.35"; + pkg_config = "0.3.14"; + openssl_sys = "0.9.43"; + winapi = "0.3.7"; + }; + deps.docopt."1.1.0" = { + lazy_static = "1.3.0"; + regex = "1.1.6"; + serde = "1.0.90"; + strsim = "0.9.1"; + }; + deps.either."1.5.2" = {}; + deps.env_logger."0.6.1" = { + atty = "0.2.11"; + humantime = "1.2.0"; + log = "0.4.6"; + regex = "1.1.6"; + termcolor = "1.0.4"; + }; + deps.failure."0.1.5" = { + backtrace = "0.3.15"; + failure_derive = "0.1.5"; + }; + deps.failure_derive."0.1.5" = { + proc_macro2 = "0.4.27"; + quote = "0.6.12"; + syn = "0.15.32"; + synstructure = "0.10.1"; + }; + deps.filetime."0.2.4" = { + cfg_if = "0.1.7"; + redox_syscall = "0.1.54"; + libc = "0.2.51"; + }; + deps.flate2."1.0.7" = { + crc32fast = "1.2.0"; + libc = "0.2.51"; + libz_sys = "1.0.25"; + miniz_sys = "0.1.11"; + miniz_oxide_c_api = "0.2.1"; + }; + deps.fnv."1.0.6" = {}; + deps.foreign_types."0.3.2" = { + foreign_types_shared = "0.1.1"; + }; + deps.foreign_types_shared."0.1.1" = {}; + deps.fs2."0.4.3" = { + libc = "0.2.51"; + winapi = "0.3.7"; + }; + deps.fuchsia_cprng."0.1.1" = {}; + deps.fwdansi."1.0.1" = { + memchr = "2.2.0"; + termcolor = "1.0.4"; + }; + deps.git2."0.8.0" = { + bitflags = "1.0.4"; + libc = "0.2.51"; + libgit2_sys = "0.7.11"; + log = "0.4.6"; + url = "1.7.2"; + openssl_probe = "0.1.2"; + openssl_sys = "0.9.43"; + }; + deps.git2_curl."0.9.0" = { + curl = "0.4.21"; + git2 = "0.8.0"; + log = "0.4.6"; + url = "1.7.2"; + }; + deps.glob."0.2.11" = {}; + deps.globset."0.4.3" = { + aho_corasick = "0.7.3"; + bstr = "0.1.2"; + fnv = "1.0.6"; + log = "0.4.6"; + regex = "1.1.6"; + }; + deps.hashbrown."0.1.8" = { + byteorder = "1.3.1"; + scopeguard = "0.3.3"; + }; + deps.hex."0.3.2" = {}; + deps.home."0.3.4" = { + scopeguard = "0.3.3"; + winapi = "0.3.7"; + }; + deps.http."0.1.17" = { + bytes = "0.4.12"; + fnv = "1.0.6"; + itoa = "0.4.3"; + }; + deps.humantime."1.2.0" = { + quick_error = "1.2.2"; + }; + deps.idna."0.1.5" = { + matches = "0.1.8"; + unicode_bidi = "0.3.4"; + unicode_normalization = "0.1.8"; + }; + deps.ignore."0.4.7" = { + crossbeam_channel = "0.3.8"; + globset = "0.4.3"; + lazy_static = "1.3.0"; + log = "0.4.6"; + memchr = "2.2.0"; + regex = "1.1.6"; + same_file = "1.0.4"; + thread_local = "0.3.6"; + walkdir = "2.2.7"; + winapi_util = "0.1.2"; + }; + deps.im_rc."12.3.4" = { + sized_chunks = "0.1.3"; + typenum = "1.10.0"; + rustc_version = "0.2.3"; + }; + deps.iovec."0.1.2" = { + libc = "0.2.51"; + winapi = "0.2.8"; + }; + deps.itertools."0.7.11" = { + either = "1.5.2"; + }; + deps.itoa."0.4.3" = {}; + deps.jobserver."0.1.13" = { + log = "0.4.6"; + libc = "0.2.51"; + rand = "0.6.5"; + }; + deps.kernel32_sys."0.2.2" = { + winapi = "0.2.8"; + winapi_build = "0.1.1"; + }; + deps.lazy_static."1.3.0" = {}; + deps.lazycell."1.2.1" = {}; + deps.libc."0.2.51" = {}; + deps.libgit2_sys."0.7.11" = { + curl_sys = "0.4.18"; + libc = "0.2.51"; + libssh2_sys = "0.2.11"; + libz_sys = "1.0.25"; + cc = "1.0.35"; + pkg_config = "0.3.14"; + openssl_sys = "0.9.43"; + }; + deps.libnghttp2_sys."0.1.1" = { + libc = "0.2.51"; + cc = "1.0.35"; + }; + deps.libssh2_sys."0.2.11" = { + libc = "0.2.51"; + libz_sys = "1.0.25"; + cc = "1.0.35"; + pkg_config = "0.3.14"; + openssl_sys = "0.9.43"; + }; + deps.libz_sys."1.0.25" = { + libc = "0.2.51"; + cc = "1.0.35"; + pkg_config = "0.3.14"; + }; + deps.lock_api."0.1.5" = { + scopeguard = "0.3.3"; + }; + deps.log."0.4.6" = { + cfg_if = "0.1.7"; + }; + deps.matches."0.1.8" = {}; + deps.matrixmultiply."0.1.15" = { + rawpointer = "0.1.0"; + }; + deps.memchr."2.2.0" = {}; + deps.miniz_sys."0.1.11" = { + libc = "0.2.51"; + cc = "1.0.35"; + }; + deps.miniz_oxide."0.2.1" = { + adler32 = "1.0.3"; + }; + deps.miniz_oxide_c_api."0.2.1" = { + crc = "1.8.1"; + libc = "0.2.51"; + miniz_oxide = "0.2.1"; + cc = "1.0.35"; + }; + deps.miow."0.3.3" = { + socket2 = "0.3.8"; + winapi = "0.3.7"; + }; + deps.ndarray."0.12.1" = { + itertools = "0.7.11"; + matrixmultiply = "0.1.15"; + num_complex = "0.2.1"; + num_traits = "0.2.6"; + }; + deps.num_complex."0.2.1" = { + num_traits = "0.2.6"; + }; + deps.num_traits."0.2.6" = {}; + deps.num_cpus."1.10.0" = { + libc = "0.2.51"; + }; + deps.once_cell."0.1.8" = { + parking_lot = "0.7.1"; + }; + deps.opener."0.3.2" = { + failure = "0.1.5"; + failure_derive = "0.1.5"; + winapi = "0.3.7"; + }; + deps.openssl."0.10.20" = { + bitflags = "1.0.4"; + cfg_if = "0.1.7"; + foreign_types = "0.3.2"; + lazy_static = "1.3.0"; + libc = "0.2.51"; + openssl_sys = "0.9.43"; + }; + deps.openssl_probe."0.1.2" = {}; + deps.openssl_src."111.2.1+1.1.1b" = { + cc = "1.0.35"; + }; + deps.openssl_sys."0.9.43" = { + libc = "0.2.51"; + cc = "1.0.35"; + openssl_src = "111.2.1+1.1.1b"; + pkg_config = "0.3.14"; + rustc_version = "0.2.3"; + }; + deps.parking_lot."0.7.1" = { + lock_api = "0.1.5"; + parking_lot_core = "0.4.0"; + }; + deps.parking_lot_core."0.4.0" = { + rand = "0.6.5"; + smallvec = "0.6.9"; + rustc_version = "0.2.3"; + libc = "0.2.51"; + winapi = "0.3.7"; + }; + deps.percent_encoding."1.0.1" = {}; + deps.pkg_config."0.3.14" = {}; + deps.proc_macro2."0.4.27" = { + unicode_xid = "0.1.0"; + }; + deps.quick_error."1.2.2" = {}; + deps.quote."0.6.12" = { + proc_macro2 = "0.4.27"; + }; + deps.rand."0.6.5" = { + rand_chacha = "0.1.1"; + rand_core = "0.4.0"; + rand_hc = "0.1.0"; + rand_isaac = "0.1.1"; + rand_jitter = "0.1.3"; + rand_os = "0.1.3"; + rand_pcg = "0.1.2"; + rand_xorshift = "0.1.1"; + autocfg = "0.1.2"; + libc = "0.2.51"; + winapi = "0.3.7"; + }; + deps.rand_chacha."0.1.1" = { + rand_core = "0.3.1"; + autocfg = "0.1.2"; + }; + deps.rand_core."0.3.1" = { + rand_core = "0.4.0"; + }; + deps.rand_core."0.4.0" = {}; + deps.rand_hc."0.1.0" = { + rand_core = "0.3.1"; + }; + deps.rand_isaac."0.1.1" = { + rand_core = "0.3.1"; + }; + deps.rand_jitter."0.1.3" = { + rand_core = "0.4.0"; + libc = "0.2.51"; + winapi = "0.3.7"; + }; + deps.rand_os."0.1.3" = { + rand_core = "0.4.0"; + rdrand = "0.4.0"; + cloudabi = "0.0.3"; + fuchsia_cprng = "0.1.1"; + libc = "0.2.51"; + winapi = "0.3.7"; + }; + deps.rand_pcg."0.1.2" = { + rand_core = "0.4.0"; + autocfg = "0.1.2"; + }; + deps.rand_xorshift."0.1.1" = { + rand_core = "0.3.1"; + }; + deps.rawpointer."0.1.0" = {}; + deps.rdrand."0.4.0" = { + rand_core = "0.3.1"; + }; + deps.redox_syscall."0.1.54" = {}; + deps.redox_termios."0.1.1" = { + redox_syscall = "0.1.54"; + }; + deps.regex."1.1.6" = { + aho_corasick = "0.7.3"; + memchr = "2.2.0"; + regex_syntax = "0.6.6"; + thread_local = "0.3.6"; + utf8_ranges = "1.0.2"; + }; + deps.regex_syntax."0.6.6" = { + ucd_util = "0.1.3"; + }; + deps.remove_dir_all."0.5.1" = { + winapi = "0.3.7"; + }; + deps.rustc_demangle."0.1.14" = {}; + deps.rustc_workspace_hack."1.0.0" = {}; + deps.rustc_version."0.2.3" = { + semver = "0.9.0"; + }; + deps.rustfix."0.4.5" = { + failure = "0.1.5"; + log = "0.4.6"; + serde = "1.0.90"; + serde_derive = "1.0.90"; + serde_json = "1.0.39"; + }; + deps.ryu."0.2.7" = {}; + deps.same_file."1.0.4" = { + winapi_util = "0.1.2"; + }; + deps.schannel."0.1.15" = { + lazy_static = "1.3.0"; + winapi = "0.3.7"; + }; + deps.scopeguard."0.3.3" = {}; + deps.semver."0.9.0" = { + semver_parser = "0.7.0"; + serde = "1.0.90"; + }; + deps.semver_parser."0.7.0" = {}; + deps.serde."1.0.90" = { + serde_derive = "1.0.90"; + }; + deps.serde_derive."1.0.90" = { + proc_macro2 = "0.4.27"; + quote = "0.6.12"; + syn = "0.15.32"; + }; + deps.serde_ignored."0.0.4" = { + serde = "1.0.90"; + }; + deps.serde_json."1.0.39" = { + itoa = "0.4.3"; + ryu = "0.2.7"; + serde = "1.0.90"; + }; + deps.shell_escape."0.1.4" = {}; + deps.sized_chunks."0.1.3" = { + typenum = "1.10.0"; + }; + deps.smallvec."0.6.9" = {}; + deps.socket2."0.3.8" = { + cfg_if = "0.1.7"; + libc = "0.2.51"; + redox_syscall = "0.1.54"; + winapi = "0.3.7"; + }; + deps.strsim."0.8.0" = {}; + deps.strsim."0.9.1" = { + hashbrown = "0.1.8"; + ndarray = "0.12.1"; + }; + deps.syn."0.15.32" = { + proc_macro2 = "0.4.27"; + quote = "0.6.12"; + unicode_xid = "0.1.0"; + }; + deps.synstructure."0.10.1" = { + proc_macro2 = "0.4.27"; + quote = "0.6.12"; + syn = "0.15.32"; + unicode_xid = "0.1.0"; + }; + deps.tar."0.4.22" = { + filetime = "0.2.4"; + redox_syscall = "0.1.54"; + libc = "0.2.51"; + }; + deps.tempfile."3.0.7" = { + cfg_if = "0.1.7"; + rand = "0.6.5"; + remove_dir_all = "0.5.1"; + redox_syscall = "0.1.54"; + libc = "0.2.51"; + winapi = "0.3.7"; + }; + deps.termcolor."1.0.4" = { + wincolor = "1.0.1"; + }; + deps.termion."1.5.1" = { + libc = "0.2.51"; + redox_syscall = "0.1.54"; + redox_termios = "0.1.1"; + }; + deps.textwrap."0.11.0" = { + unicode_width = "0.1.5"; + }; + deps.thread_local."0.3.6" = { + lazy_static = "1.3.0"; + }; + deps.toml."0.4.10" = { + serde = "1.0.90"; + }; + deps.toml."0.5.0" = { + serde = "1.0.90"; + }; + deps.typenum."1.10.0" = {}; + deps.ucd_util."0.1.3" = {}; + deps.unicode_bidi."0.3.4" = { + matches = "0.1.8"; + }; + deps.unicode_normalization."0.1.8" = { + smallvec = "0.6.9"; + }; + deps.unicode_width."0.1.5" = {}; + deps.unicode_xid."0.1.0" = {}; + deps.url."1.7.2" = { + idna = "0.1.5"; + matches = "0.1.8"; + percent_encoding = "1.0.1"; + }; + deps.url_serde."0.2.0" = { + serde = "1.0.90"; + url = "1.7.2"; + }; + deps.utf8_ranges."1.0.2" = {}; + deps.vcpkg."0.2.6" = {}; + deps.vec_map."0.8.1" = {}; + deps.walkdir."2.2.7" = { + same_file = "1.0.4"; + winapi = "0.3.7"; + winapi_util = "0.1.2"; + }; + deps.winapi."0.2.8" = {}; + deps.winapi."0.3.7" = { + winapi_i686_pc_windows_gnu = "0.4.0"; + winapi_x86_64_pc_windows_gnu = "0.4.0"; + }; + deps.winapi_build."0.1.1" = {}; + deps.winapi_i686_pc_windows_gnu."0.4.0" = {}; + deps.winapi_util."0.1.2" = { + winapi = "0.3.7"; + }; + deps.winapi_x86_64_pc_windows_gnu."0.4.0" = {}; + deps.wincolor."1.0.1" = { + winapi = "0.3.7"; + winapi_util = "0.1.2"; + }; +} diff --git a/artiq-fast/pkgs/rust/cargo-vendor.nix b/artiq-fast/pkgs/rust/cargo-vendor.nix new file mode 100644 index 0000000..43dc02c --- /dev/null +++ b/artiq-fast/pkgs/rust/cargo-vendor.nix @@ -0,0 +1,10 @@ +{ callPackage, fetchFromGitHub }: + +((callPackage ./cargo-vendor-carnix.nix {}).cargo_vendor {}).overrideAttrs (attrs: { + src = fetchFromGitHub { + owner = "alexcrichton"; + repo = "cargo-vendor"; + rev = "9355661303ce2870d68a69d99953fce22581e31e"; + sha256 = "0d4j3r09am3ynwhczimzv39264f5xz37jxa9js123y46w5by3wd2"; + }; +}) diff --git a/artiq-fast/pkgs/rust/cargo.nix b/artiq-fast/pkgs/rust/cargo.nix new file mode 100644 index 0000000..752d074 --- /dev/null +++ b/artiq-fast/pkgs/rust/cargo.nix @@ -0,0 +1,61 @@ +{ stdenv, file, curl, pkgconfig, python, openssl, cmake, zlib +, makeWrapper, libiconv, cacert, rustPlatform, rustc, libgit2 +, fetchurl +}: + +rustPlatform.buildRustPackage rec { + # Note: we can't build cargo 1.28.0 because rustc tightened the borrow checker rules and broke + # backward compatibility, which affects old cargo versions. + name = "cargo-${version}"; + version = "1.37.0"; + src = fetchurl { + url = "https://static.rust-lang.org/dist/rustc-1.37.0-src.tar.gz"; + sha256 = "1hrqprybhkhs6d9b5pjskfnc5z9v2l2gync7nb39qjb5s0h703hj"; + }; + + # the rust source tarball already has all the dependencies vendored, no need to fetch them again + cargoVendorDir = "vendor"; + preBuild = "pushd src/tools/cargo"; + postBuild = "popd"; + + passthru.rustc = rustc; + + # changes hash of vendor directory otherwise + dontUpdateAutotoolsGnuConfigScripts = true; + + nativeBuildInputs = [ pkgconfig cmake makeWrapper ]; + buildInputs = [ cacert file curl python openssl zlib libgit2 ]; + + LIBGIT2_SYS_USE_PKG_CONFIG = 1; + + # fixes: the cargo feature `edition` requires a nightly version of Cargo, but this is the `stable` channel + RUSTC_BOOTSTRAP = 1; + + postInstall = '' + # NOTE: We override the `http.cainfo` option usually specified in + # `.cargo/config`. This is an issue when users want to specify + # their own certificate chain as environment variables take + # precedence + wrapProgram "$out/bin/cargo" \ + --suffix PATH : "${rustc}/bin" \ + --set CARGO_HTTP_CAINFO "${cacert}/etc/ssl/certs/ca-bundle.crt" \ + --set SSL_CERT_FILE "${cacert}/etc/ssl/certs/ca-bundle.crt" + ''; + + checkPhase = '' + # Disable cross compilation tests + export CFG_DISABLE_CROSS_TESTS=1 + cargo test + ''; + + # Disable check phase as there are failures (4 tests fail) + doCheck = false; + + meta = with stdenv.lib; { + homepage = https://crates.io; + description = "Downloads your Rust project's dependencies and builds your project"; + maintainers = with maintainers; [ wizeman retrry ]; + license = [ licenses.mit licenses.asl20 ]; + platforms = platforms.unix; + }; +} diff --git a/artiq-fast/pkgs/rust/default.nix b/artiq-fast/pkgs/rust/rustc-with-crates.nix similarity index 88% rename from artiq-fast/pkgs/rust/default.nix rename to artiq-fast/pkgs/rust/rustc-with-crates.nix index b0708b8..90a66d6 100644 --- a/artiq-fast/pkgs/rust/default.nix +++ b/artiq-fast/pkgs/rust/rustc-with-crates.nix @@ -81,11 +81,15 @@ let ''; }; in - runCommand "rustc" {} - '' - mkdir -p $out/lib/rustlib/or1k-unknown-none/lib/ - cp -r ${or1k-crates}/* $out/lib/rustlib/or1k-unknown-none/lib/ - mkdir -p $out/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/ - cp -r ${arm-crates}/* $out/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/ - cp -r ${rustc_internal}/* $out - '' + stdenv.mkDerivation { + name = "rustc"; + inherit src version; + buildCommand = '' + mkdir -p $out/lib/rustlib/or1k-unknown-none/lib/ + cp -r ${or1k-crates}/* $out/lib/rustlib/or1k-unknown-none/lib/ + mkdir -p $out/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/ + cp -r ${arm-crates}/* $out/lib/rustlib/armv7-unknown-linux-gnueabihf/lib/ + cp -r ${rustc_internal}/* $out + ''; + passAsFile = [ "buildCommand" ]; + } diff --git a/artiq-fast/shell-dev.nix b/artiq-fast/shell-dev.nix index 5e0b515..7fd0519 100644 --- a/artiq-fast/shell-dev.nix +++ b/artiq-fast/shell-dev.nix @@ -9,7 +9,7 @@ in vivado pkgs.gnumake (pkgs.python3.withPackages(ps: (with ps; [ jinja2 numpy paramiko ]) ++ (with artiqpkgs; [ migen microscope misoc jesd204b migen-axi artiq ]))) - pkgs.cargo + artiqpkgs.cargo artiqpkgs.rustc artiqpkgs.binutils-or1k artiqpkgs.binutils-arm