Skip to content

pog 🤯

Nix-Powered CLI tools

Create feature-rich CLI tools with Nix and bash - complete with flags, documentation, and more

Define once, choose how to ship ​

A normal pog package can also produce three opt-in, single-file outputs:

OutputDependency modelGood fit
toHostScriptUses commands already installed on the hostBootstrap scripts and managed fleets
toArxCarries the Nix closure inside an experimental Linux bundleInternal tools that need exact Nix dependencies
toAppImageCarries the Nix closure inside an AppImageDistributing 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 →

Quick Example ​

nix
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...";
    }}
  '';
}