Commit a6baacd

HPCesia <me@hpcesia.com>
2025-09-30 08:07:50
feat: host metas
1 parent e29ef84
Changed files (2)
modules
modules/flake/meta.nix
@@ -1,9 +1,38 @@
 {lib, ...}: {
-  options.flake.meta = lib.mkOption {
-    type = lib.types.submodule {
-      freeformType = lib.types.lazyAttrsOf lib.types.anything;
+  options.flake.meta = let
+    inherit (lib) mkOption types;
+
+    hostsOption = {
+      prefix = mkOption {
+        type = types.str;
+        default = "host/";
+        description = "Prefix for the host";
+      };
+      hosts = mkOption {
+        type = types.attrsOf perHostOption;
+        default = {};
+        description = "Metas for each host";
+      };
+    };
+
+    perHostOption = types.submodule {
+      options = {
+        system = mkOption {
+          type = types.nonEmptyStr;
+          description = "System of the host.";
+          example = "x86_64-linux";
+        };
+      };
+    };
+  in
+    mkOption {
+      type = types.submodule {
+        freeformType = types.lazyAttrsOf types.anything;
+        options = {
+          host = hostsOption;
+        };
+      };
     };
-  };
 
   config.flake.meta.uri = "github:HPCesia/nix-config";
 }
modules/hosts/prefix.nix
@@ -0,0 +1,3 @@
+{
+  flake.meta.host.prefix = "hosts/";
+}