From e23e13fcede09d4ec20542a357d74e0439a55d5a Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Wed, 21 Aug 2019 16:59:58 +0800 Subject: [PATCH] add nix files --- default.nix | 27 +++++++++++++++++++++++++++ shell.nix | 25 +++++++++++++++++++++++++ 2 files changed, 52 insertions(+) create mode 100644 default.nix create mode 100644 shell.nix diff --git a/default.nix b/default.nix new file mode 100644 index 0000000..1f46704 --- /dev/null +++ b/default.nix @@ -0,0 +1,27 @@ +{ # Use master branch of the overlay by default + mozillaOverlay ? import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz), +}: + +let + pkgs = import { overlays = [ mozillaOverlay ]; }; +in +with pkgs; +let + rustcSrc = fetchgit { + url = https://github.com/rust-lang/rust.git; + # master of 2019-08-18 + rev = "ea52be482ab4945fda63cb65b6a198309a041e3c"; + sha256 = "1spifrkvyyrh1gazqrby29fjqsdbwvajv9k9f6mk2ldrdghlsd21"; + fetchSubmodules = true; + }; + targets = [ + ]; + rust = + rustChannelOfTargets "nightly" null targets; + rustPlatform = recurseIntoAttrs (makeRustPlatform { + rustc = rust // { src = rustcSrc; }; + cargo = rust; + }); +in { + inherit pkgs rustPlatform rustcSrc; +} diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..88641d2 --- /dev/null +++ b/shell.nix @@ -0,0 +1,25 @@ +let + mozillaOverlay = import (builtins.fetchTarball https://github.com/mozilla/nixpkgs-mozilla/archive/master.tar.gz); + pkgs = import { overlays = [ mozillaOverlay ]; }; +in +with pkgs; +let + project = callPackage ./default.nix {}; +in +with project; +stdenv.mkDerivation { + name = "armdev-env"; + buildInputs = with rustPlatform.rust; [ + rustc cargo cargo-xbuild + rustcSrc + openocd + ]; + + # Set Environment Variables + RUST_BACKTRACE = 1; + XARGO_RUST_SRC = "${rustcSrc}/src"; + + shellHook = '' + echo "Run 'cargo xbuild --release' to build." + ''; +}