Skip to content

j-brn/nix-rust-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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]