Template
Add clap CLI, logging, and update Nix flake
Introduce a clap‑based command line interface and file logging using simplelog. Add the corresponding dependencies (clap, log, simplelog) and a release profile with LTO and stripping. Refactor the Nix flake: update default.nix metadata, improve devShell, add update script and metadata, and adjust flake.nix outputs accordingly. Update Cargo.lock to reflect new crates.
This commit is contained in:
+45
-10
@@ -1,14 +1,49 @@
|
||||
{
|
||||
lib,
|
||||
rustPlatform,
|
||||
packageName,
|
||||
# fetchFromGitea,
|
||||
pkg-config,
|
||||
# add nixpkgs if your dependencies requires system libraries
|
||||
}:
|
||||
rustPlatform.buildRustPackage {
|
||||
name = "${packageName}";
|
||||
src = ./.;
|
||||
# buildInputs = [ ]; <-- add nixpkgs if your dependencies requires system libraries
|
||||
nativeBuildInputs = [ pkg-config ];
|
||||
cargoHash = lib.fakeHash; # <-- Put your real hash here after failed nix build
|
||||
}
|
||||
versionCheckHook,
|
||||
nix-update-script,
|
||||
}: let
|
||||
pname = "rust-flake-template";
|
||||
version = "0.1.0";
|
||||
in
|
||||
rustPlatform.buildRustPackage {
|
||||
inherit pname version;
|
||||
|
||||
src = ./.;
|
||||
# src = fetchFromGitea {
|
||||
# domain = "gitea.garandplg.com";
|
||||
# owner = "GarandPLG";
|
||||
# repo = "${pname}";
|
||||
# tag = "v${version}";
|
||||
# hash = lib.fakeHash;
|
||||
# };
|
||||
|
||||
cargoHash = lib.fakeHash;
|
||||
|
||||
nativeBuildInputs = [pkg-config];
|
||||
|
||||
# buildInputs = [];
|
||||
|
||||
nativeInstallCheckInputs = [versionCheckHook];
|
||||
doInstallCheck = true;
|
||||
|
||||
passthru.updateScript = nix-update-script {};
|
||||
|
||||
# postInstall = ''
|
||||
# cp -r statics $out/bin
|
||||
# '';
|
||||
|
||||
meta = {
|
||||
description = "Basic rust flake for development and production";
|
||||
homepage = "https://gitea.garandplg.com/GarandPLG/${pname}";
|
||||
license = lib.licenses.mit;
|
||||
platforms = ["x86_64-linux"];
|
||||
maintainers = with lib.maintainers; [
|
||||
GarandPLG
|
||||
];
|
||||
mainProgram = pname;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user