diff --git a/hosts/cube/default.nix b/hosts/cube/default.nix index 2da2b01..82a1aa7 100644 --- a/hosts/cube/default.nix +++ b/hosts/cube/default.nix @@ -4,8 +4,6 @@ system.stateVersion = "23.05"; nixpkgs.hostPlatform = "x86_64-linux"; - networking.domain = "rgbcu.be"; - secrets.rgbPassword.file = ./password.rgb.age; users.users = { @@ -30,6 +28,12 @@ ||----w | || || ''; + + networking = { + ipv4 = "5.255.78.70"; + + domain = "rgbcu.be"; + }; }) (homeConfiguration { diff --git a/hosts/cube/restic/default.nix b/hosts/cube/restic/default.nix index 939684e..eaca715 100644 --- a/hosts/cube/restic/default.nix +++ b/hosts/cube/restic/default.nix @@ -7,7 +7,7 @@ systemConfiguration { passwordFile = config.secrets.resticPassword.path; initialize = true; - repository = "sftp:backup@disk:cube-varlib"; + repository = "sftp:backup@${self.disk.networking.ipv4}:cube-varlib"; paths = [ "/var/lib" ]; diff --git a/hosts/disk/default.nix b/hosts/disk/default.nix index 4ea008a..51ccc4b 100644 --- a/hosts/disk/default.nix +++ b/hosts/disk/default.nix @@ -4,8 +4,6 @@ system.stateVersion = "23.11"; nixpkgs.hostPlatform = "x86_64-linux"; - networking.domain = "rgbcu.be"; - secrets.floppyPassword.file = ./password.floppy.age; users.users = { @@ -25,17 +23,22 @@ }; networking = { + ipv4 = "23.164.232.40"; + ipv6 = "2602:f9f7::40"; + + domain = "rgbcu.be"; + defaultGateway = "23.164.232.1"; defaultGateway6 = "2602:f9f7::1"; interfaces.ens32 = { ipv4.addresses = [{ - address = "23.164.232.40"; + address = config.networking.ipv4; prefixLength = 25; }]; ipv6.addresses = [{ - address = "2602:f9f7::40"; + address = config.networking.ipv6; prefixLength = 64; }]; }; diff --git a/modules/ssh.nix b/modules/ssh.nix index cf6697d..76feb7b 100644 --- a/modules/ssh.nix +++ b/modules/ssh.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, ... }: with lib; merge +{ self, lib, pkgs, ... }: with lib; merge (desktopSystemPackages (with pkgs; [ mosh @@ -20,13 +20,13 @@ }; cube = { - hostname = "5.255.78.70"; + hostname = self.cube.networking.ipv4; user = "rgb"; port = 2222; }; disk = { - hostname = "23.164.232.40"; + hostname = self.disk.networking.ipv4; user = "floppy"; port = 2222; }; diff --git a/options/ip.nix b/options/ip.nix new file mode 100644 index 0000000..8be82bc --- /dev/null +++ b/options/ip.nix @@ -0,0 +1,4 @@ +{ lib, ... }: { + options.networking.ipv4 = lib.mkValue null; + options.networking.ipv6 = lib.mkValue null; +}