j-brn / nix-rust-template

template for rust projects with nix

Home Page:https://j-brn.github.io/nix-rust-template/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

nix-rust-template

Features

  • workspace support
  • build with crane
  • most recent and/or custom rust toolchain with fenix
  • cargo clippy, fmt, test, doc and audit as flake checks
  • complete Github CI with automatic lockfile updates, flake checks, build
  • automatic bundling of releases (deb, rpm, pacman, AppImage, Docker) for aarch64-linux and x86_64-linux

Prerequisites

Getting started

  • click "use this template" to create your repository
  • rename or remove the existing crates
    • rename or recreate all crates under crates/ with names of your choosing
    • in Cargo.toml change the paths in the [members] field to the crates you just created/renamed
    • in .github/workflows/ci.yml replace/delete "client" and "server" in the job matrix for "bundle" amd "build"
    • in flake.nix
      • replace/delete "client-package" and "server-package" with "$name-package"
      • replace/delete packages.client and packages.server to packages.$name
      • replace/delete the inherit client-package server-package in the devShell section with the new names and add/remove any crates you added/removed
  • create the repository secret GH_TOKEN_FOR_UPDATES with your personal GitHub access token or replace ${{ secrets.GH_TOKEN_FOR_UPDATES }} with ${{ secrets.GITHUB_TOKEN }} in .github/workflows/update.yml
  • (optional) enable the Renovate bot for automatic rust and actions dependency updates or delete renovate.json
  • (optional) allow direnv to run: direnv allow

Usage

  • nix build to build
  • nix flake check to run tests
  • nix develop to enter the dev shell (happens automatically when using direnv)

Planned Features

  • darwin support
  • cross compilation for windows
  • code coverage checks
  • actions/scripts to automate most of [Getting Started]

About

template for rust projects with nix

https://j-brn.github.io/nix-rust-template/

License:Apache License 2.0


Languages

Language:Nix 97.2%Language:Rust 2.6%Language:Shell 0.3%