1
0
Fork 0

Add hosts to common options

This commit is contained in:
Malte Brandy 2018-06-09 02:41:23 +02:00
parent 9317c6ceba
commit 5fb373088d
4 changed files with 32 additions and 15 deletions

26
common/default.nix Normal file
View file

@ -0,0 +1,26 @@
{ config, pkgs, lib, ... }:
with lib;
{
imports = [ ./secret ];
options = {
m-0.private = mkOption {
default = {};
type = types.attrs;
};
m-0.prefix = mkOption {
default = "2a02:c207:3002:7584";
type = types.str;
};
m-0.hosts = mkOption {
type = types.attrs;
default = let p = config.m-0.prefix; in {
hera = "${p}::1";
hera-intern = "${p}::3:1";
git = "${p}::3:2";
borg = "${p}::3:3";
apollo = "${p}::1:1";
athene = "${p}::2:1";
};
};
};
}

View file

@ -1,10 +0,0 @@
{ config, pkgs, lib, ... }:
with lib;
{
options = {
m-0.private = mkOption {
default = {};
type = types.attrs;
};
};
}

View file

@ -19,8 +19,7 @@ imports = [
./modules/eventd.nix
./modules/unlock.nix
./modules/weechat
../common/private-options.nix
../common/secret
../common
# ./sort-mail.nix
# ./morgenreport.nix
];

View file

@ -1,11 +1,12 @@
{ pkgs, config, lib, ... }:
{
let
me = config.m-0.private.me;
in {
# channel = 18.03
imports = [
<home-manager/nixos>
../common/secret
../common/private-options.nix
../common
./modules/laptop.nix
./modules/server
./modules/standalone
@ -23,6 +24,7 @@
networking = {
firewall.allowPing = true;
useDHCP = false;
hosts = lib.zipAttrs (lib.mapAttrsToList (host: ip: {"${ip}" = host; } ) config.m-0.hosts);
};
users = {