0

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?

danbst
  • 3,363
  • 18
  • 38
  • 1
    The `show-option` sub command to nixops gives you deployment attributes from the deployer machine, or do you want to be able to access them from the _deployed_ machine? In which case I'm not aware of a builtin way of doing that since as you say the configs are only on the deployer machine, not the deployed machine (though it could be good feature to add) – brocking Dec 20 '16 at 17:56
  • much thanks! I wanted to access option on deployer machine, yes. I'd like to accept your answer – danbst Dec 21 '16 at 12:11

1 Answers1

1

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.

Community
  • 1
  • 1
brocking
  • 821
  • 6
  • 9