Coder Social home page Coder Social logo

rpearce / nix-rust-template Goto Github PK

View Code? Open in Web Editor NEW
13.0 4.0 2.0 9 KB

A reasonable way to start developing a reproducible Rust project

License: MIT License

Nix 90.97% Rust 1.88% Dockerfile 7.15%
rust rust-lang nix nix-flakes docker docker-compose rust-template nix-template

nix-rust-template's Introduction

nix-rust-template

A reasonable way to start developing a reproducible Rust project.

This reproducibility is enabled by Nix and Docker.

Features

This is a template repository; everything is customizable, and some helpful defaults are included.

  • Default rust extensions:
    • clippy-preview: A collection of lints to catch common mistakes and improve your Rust code
    • rust-src
    • rustc-dev
    • rustfmt: A tool for formatting Rust code according to style guidelines
  • Default dev tools:
    • rust-analyzer: Excellent IDE support
    • cargo-watch: Watches over your project's source for changes, and runs Cargo commands when they occur
    • cargo-edit: Extends Cargo to allow you to add, remove, and upgrade dependencies by modifying your Cargo.toml file from the command line
  • naersk: Nix support for building cargo crates
  • oxalica/rust-overlay: Pure and reproducible overlay for binary distributed rust toolchains

Setup

With Docker

With docker compose (recommended)

docker compose build
docker compose up

Without docker compose

docker build . -t nix-rust-template
docker volume create nix-rust-template-vol
docker run --rm -it -v $PWD:/service nix-rust-template:latest

Without Docker

  1. Install nix
  2. Install nix flakes

Commands

If you are using Docker, prefix the following with docker compose run --rm app; for example:

docker compose run --rm app nix run .#watch
  • nix build: build the package
  • nix run or nix run .#app: run the package
  • nix run .#watch: watch the package for changes and rerun
  • nix develop: enter a reproducible rust shell environment
    • How to watch for changes and rerun:
      cargo watch -w "./src/" -x "run"

nix-rust-template's People

Contributors

rpearce avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  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.