From d516531e9cd9f3bbc761e0928efd5564624b7262 Mon Sep 17 00:00:00 2001 From: Jean-Paul Calderone <exarkun@twistedmatrix.com> Date: Mon, 28 Oct 2019 11:44:01 -0400 Subject: [PATCH] Parameterize the hostId so it can easily vary from node to node --- morph/make-storage.nix | 2 -- morph/storage001-config.nix | 3 ++- nixos/modules/100tb.nix | 6 ++++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/morph/make-storage.nix b/morph/make-storage.nix index 85c3e315..768cdb55 100644 --- a/morph/make-storage.nix +++ b/morph/make-storage.nix @@ -38,8 +38,6 @@ ../nixos/modules/private-storage.nix ]; - networking.hostId = "00000001"; - # Pass the configuration specific to this host to the 100TB module to be # expanded into a complete system configuration. See the 100tb module for # handling of this value. diff --git a/morph/storage001-config.nix b/morph/storage001-config.nix index 2c4cd767..2e6e2154 100644 --- a/morph/storage001-config.nix +++ b/morph/storage001-config.nix @@ -1,4 +1,5 @@ -{ "interface" = "eno1"; +{ "hostId" = "00000001"; + "interface" = "eno1"; "publicIPv4" = "176.113.72.38"; "prefixLength" = 30; "gateway" = "176.113.72.37"; diff --git a/nixos/modules/100tb.nix b/nixos/modules/100tb.nix index 243da0dd..b56bd06e 100644 --- a/nixos/modules/100tb.nix +++ b/nixos/modules/100tb.nix @@ -32,6 +32,11 @@ let # values. This value is in the `let` to make the code below a little easier # to read. See below where we use it. options = { + hostId = lib.mkOption + { type = lib.types.str; + example = lib.literalExample "abcdefgh"; + description = "The 32-bit host ID of the machine, formatted as 8 hexadecimal characters."; + }; interface = lib.mkOption { type = lib.types.str; example = lib.literalExample "eno0"; @@ -113,6 +118,7 @@ in { cfg.rootPublicKey ]; + networking.hostId = cfg.hostId; networking.dhcpcd.enable = false; networking.interfaces = { "${cfg.interface}".ipv4.addresses = [ -- GitLab