diff --git a/base.nix b/base.nix index b5f6c841..13c9e4b2 100644 --- a/base.nix +++ b/base.nix @@ -1,4 +1,4 @@ -{ config, pkgs, inputs, ... }: +{ config, lib, pkgs, inputs, values, ... }: { imports = [ @@ -8,6 +8,8 @@ networking.domain = "pvv.ntnu.no"; networking.useDHCP = false; networking.search = [ "pvv.ntnu.no" "pvv.org" ]; + networking.nameservers = lib.mkDefault [ "129.241.0.200" "129.241.0.201" ]; + networking.defaultGateway = values.gateway; services.resolved = { enable = true; diff --git a/flake.nix b/flake.nix index 75d91d2b..dc117256 100644 --- a/flake.nix +++ b/flake.nix @@ -22,7 +22,7 @@ nixosConfigurations = { jokum = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { inherit unstable inputs; }; + specialArgs = { inherit unstable inputs; values = import ./values.nix; }; modules = [ ./hosts/jokum/configuration.nix sops-nix.nixosModules.sops @@ -32,7 +32,7 @@ }; ildkule = nixpkgs.lib.nixosSystem { system = "x86_64-linux"; - specialArgs = { inherit unstable inputs; }; + specialArgs = { inherit unstable inputs; values = import ./values.nix; }; modules = [ ./hosts/ildkule/configuration.nix sops-nix.nixosModules.sops diff --git a/hosts/ildkule/configuration.nix b/hosts/ildkule/configuration.nix index d733751b..77037cb3 100644 --- a/hosts/ildkule/configuration.nix +++ b/hosts/ildkule/configuration.nix @@ -22,7 +22,6 @@ networking.interfaces.ens18.useDHCP = false; - networking.defaultGateway = "129.241.210.129"; networking.interfaces.ens18.ipv4 = { addresses = [ { @@ -39,7 +38,6 @@ } ]; }; - networking.nameservers = [ "129.241.0.200" "129.241.0.201" ]; # List packages installed in system profile environment.systemPackages = with pkgs; [ diff --git a/hosts/jokum/configuration.nix b/hosts/jokum/configuration.nix index f00a0472..a4dd8822 100644 --- a/hosts/jokum/configuration.nix +++ b/hosts/jokum/configuration.nix @@ -1,4 +1,4 @@ -{ config, pkgs, ... }: +{ config, pkgs, values, ... }: { imports = [ # Include the results of the hardware scan. @@ -27,16 +27,14 @@ networking.hostName = "jokum"; # Define your hostname. networking.interfaces.ens18.useDHCP = false; - - networking.defaultGateway = "129.241.210.129"; networking.interfaces.ens18.ipv4 = { addresses = [ { - address = "129.241.210.169"; + address = values.jokum.ipv4; prefixLength = 25; } { - address = "129.241.210.213"; + address = values.turn.ipv4; prefixLength = 25; } ]; @@ -44,16 +42,15 @@ networking.interfaces.ens18.ipv6 = { addresses = [ { - address = "2001:700:300:1900::169"; + address = values.jokum.ipv6; prefixLength = 64; } { - address = "2001:700:300:1900::213"; + address = values.turn.ipv6; prefixLength = 64; } ]; }; - networking.nameservers = [ "129.241.0.200" "129.241.0.201" ]; # List packages installed in system profile environment.systemPackages = with pkgs; [ diff --git a/values.nix b/values.nix new file mode 100644 index 00000000..e6cc7f8c --- /dev/null +++ b/values.nix @@ -0,0 +1,25 @@ +# Feel free to change the structure of this file + +rec { + gateway = "129.241.210.129"; + + + jokum = { + ipv4 = "129.241.210.169"; + ipv6 = "2001:700:300:1900::169"; + }; + matrix = { + ipv4 = jokum.ipv4; + ipv6 = jokum.ipv6; + }; + # Also on jokum + turn = { + ipv4 = "129.241.210.213"; + ipv6 = "2001:700:300:1900::213"; + }; + + ildkule = { + ipv4 = "129.241.210.187"; + ipv6 = "2001:700:300:1900::187"; + }; +}