Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/expede/nix-command-utils
https://github.com/expede/nix-command-utils
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/expede/nix-command-utils
- Owner: expede
- License: apache-2.0
- Created: 2024-03-06T00:56:36.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-03-06T05:19:34.000Z (9 months ago)
- Last Synced: 2024-10-08T03:27:11.356Z (about 1 month ago)
- Language: Nix
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Nix Command Utils
Helpers for defining commands for Nix shells under Flakes.
## Quickstart
``` nix
{
inputs = {
command-utils.url = "github:expede/nix-command-utils";
flake-utils.url = "github:numtide/flake-utils";
# ...
};outputs = {self, flake-utils, command-utils}:
flake-utils.lib.eachDefaultSystem (system:
let
# Cargo just for example
cargo = "${pkgs.cargo}/bin/cargo";
cmd = command-utils.cmd.${system};
command_menu = command-utils.commands.${system} {
hello = cmd "Print a hello world message" "echo 'Hello, world!'";bench = cmd "Run benchmarks, including test utils"
"${cargo} bench --features test_utils";"bench:host" = cmd "Run host Criterion benchmarks"
"${cargo} criterion";
};
#...
in
devShells.default = pkgs.mkShell {
nativeBuildInputs = with pkgs;
[
command_menu
# ...
];
#...
};
}
);
}
`````` console
$ menu
____ _
/ ___|___ _ __ ___ _ __ ___ __ _ _ __ __| |___
| | / _ \| '_ ` _ \| '_ ` _ \ / _` | '_ \ / _` / __|
| |__| (_) | | | | | | | | | | | (_| | | | | (_| \__ \
\____\___/|_| |_| |_|_| |_| |_|\__,_|_| |_|\__,_|___/bench | Run benchmarks, including test utils
bench:host | Run host Criterion benchmarks
hello | Print a hello world message$ hello
Hello, world!
```