项目作者: yusdacra

项目描述 :
Generates Nix build / dev files for Rust projects.
高级语言: Rust
项目地址: git://github.com/yusdacra/rust-nix-templater.git
创建时间: 2021-01-04T15:40:01Z
项目社区:https://github.com/yusdacra/rust-nix-templater

开源协议:MIT License

下载


THIS PROJECT IS NO LONGER MAINTAINED

rust-nix-templater

Generates Rust projects that use nix-cargo-integration.

Features

  • Support for both flakes and legacy nix
  • Cachix support
  • 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

Run without installing by executing nix run github:yusdacra/rust-nix-templater -- --help.

  • Flakes: nix profile install github:yusdacra/rust-nix-templater
  • Legacy: nix-env -i -f "https://github.com/yusdacra/rust-nix-templater/tarball/master"

Examples

Simple:

  1. rust-nix-templater -l mit -n example
  2. # is equal to
  3. rust-nix-templater --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.
If the current directory doesn’t already have a Cargo project, this will create one.

For a project that is hosted on GitHub:

  1. rust-nix-templater --github-ci -l mit -n example
  2. # is equal to
  3. rust-nix-templater --github-ci -l mit -n example

This will do what the first example does and also generate a GitHub Actions workflow.

For more options please check rust-nix-templater --help.

Usage

  1. rust-nix-templater 0.4.0
  2. Generates Nix files for Rust projects which uses naersk
  3. USAGE:
  4. rust-nix-templater [FLAGS] [OPTIONS]
  5. FLAGS:
  6. -A, --no-app Whether to disable app output for flake
  7. --disable-build Disable app / builds flake output generation
  8. --github-ci Enable GitHub Actions file generation
  9. --gitlab-ci Enable GitLab CI file generation
  10. --help Prints help information
  11. -V, --version Prints version information
  12. OPTIONS:
  13. --cachix-name <cachix-name> Cachix cache name. [example: --cachix-name rust-nix-templater]
  14. --cachix-public-key <cachix-public-key>
  15. Cachix cache public key. [example: --cachix-public-key "rust-nix-templater.cachix.org-
  16. 1:Tmy1V0KK+nxzg0XFePL/++t4JRKAw5tvr+FNfHz7mIY=""]
  17. -o, --out-dir <out-dir>
  18. Output directory where generated files will be put in. [example: -o example] [default: .]
  19. -d, --description <package-description> A short, single line description of the package
  20. -h, --homepage <package-homepage>
  21. Homepage of the package. [example: -h "https://gitlab.com/example/example"]
  22. --icon <package-icon>
  23. Icon to use in the generated desktop file. [example: --icon assets/icon.ico]
  24. -l, --license <package-license>
  25. License of the package. Must be a valid Cargo.toml license. [example: mit]
  26. -D, --long-description <package-long-description> A longer description of the package
  27. -n, --name <package-name>
  28. Name of the package. Must be passed when also creating a Cargo project. [example: icy_matrix]
  29. -s, --systems <package-systems>...
  30. Systems that the package is supported on. [example: -s x86_64-linux x86_64-darwin] [default: nixpkgs default
  31. systems]
  32. --xdg-categories <package-xdg-categories>
  33. Categories to put in the generated desktop file. [example: --xdg-categories "Network;InstantMessaging;"]
  34. --xdg-comment <package-xdg-comment>
  35. Comment to put in the generated desktop file. [default: package description]
  36. --xdg-desktop-name <package-xdg-desktop-name>
  37. Desktop name to put in the generated desktop file. Defaults to package name. [example: --xdg-desktop-name
  38. "Icy Matrix"]
  39. --xdg-generic-name <package-xdg-generic-name>
  40. Generic name to put in the generated desktop file. [example: --xdg-generic-name "Matrix Client"]

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:

  1. nix build .#rust-nix-templater-dev

For release, which compiles in Cargo release mode:

  1. nix build .#rust-nix-templater
  2. # or
  3. nix build

Testing

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

  1. nix flake check

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