* Provide a default hostname and deployment target equal to the

attribute name of the machine in the model.  This allows
  networking.hostName and deployment.targetHost to be omitted for
  typical networks.

svn path=/nixos/trunk/; revision=25125
This commit is contained in:
Eelco Dolstra 2010-12-14 13:36:54 +00:00
parent 332f0418f7
commit 37a9ffffb0
2 changed files with 16 additions and 12 deletions

View File

@ -70,11 +70,18 @@ let
{ name = configurationName; { name = configurationName;
value = (import "${nixos}/lib/eval-config.nix" { value = (import "${nixos}/lib/eval-config.nix" {
inherit nixpkgs; inherit nixpkgs;
modules = [ configuration ]; modules =
[ configuration
# Provide a default hostname and deployment target equal
# to the attribute name of the machine in the model.
{ key = "set-default-hostname";
networking.hostName = pkgs.lib.mkOverride 900 configurationName;
deployment.targetHost = pkgs.lib.mkOverride 900 configurationName;
}
];
extraArgs = evaluateMachines network; extraArgs = evaluateMachines network;
}).config; } }).config; }
) (attrNames (network))) ) (attrNames (network)));
;
configs = evaluateMachines network; configs = evaluateMachines network;
in in

View File

@ -4,15 +4,12 @@ with pkgs.lib;
{ {
options = { options = {
deployment.targetHost = mkOption {
deployment = { default = config.networking.hostName;
targetHost = mkOption { description = ''
default = config.networking.hostName; This option specifies a hostname or IP address which can be used by nixos-deploy-network
description = '' to execute remote deployment operations.
This option specifies a hostname or IP address which can be used by nixos-deploy-network '';
to execute remote deployment operations.
'';
};
}; };
}; };
} }