nixos: Add domain to assignments

This commit is contained in:
Jack O'Sullivan 2022-06-05 16:40:44 +01:00
parent fd4fcdc2a4
commit 4e36748154
6 changed files with 12 additions and 9 deletions

View File

@ -9,6 +9,7 @@
assignments = {
internal = {
altNames = [ "vm" ];
domain = lib.my.colony.domain;
ipv4.address = "${lib.my.colony.start.base.v4}2";
ipv6 = {
iid = "::2";
@ -32,8 +33,6 @@
{
imports = [ "${modulesPath}/profiles/qemu-guest.nix" ];
networking.domain = lib.my.colony.domain;
boot.kernelParams = [ "intel_iommu=on" ];
boot.loader.systemd-boot.configurationLimit = 20;
fileSystems = {

View File

@ -8,6 +8,7 @@
internal = {
name = "estuary-vm";
altNames = [ "fw" ];
domain = lib.my.colony.domain;
ipv4 = {
address = "80.111.124.10";
gateway = null;
@ -37,8 +38,6 @@
config = mkMerge [
{
networking.domain = lib.my.colony.domain;
boot.kernelParams = [ "console=ttyS0,115200n8" ];
fileSystems = {
"/boot" = {

View File

@ -7,6 +7,7 @@
internal = {
name = "middleman-ctr";
altNames = [ "http" ];
domain = lib.my.colony.domain;
ipv4.address = "${lib.my.colony.start.ctrs.v4}2";
ipv6 = {
iid = "::2";

View File

@ -6,6 +6,7 @@
assignments = {
internal = {
name = "vaultwarden-ctr";
domain = lib.my.colony.domain;
ipv4.address = "${lib.my.colony.start.ctrs.v4}3";
ipv6 = {
iid = "::3";

View File

@ -9,6 +9,7 @@
internal = {
name = "shill-vm";
altNames = [ "ctr" ];
domain = lib.my.colony.domain;
ipv4.address = "${lib.my.colony.start.vms.v4}2";
ipv6 = {
iid = "::2";
@ -35,8 +36,6 @@
config = mkMerge [
{
networking.domain = lib.my.colony.domain;
boot.kernelParams = [ "console=ttyS0,115200n8" ];
fileSystems = {
"/boot" = {

View File

@ -1,8 +1,8 @@
{ lib, pkgsFlakes, hmFlakes, inputs, pkgs', config, ... }:
let
inherit (builtins) attrValues mapAttrs;
inherit (lib) substring flatten optional optionals mkDefault mkForce mkOption mkOptionType;
inherit (lib.my) naiveIPv4Gateway homeStateVersion mkOpt' mkBoolOpt' commonOpts inlineModule';
inherit (lib) substring flatten optional optionals mkIf mkDefault mkForce mkOption mkOptionType;
inherit (lib.my) naiveIPv4Gateway homeStateVersion mkOpt' mkBoolOpt' mkDefault' commonOpts inlineModule';
cfg = config.nixos;
@ -50,7 +50,10 @@ let
};
system.name = name;
networking.hostName = mkDefault (config'.assignments.internal.name or name);
networking = {
domain = let d = config'.assignments.internal.domain; in mkIf (d != null) (mkDefault' d);
hostName = mkDefault (config'.assignments.internal.name or name);
};
nixpkgs = {
inherit (config') system;
# Make sure any previously set overlays (e.g. lib which will be inherited by home-manager down the
@ -94,6 +97,7 @@ let
name = mkOpt' str name "Name of assignment.";
altNames = mkOpt' (listOf str) [ ] "Extra names to assign.";
visible = mkBoolOpt' true "Whether or not this assignment should be visible.";
domain = mkOpt' (nullOr str) null "Domain for this assignment.";
ipv4 = {
address = mkOpt' str null "IPv4 address.";
mask = mkOpt' ints.u8 24 "Network mask.";