about summary refs log tree commit diff
path: root/lib
diff options
context:
space:
mode:
authorAzat Bahawi <azat@bahawi.net>2022-12-17 16:39:09 +0300
committerAzat Bahawi <azat@bahawi.net>2022-12-17 16:39:09 +0300
commit8f137c28230623259a964484adcf31fe00756594 (patch)
tree82bce6a13fda125087cf6d9dc80aa91d9230d6c4 /lib
parent2022-11-20 (diff)
2022-12-17
Diffstat (limited to 'lib')
-rw-r--r--lib/default.nix2
-rw-r--r--lib/dns.nix2
-rw-r--r--lib/my.nix49
3 files changed, 40 insertions, 13 deletions
diff --git a/lib/default.nix b/lib/default.nix
index d121f5e..da4b4d2 100644
--- a/lib/default.nix
+++ b/lib/default.nix
@@ -1,7 +1,7 @@
 lib: _: rec {
   my = import ./my.nix lib;
 
-  dns = import ./dns.nix lib;
+  dns = import ./dns.nix;
 
   isEven = number:
     assert (builtins.isInt number) || (builtins.isFloat number);
diff --git a/lib/dns.nix b/lib/dns.nix
index e486f1c..5e1d767 100644
--- a/lib/dns.nix
+++ b/lib/dns.nix
@@ -1,4 +1,4 @@
-_: {
+{
   const = {
     quad9 = {
       default = ["9.9.9.9" "149.112.112.112" "2620:fe::fe" "2620:fe::9"];
diff --git a/lib/my.nix b/lib/my.nix
index f9c6a35..9b999a5 100644
--- a/lib/my.nix
+++ b/lib/my.nix
@@ -9,23 +9,36 @@ with lib;
             attrsOf (submodule ({name, ...}: {
               freeformType = attrs;
               options = let
+                mkConfigurationArchOption = type:
+                  mkOption {
+                    description = "Whether the machine's architecture is a ${type} one.";
+                    type = bool;
+                    default = false;
+                  };
+
                 mkConfigurationTypeOption = type:
                   mkOption {
-                    description = "Whether the machine is a ${type} one.";
+                    description = "Whether the machine's functional type is a ${type} one.";
                     type = bool;
                     default = false;
                   };
               in {
                 hostname = mkOption {
-                  description = "The machine's hostname";
+                  description = "The machine's hostname.";
                   type = str;
                   default = name;
                   readOnly = true;
                 };
+
                 system = mkOption {
-                  description = "The machine's system";
-                  type = enum ["x86_64-linux" "aarch64-linux"];
-                  default = "x86_64-linux";
+                  description = "The machine's system.";
+                  type = nullOr (enum [
+                    "aarch64-darwin"
+                    "aarch64-linux"
+                    "x86_64-darwin"
+                    "x86_64-linux"
+                  ]);
+                  default = null;
                 };
 
                 isHeadless = mkConfigurationTypeOption "headless";
@@ -39,12 +52,12 @@ with lib;
                     default = null;
                   };
                   prefixLength = mkOption {
-                    description = "The machine's IPv4 prefix length.";
+                    description = "The machine's public IPv4 prefix length.";
                     type = nullOr int;
                     default = null;
                   };
                   gatewayAddress = mkOption {
-                    description = "The machine's IPv4 gateway address.";
+                    description = "The machine's public IPv4 gateway address.";
                     type = nullOr str;
                     default = null;
                   };
@@ -56,12 +69,12 @@ with lib;
                     default = null;
                   };
                   prefixLength = mkOption {
-                    description = "The machine's IPv6 prefix length.";
+                    description = "The machine's public IPv6 prefix length.";
                     type = nullOr int;
                     default = null;
                   };
                   gatewayAddress = mkOption {
-                    description = "The machine's IPv6 gateway address.";
+                    description = "The machine's public IPv6 gateway address.";
                     type = nullOr str;
                     default = null;
                   };
@@ -74,7 +87,7 @@ with lib;
                     default = null;
                   };
                   ipv6.address = mkOption {
-                    description = "The machine's internal IPv4 addresses.";
+                    description = "The machine's internal IPv6 addresses.";
                     type = nullOr str;
                     default = null;
                   };
@@ -93,7 +106,7 @@ with lib;
                 # filtering for actual subdomains. We can remove this option
                 # altogether then.
                 domains = mkOption {
-                  description = "External domains that resovle to this address.";
+                  description = "External domains that resolve to this address.";
                   type = listOf str;
                   default = [];
                 };
@@ -171,7 +184,9 @@ with lib;
                 shire
               ];
             };
+
             varda = {
+              system = "x86_64-linux";
               isHeadless = true;
               ipv4 = {
                 gatewayAddress = "@IPV4_ADDRESS@";
@@ -189,7 +204,9 @@ with lib;
                 publicKey = "@PUBLIC_KEY@";
               };
             };
+
             yavanna = {
+              system = "x86_64-linux";
               isHeadless = true;
               ipv4 = {
                 gatewayAddress = "@IPV4_ADDRESS@";
@@ -209,7 +226,9 @@ with lib;
               domains = with my.domain; ["flood.${shire}"];
               syncthing.id = "@SYNCTHING_ID@";
             };
+
             eonwe = {
+              system = "x86_64-linux";
               isHeadful = true;
               wireguard = {
                 ipv4.address = "10.69.3.1";
@@ -218,7 +237,9 @@ with lib;
               };
               syncthing.id = "@SYNCTHING_ID@";
             };
+
             melian = {
+              system = "x86_64-linux";
               isHeadful = true;
               wireguard = {
                 ipv4.address = "10.69.4.1";
@@ -227,6 +248,12 @@ with lib;
               };
               syncthing.id = "@SYNCTHING_ID@";
             };
+
+            mairon = {
+              system = "aarch64-darwin";
+              isHeadful = true;
+            };
+
             gothmog = {
               isOther = true;
               wireguard = {

Consider giving Nix/NixOS a try! <3