Search code examples
nixnixosnixops

nixos-option for NixOps deployed machine?


There is a command nixos-option which examines given system's option value. Under the hood it does something like:

$ nix-instantiate --eval -E '
  let nixos = import <nixpkgs/nixos> { };
      opt = nixos.config.networking.firewall.allowedTCPPorts;
  in builtins.deepSeq opt opt
  '

$-> [ 1194 22 8081 80 443 4949 ]

But that doesn't work for NixOps deployed machines (configuration isn't available there). Is there a way to get option value from NixOps deploment config, on deployer machine?


Solution

  • Nixops has the solution! ;)

    Command nixops show-option

    Synopsis

    nixops show-option [--xml] machine option

    Description

    This command prints the value of the specified NixOS configuration option for the specified machine.