Ferrix is a highly opinionated, zero-configuration Nix flake framework for Rust projects.
It provides Rust packages with automatically populated package names and metadata, LTO and size optimization build configurations, installation of shell completion files, statically linked packages for Linux platforms, flake checks for Clippy, rustfmt, nixfmt, and REUSE, and a development shell out of the box with no configuration required.
Warning
The API surface currently can change at any time and is not guaranteed to be stable.
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
ferrix.url = "github:ryanccn/ferrix";
};
outputs =
{
ferrix,
...
}@inputs:
ferrix.lib.mkFlake inputs {
root = ./.;
};
}root(required): the root of the project, required for locating important files such asCargo.tomlandCargo.lockname: the name of the project used in package attrsets and other places (inferred fromCargo.tomlby default)doCheck: do checks provided byrustPlatform(defaults tofalse)enableStaticPackages: provide static Linux packages inlegacyPackages(defaults totrue)src: source fileset passed torustPlatform.buildRustPackageand Rust-related checks (defaults tosrc,tests,Cargo.toml,Cargo.lock, andbuild.rs)completions.enable: install completions by executing<pname> <args> {bash,zsh,fish}at build timecompletions.args: arguments passed to the project binary when installing completionsdevShells.enable,checks.enable,checks.enableNixfmt,checks.enableRustfmt,checks.enableClippy,checks.enableREUSE: enable/disable devshells and specific checks in the flake (all default totrue)buildInputs,nativeBuildInputs,env,cargoLock,meta: attributes that are merged with the defaults and passed torustPlatform.buildRustPackage(meta.descriptionandmeta.licenseinferred fromCargo.tomlby default)extraPostInstall: extrapostInstallcommands that can be configured withcallPackagearguments; configured in the shape of{ enableDoNothing = { default = false; value = ":"; }; }systems: systems to include in flake outputs (defaults tolib.systems.flakeExposed)flake.*: attributes that are recursively merged with the defaults and exposed in the top-level flake
Apache-2.0