From 0e1d4e02ddb119faa087e30c4817f7624c874b19 Mon Sep 17 00:00:00 2001
From: Valentin Gagarin <valentin.gagarin@tweag.io>
Date: Wed, 2 Apr 2025 10:02:46 +0200
Subject: [PATCH] Revert "POC: render jsonschema as module in Nix"

This reverts commit f346002ab95f56c3a9f47b989efcf3f61b6d9d33.
---
 panel/nix/jsonschema-to-module.nix | 81 ------------------------------
 1 file changed, 81 deletions(-)
 delete mode 100644 panel/nix/jsonschema-to-module.nix

diff --git a/panel/nix/jsonschema-to-module.nix b/panel/nix/jsonschema-to-module.nix
deleted file mode 100644
index 4eb18ed9..00000000
--- a/panel/nix/jsonschema-to-module.nix
+++ /dev/null
@@ -1,81 +0,0 @@
-{ lib, ... }:
-
-let
-  inherit (lib)
-    fromJSON
-    mapAttrs
-    attrValues
-    concatStringsSep
-    elem
-    ;
-
-  option =
-    required: name: prop:
-    let
-      description =
-        if prop ? description then
-          ''
-            description = "${prop.description}";
-          ''
-        else
-          "";
-      default =
-        if (!elem name required && prop ? default) then
-          ''
-            default = ${to-value prop.type prop.description};
-          ''
-        else
-          "";
-
-      to-type =
-        type:
-        {
-          string = "str";
-          integer = "int";
-          boolean = "bool";
-        }
-        .${type} or (throw "Unsupported schema type: ${type}");
-
-      to-value =
-        type: value:
-        {
-          string = ''"${toString value}"'';
-          integer = toString value;
-          boolean = if value then "true" else "false";
-        }
-        .${type} or (throw "Unsupported value type: ${type}");
-    in
-    # TODO: squash
-    ''
-      ${name} = mkOption {
-        ${
-          # TODO: indent
-          description
-        }
-        type = types.${to-type prop.type};
-        ${
-          # TODO: indent
-          default
-        }
-      };
-    '';
-in
-jsonschema: name: # TODO: can't we get the name from the schema?
-let
-  schema = fromJSON jsonschema;
-  properties = schema.properties or { };
-  required = schema.required or [ ];
-  options = concatStringsSep "\n\n" (attrValues (mapAttrs (option required) properties));
-in
-# TODO: test this
-''
-  { lib, ... }:
-  let
-    inherit (lib) mkOption types;
-  in
-  {
-    options.services.${name} = {
-      ${options}
-    };
-  }
-''