Pure Nix Power
Create comprehensive CLI tools using pure Nix, leveraging the vast nixpkgs ecosystem
Nix-Powered CLI tools
Create feature-rich CLI tools with Nix and bash - complete with flags, documentation, and more
A normal pog package can also produce three opt-in, single-file outputs:
| Output | Dependency model | Good fit |
|---|---|---|
toHostScript | Uses commands already installed on the host | Bootstrap scripts and managed fleets |
toArx | Carries the Nix closure inside an experimental Linux bundle | Internal tools that need exact Nix dependencies |
toAppImage | Carries the Nix closure inside an AppImage | Distributing a Linux CLI as one familiar artifact |
The normal Nix package stays unchanged until one of these outputs is requested. Each format uses the same flags, commands, help, runtime inputs, and script definition.
See the portable outputs guide →
pog {
name = "deploy"; # derivation/script name
description = "Deploy application to cloud"; # used in the help doc
flags = [
pog._.flags.aws.region # a flag with bash completion, included in pog
{
name = "environment";
short = "e"; # defaults to the first character of the name
description = "deployment environment"; # used in the help doc
required = true; # forces the user to specify, or prompts for it
completion = ''echo "dev staging prod"''; # used for tab completion
}
];
script = helpers: ''
green "Deploying to $environment in $region..."
${helpers.spinner {
command = "kubectl apply -f ./manifests/";
title = "Deploying...";
}}
'';
}