about summary refs log tree commit diff
path: root/lib/my.nix
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--lib/my.nix103
1 files changed, 50 insertions, 53 deletions
diff --git a/lib/my.nix b/lib/my.nix
index 20f01be..e900519 100644
--- a/lib/my.nix
+++ b/lib/my.nix
@@ -1,66 +1,63 @@
 { lib, ... }:
-with lib;
-(evalModules {
+(lib.evalModules {
   modules = [
     {
-      options.configurations = mkOption {
+      options.configurations = lib.mkOption {
         description = "My configurations.";
-        type =
-          with types;
-          attrsOf (
-            submodule (
-              { name, ... }:
-              {
-                freeformType = attrs;
-                options =
-                  let
-                    mkConfigurationTypeOption =
-                      type:
-                      mkOption {
-                        description = "Whether the machine's functional type is a ${type} one.";
-                        type = bool;
-                        default = false;
-                      };
-                  in
-                  {
-                    hostname = mkOption {
-                      description = "The machine's hostname.";
-                      type = str;
-                      default = name;
-                      readOnly = true;
-                    };
-
-                    stateVersion = mkOption {
-                      description = "Machine's Nixpkgs state version.";
-                      type = str;
-                      default = trivial.release;
+        type = lib.types.attrsOf (
+          lib.types.submodule (
+            { name, ... }:
+            {
+              freeformType = lib.types.attrs;
+              options =
+                let
+                  mkConfigurationTypeOption =
+                    type:
+                    lib.mkOption {
+                      description = "Whether the machine's functional type is a ${type} one.";
+                      type = lib.types.bool;
+                      default = false;
                     };
+                in
+                {
+                  hostname = lib.mkOption {
+                    description = "The machine's hostname.";
+                    type = lib.types.str;
+                    default = name;
+                    readOnly = true;
+                  };
 
-                    deviceIcon = mkOption {
-                      description = "Device icon to be used with nix-topology.";
-                      type = nullOr (either path str);
-                      default = null;
-                    };
+                  stateVersion = lib.mkOption {
+                    description = "Machine's Nixpkgs state version.";
+                    type = lib.types.str;
+                    default = lib.trivial.release;
+                  };
 
-                    system = mkOption {
-                      description = "The machine's system.";
-                      type = nullOr (enum platforms.all);
-                      default = null;
-                    };
+                  deviceIcon = lib.mkOption {
+                    description = "Device icon to be used with nix-topology.";
+                    type = with lib.types; nullOr (either path str);
+                    default = null;
+                  };
 
-                    isHeadless = mkConfigurationTypeOption "headless";
-                    isHeadful = mkConfigurationTypeOption "headful";
-                    isOther = mkConfigurationTypeOption "other";
+                  system = lib.mkOption {
+                    description = "The machine's system.";
+                    type = with lib.types; nullOr (enum lib.platforms.all);
+                    default = null;
                   };
-              }
-            )
-          );
+
+                  isHeadless = mkConfigurationTypeOption "headless";
+                  isHeadful = mkConfigurationTypeOption "headful";
+                  isOther = mkConfigurationTypeOption "other";
+                };
+            }
+          )
+        );
 
         default = { };
       };
 
       config = {
-        _module.freeformType = types.attrs;
+        _module.freeformType = lib.types.attrs;
 
         fullname = "Firstname Lastname";
         username = "azahi";
@@ -70,7 +67,7 @@ with lib;
           gondor = "gondor.net";
           shire = "shire.net";
         };
-        email = "frodo@${my.domain.gondor}";
+        email = "frodo@${lib.my.domain.gondor}";
         pgp = {
           key = "@PGP_KEY@";
           fingerprint = "@PGP_FINGERPRINT@";
@@ -78,7 +75,7 @@ with lib;
         };
         ssh = rec {
           type = "ed25519";
-          id = my.email;
+          id = lib.my.email;
           key = "ssh-${type} @PUBLIC_KEY@ ${id}";
         };
         hashedPassword = "@HASHED_PASSWORD@";
@@ -105,7 +102,7 @@ with lib;
               ipv6.address = "fd69::0:1";
               publicKey = "@PUBLIC_KEY@";
             };
-            domains = with my.domain; [
+            domains = with lib.my.domain; [
               "alertmanager.${shire}"
               "frodo.${rohan}"
               "frodo.${gondor}"
@@ -174,7 +171,7 @@ with lib;
               ipv6.address = "fd69::1:2";
               publicKey = "@PUBLIC_KEY@";
             };
-            domains = with my.domain; [
+            domains = with lib.my.domain; [
               "flood.${shire}"
               "jackett.${shire}"
               "lidarr.${shire}"

Consider giving Nix/NixOS a try! <3