diff --git a/deployment/flake-part.nix b/deployment/flake-part.nix index 7d2a34f3..22158ee4 100644 --- a/deployment/flake-part.nix +++ b/deployment/flake-part.nix @@ -1,18 +1,6 @@ { inputs, self, ... }: let - vmIdTo03d = - id: - let - sid = toString id; - in - if id >= 0 && id <= 9 then - "00${sid}" - else if id >= 10 && id <= 99 then - "0${sid}" - else - sid; - allVmIds = # 100 -- 255 let allVmIdsFrom = x: if x > 255 then [ ] else [ x ] ++ allVmIdsFrom (x + 1); @@ -38,7 +26,7 @@ in in listToAttrs ( map (vmid: { - name = "fedi${vmIdTo03d vmid}"; + name = "fedi${toString vmid}"; value = makeProvisioningConfiguration vmid; }) allVmIds ); @@ -74,8 +62,8 @@ in type = providers.local.exec; imports = [ inputs.nixops4-nixos.modules.nixops4Resource.nixos ]; ssh.opts = ""; - ssh.host = "95.215.187.${vmIdTo03d vmid}"; - ssh.hostPublicKey = readFile ./hostKeys/fedi${vmIdTo03d vmid}/ssh_host_ed25519_key.pub; + ssh.host = "95.215.187.${toString vmid}"; + ssh.hostPublicKey = readFile ./hostKeys/fedi${toString vmid}/ssh_host_ed25519_key.pub; nixpkgs = inputs.nixpkgs; nixos.module = { diff --git a/deployment/procolixVm.nix b/deployment/procolixVm.nix index 76efeb1d..5862de36 100644 --- a/deployment/procolixVm.nix +++ b/deployment/procolixVm.nix @@ -8,18 +8,6 @@ let inherit (lib) mkOption; inherit (lib.types) types; - - vmIdTo03d = - id: - let - sid = toString id; - in - if id >= 0 && id <= 9 then - "00${sid}" - else if id >= 10 && id <= 99 then - "0${sid}" - else - sid; in { @@ -30,7 +18,7 @@ in vmid = mkOption { type = types.int; description = '' - Identifier of the machine. This is a number between 10 and 255. + Identifier of the machine. This is a number between 100 and 255. ''; }; }; @@ -43,7 +31,7 @@ in services.openssh.enable = true; networking = { - hostName = "fedi${vmIdTo03d config.procolix.vmid}"; + hostName = "fedi${toString config.procolix.vmid}"; domain = "procolix.com"; interfaces = { @@ -51,7 +39,7 @@ in ipv4 = { addresses = [ { - address = "95.215.187.${vmIdTo03d config.procolix.vmid}"; + address = "95.215.187.${toString config.procolix.vmid}"; prefixLength = 24; } ]; @@ -59,7 +47,7 @@ in ipv6 = { addresses = [ { - address = "2a00:51c0:13:1305::${vmIdTo03d config.procolix.vmid}"; + address = "2a00:51c0:13:1305::${toString config.procolix.vmid}"; prefixLength = 64; } ];