yusdacra/rust-nix-templater

rust-nix-templater

Generates Rust projects which use devshell, supports top-level devshell

Generates Rust projects which use nix-cargo-integration.

Features

  • One place for configuration; Cargo.toml
  • Generate for applications or libraries
  • Support for both flakes and legacy nix
  • Generates release, debug and test packages
  • Cachix support
  • Generates development shell (uses devshell, supports top-level devshell.toml file)
  • Desktop file generation
  • CI file generation (GitHub Actions and GitLab CI)
  • Creates Cargo project if one is not found in output directory
  • See nix-cargo-integration for more information.

Installation

  • Flakes: nix profile install github:yusdacra/
    • Or run without installing: nix run github:yusdacra/
  • Legacy: nix-env -i -f "https://github.com/yusdacra//tarball/master"

Examples

Simple:

 -l mit -n example
# is equal to
 --license mit --name example

This will generate files in the current directory, with license set to mit and package name set to example. It will generate both build and development environment files that have a binary package, using Rust's stable toolchain. If the current directory doesn't already have a Cargo project, this will create one.

For a project that uses beta toolchain and is hosted on GitHub:

 --github-ci -t beta -l mit -n example
# is equal to
 --github-ci --toolchain beta -l mit -n example

This will do what the first example does, but use beta toolchain and also generate a GitHub Actions workflow.

For more options please check --help.

Usage

 0.2.3
Generates Nix files for Rust projects which uses naersk

USAGE:
     [FLAGS] [OPTIONS]

FLAGS:
    -A, --no-app           Whether to disable app output for flake
        --disable-build    Disable app / builds flake output generation
        --github-ci        Enable GitHub Actions file generation
        --gitlab-ci        Enable GitLab CI file generation
        --help             Prints help information
    -L, --library          Whether to copy libraries to package output
    -V, --version          Prints version information

OPTIONS:
        --cachix-name <cachix-name>                      Cachix cache name. [example: --cachix-name ]
        --cachix-public-key <cachix-public-key>
            Cachix cache public key. [example: --cachix-public-key ".cachix.org-
            1:Tmy1V0KK+nxzg0XFePL/++t4JRKAw5tvr+FNfHz7mIY=""]
    -o, --out-dir <out-dir>
            Output directory where generated files will be put in. [example: -o example] [default: .]

    -d, --description <package-description>              A short, single line description of the package
    -h, --homepage <package-homepage>
            Homepage of the package. [example: -h "https://gitlab.com/example/example"]

        --icon <package-icon>
            Icon to use in the generated desktop file. [example: --icon assets/icon.ico]

    -l, --license <package-license>
            License of the package. Must be a valid Cargo.toml license. [example: mit]

    -D, --long-description <package-long-description>    A longer description of the package
    -n, --name <package-name>
            Name of the package. Must be passed when also creating a Cargo project. [example: icy_matrix]

    -s, --systems <package-systems>...
            Systems that the package is supported on. [example: -s x86_64-linux x86_64-darwin] [default: nixpkgs default
            systems]
        --xdg-categories <package-xdg-categories>
            Categories to put in the generated desktop file. [example: --xdg-categories "Network;InstantMessaging;"]

        --xdg-comment <package-xdg-comment>
            Comment to put in the generated desktop file. [default: package description]

        --xdg-desktop-name <package-xdg-desktop-name>
            Desktop name to put in the generated desktop file. Defaults to package name. [example: --xdg-desktop-name
            "Icy Matrix"]
        --xdg-generic-name <package-xdg-generic-name>
            Generic name to put in the generated desktop file. [example: --xdg-generic-name "Matrix Client"]

    -t, --toolchain <rust-toolchain-channel>
            Rust toolchain channel to use. [example: -t nightly] [default: stable]

Development

Building

The Nix flake provides two main build types: release and debug, akin to the Cargo build types.

For debugging, build with debug symbols, but don't test:

nix build .#-debug

For release, which compiles in Cargo release mode:

nix build .#
# or
nix build

Testing

With Nix flakes, you can check the flake.nix format and run the tests with:

nix flake check

This will build and test the -tests attribute (which also runs Cargo tests).

Issues

Collection of the latest Issues

yusdacra

yusdacra

good first issue
Comment Icon0

What needs to be done:

  • Don't use unwrap, actually handle the errors and print good error messages
  • Print a warning message when user specifies an option which is not used without specifying some other option, eg. --cachix-public-key and --cachix-name.
Versions

Find the latest versions by id

v0.2.5 - Jun 15, 2021

  • Update the Nix installer URL in Github Actions workflow file template
  • Refactor non-flake Nix compat files
  • Some internal refactors

v0.2.4 - Apr 26, 2021

This release fixes some overlooks and changes some option's behaviours. Refer to commit history for details.

v0.2.3 - Apr 19, 2021

This release brings a library which can be used by other crates. It also removes some useless options and updates docs to match nix-cargo-integration.

v0.2.2 - Apr 16, 2021

This release brings an initial override template to make getting started easier (#20).

v0.2.1 - Apr 13, 2021

This release brings minor fixes for default.nix and shell.nix template files, fixing wrong src path. flake.nix template file now also uses new nix-cargo-integration API.

v0.2.0 - Apr 10, 2021

This release has many additions such as #13, #16, #9, #5 and #1. Many of the Nix code is moved to nix-cargo-integration, which will allow independent fixes and features to the Nix code.

v0.1.0 - Mar 27, 2021

Core features are present.

Information - Updated Jan 18, 2022

Stars: 24
Forks: 0
Issues: 4

quest-hook-template

A template for writing mods for Quest il2cpp games in Rust using cargo generate to clone the template:

quest-hook-template

Command line json text parsing and processing utility

parsing json compliant with rust and cargo

Command line json text parsing and processing utility

Clone this repo: git clone

If you don't have Rust and cargo-make installed,

Clone this repo: git clone

Rustup: the Rust installer and version management tool

To test that you have Rust and Cargo installed, you can run this in your terminal of choice: cargo --version

Rustup: the Rust installer and version management tool

Address generator in Rust

If you have Rust: cargo install gemgen

Address generator in Rust

First, complete the basic Rust setup instructions

Use Rust's native cargo command to build and launch the template node:

First, complete the basic Rust setup instructions

cargo rssc - Rust scripts for crates building

will copy the template_basic into scripts_rssc folder

cargo rssc - Rust scripts for crates building

NES Emulator in Rust-WASM

Requires Rust with cargo, nodejs, and wasm-pack

NES Emulator in Rust-WASM

Terraformer Engine

A 3D game engine but completely in rust/std/cargo

Terraformer Engine

Rustup: the Rust installer and version management tool

To test that you have Rust and Cargo installed, you can run this in your terminal of choice: cargo --version

Rustup: the Rust installer and version management tool
Facebook Instagram Twitter GitHub Dribbble
Privacy