From f0dca820e77f3e86d6a0bbedccdb2731a53364bc Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Thu, 15 Jul 2021 10:02:48 -0400 Subject: [PATCH] Break the networking.hostName tie in hardware-aws Using AWS is what causes it so using AWS can be what fixes it, too. --- morph/grid/production/grid.nix | 6 ++---- morph/grid/testing/grid.nix | 10 ++++------ morph/grid/testing/testing001-hardware.nix | 10 ---------- morph/lib/issuer-aws.nix | 17 +++++++++++------ 4 files changed, 17 insertions(+), 26 deletions(-) diff --git a/morph/grid/production/grid.nix b/morph/grid/production/grid.nix index 52a96040..3fa9e287 100644 --- a/morph/grid/production/grid.nix +++ b/morph/grid/production/grid.nix @@ -21,8 +21,7 @@ let }; }; - payments = {name, ...}: { - networking.hostName = name; + payments = { imports = [ gridlib.issuer gridlib.hardware-aws @@ -33,8 +32,7 @@ let ]; }; - monitoring = {name, ...}: { - networking.hostName = name; + monitoring = { imports = [ gridlib.monitoring gridlib.hardware-aws diff --git a/morph/grid/testing/grid.nix b/morph/grid/testing/grid.nix index 1534f08c..85cbe540 100644 --- a/morph/grid/testing/grid.nix +++ b/morph/grid/testing/grid.nix @@ -21,8 +21,7 @@ let }; }; - payments = {name, ...}: { - networking.hostName = name; + payments = { imports = [ gridlib.issuer gridlib.hardware-aws @@ -33,10 +32,10 @@ let ]; }; - storage001 = {name, ...}: { - networking.hostName = name; + storage001 = { imports = [ gridlib.storage + gridlib.hardware-aws ./testing001-hardware.nix (gridlib.customize-storage (config // { monitoringvpnIPv4 = "172.23.23.12"; @@ -46,8 +45,7 @@ let ]; }; - monitoring = {name, ...}: { - networking.hostName = name; + monitoring = { imports = [ gridlib.monitoring gridlib.hardware-aws diff --git a/morph/grid/testing/testing001-hardware.nix b/morph/grid/testing/testing001-hardware.nix index b57f193a..5dceb16a 100644 --- a/morph/grid/testing/testing001-hardware.nix +++ b/morph/grid/testing/testing001-hardware.nix @@ -1,14 +1,4 @@ { - imports = [ <nixpkgs/nixos/modules/virtualisation/amazon-image.nix> ]; - ec2.hvm = true; - boot.kernel.sysctl = { "vm.swappiness" = 0; }; - swapDevices = [ { - device = "/var/swapfile"; - size = 8192; # megabytes - randomEncryption = true; - } ]; - - boot.supportedFilesystems = [ "zfs" ]; networking.hostId = "10000000"; diff --git a/morph/lib/issuer-aws.nix b/morph/lib/issuer-aws.nix index 3febd796..16db454e 100644 --- a/morph/lib/issuer-aws.nix +++ b/morph/lib/issuer-aws.nix @@ -1,10 +1,5 @@ -{ lib, ... }: { +{ name, lib, ... }: { imports = [ <nixpkgs/nixos/modules/virtualisation/amazon-image.nix> ]; - - # amazon-image.nix isn't quite aware of nvme-attached storage so give it a - # little help configuring grub. - boot.loader.grub.device = lib.mkForce "/dev/nvme0n1"; - ec2.hvm = true; boot.kernel.sysctl = { "vm.swappiness" = 0; }; swapDevices = [ { @@ -12,4 +7,14 @@ size = 8192; # megabytes randomEncryption = true; } ]; + + # Break the tie between AWS and morph for the hostname by forcing the + # morph-supplied name. See also + # <https://github.com/DBCDK/morph/issues/146>. + networking.hostName = name; + + # amazon-image.nix isn't quite aware of nvme-attached storage so give it a + # little help configuring grub. + boot.loader.grub.device = lib.mkForce "/dev/nvme0n1"; + } -- GitLab