lib: don't define defaults that require config

This commit is contained in:
tv 2016-10-13 21:49:04 +02:00
parent 1a5f52234e
commit 7c91a19549
4 changed files with 4 additions and 13 deletions

View File

@ -791,6 +791,7 @@ TNs2RYfwDy/r6H/hDeB/BSngPouedEVcPwIDAQAB
} // { # hosts only maintained in stockholm, not owned by me } // { # hosts only maintained in stockholm, not owned by me
muhbaasu = rec { muhbaasu = rec {
owner = config.krebs.users.root;
cores = 1; cores = 1;
nets = { nets = {
internet = { internet = {

View File

@ -8,6 +8,7 @@ let
"test-centos7" "test-centos7"
"test-all-krebs-modules" "test-all-krebs-modules"
] (name: { ] (name: {
owner = config.krebs.users.shared;
inherit name; inherit name;
cores = 1; cores = 1;
nets = { nets = {
@ -34,6 +35,7 @@ let
in { in {
hosts = { hosts = {
wolf = { wolf = {
owner = config.krebs.users.shared;
nets = { nets = {
shack = { shack = {
ip4.addr = "10.42.2.150" ; ip4.addr = "10.42.2.150" ;

View File

@ -19,7 +19,6 @@ let out = lib // rec {
])); ]));
types = import ./types.nix { types = import ./types.nix {
inherit config;
lib = lib // { inherit genid optionalTrace; }; lib = lib // { inherit genid optionalTrace; };
}; };

View File

@ -1,14 +1,9 @@
{ config, lib, ... }: { lib, ... }:
with builtins; with builtins;
with lib; with lib;
with types; with types;
let
# Inherited attributes are used in submodules that have their own `config`.
inherit (config.krebs) build users;
in
types // rec { types // rec {
host = submodule ({ config, ... }: { host = submodule ({ config, ... }: {
@ -27,7 +22,6 @@ types // rec {
owner = mkOption { owner = mkOption {
type = user; type = user;
default = users.krebs;
}; };
extraZones = mkOption { extraZones = mkOption {
@ -49,10 +43,6 @@ types // rec {
ssh.pubkey = mkOption { ssh.pubkey = mkOption {
type = nullOr ssh-pubkey; type = nullOr ssh-pubkey;
default = null; default = null;
apply = x:
optionalTrace (x == null && config.owner.name == build.user.name)
"The option `krebs.hosts.${config.name}.ssh.pubkey' is unused."
x;
}; };
ssh.privkey = mkOption { ssh.privkey = mkOption {
type = nullOr ssh-privkey; type = nullOr ssh-privkey;
@ -187,7 +177,6 @@ types // rec {
}; };
owner = mkOption { owner = mkOption {
type = user; type = user;
default = users.root;
}; };
group-name = mkOption { group-name = mkOption {
type = str; type = str;