GithubHelp home page GithubHelp logo

topquark12 / rust-esp-nix Goto Github PK

View Code? Open in Web Editor NEW

This project forked from sdobz/rust-esp-nix

0.0 0.0 0.0 11 KB

Nix files for development on the esp32 in rust using the esp-idf framework

License: MIT License

Nix 100.00%

rust-esp-nix's Introduction

RUST ESP32 NIX XTENSA ESP-IDF ESPRESSIF OH MY

This is a collection of nix files that support build rust onto the esp32

Example shell file:

shell.nix

let
  pythonPackageOverrides = self: super: {
    pyparsing = super.buildPythonPackage rec {
      pname = "pyparsing";
      version = "2.3.1";
      doCheck = false;
      src = super.fetchPypi {
        inherit pname version;
        sha256 = "0yk6xl885b91dmlhlsap7x78hk2rdr879fln9anbq6k4ca42djb6";
      };
    };
  };

  idf-package-overlay = self: super: {
    python2 = super.python2.override {
      packageOverrides = pythonPackageOverrides;
    };
  };

  pkgs = import (builtins.fetchTarball {
    # https://releases.nixos.org/nixos/unstable/nixos-20.09pre223023.fce7562cf46
    name = "nixos-unstable-2020-04-30";
    url = "https://github.com/nixos/nixpkgs/archive/fce7562cf46727fdaf801b232116bc9ce0512049.tar.gz";
    sha256 = "14rvi69ji61x3z88vbn17rg5vxrnw2wbnanxb7y0qzyqrj7spapx";
  }) {
    overlays = [
      idf-package-overlay
    ];
  };

  rust-esp = pkgs.callPackage (builtins.fetchTarball {
    name = "rust-esp-nix";
    url = "https://github.com/sdobz/rust-esp-nix/archive/791e35c4822a7bdb91a2fbf7323e64255b640bd0.tar.gz";
    sha256 = "0qp3myqpnprf7wfxxvnxpkhs3rg1d85cd9zynrhva7clgs3axnn4";
  }) {};
in
pkgs.mkShell {
    buildInputs = [ 
      rust-esp.xbuild
      rust-esp.bindgen
      rust-esp.rustc
      rust-esp.cargo
      rust-esp.esp-idf
      rust-esp.esp32-toolchain
      pkgs.rustfmt
    ];

    shellHook = ''
${rust-esp.env}

if ! [ -d esp-idf ]; then
  mkdir -p esp-idf
  pushd esp-idf
  git init
  git remote add origin https://github.com/espressif/esp-idf
  git fetch --depth 1 origin 0a03a55c1eb44a354c9ad5d91d91da371fe23f84
  git checkout FETCH_HEAD
  git submodule update --init --recursive
  popd
fi
IDF_PATH=$(pwd)/esp-idf
    '';
}

Example usage:

$ git clone https://github.com/sdobz/esp32-hello
$ cd esp32-hello
$ nix-shell shell.nix
<wait for a long long time while we build the world>
[shell] $ ./all.sh /dev/ttyUSB0
...
 (2317) Rust: I, live, again!.

Improvements:

  • Bindgen is not running tests, needs investigation
  • Package as an overlay so other rust based programs can use this version of rust
  • Figure out how to not have to compile python to override a package
  • More idiomatic nix?

rust-esp-nix's People

Contributors

sdobz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.