Skip to content

Commit

Permalink
Get rid of evalString stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasjm committed Dec 5, 2024
1 parent 3acb398 commit e1b2604
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions nix/nixos-options-to-settings-schema.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,13 @@ options:
let
convert = v: let
convertType = import ./convert-type.nix args;
evalString = str: builtins.scopedImport {} (builtins.toFile "expr.nix" str);

convertDefaultValue = value:
if value._type == "literalExpression" then evalString value.text
else builtins.throw "Can't handle this default value: ${toString value}.";

defaultItem = { type = { name = "unknown"; }; };
loc = lib.drop componentsToDrop v.loc;

value = { inherit loc; }
// convertType v.name (lib.attrByPath loc defaultItem options).type
// lib.optionalAttrs (lib.hasAttr "default" v) { defaultValue = convertDefaultValue v.default; }
// lib.optionalAttrs (lib.hasAttr "default" v) { defaultValue = (lib.attrByPath loc null options).default; }
// (let example = (lib.attrByPath loc null options).example or null; in lib.optionalAttrs (builtins.typeOf example == "string") { title = example; })
// lib.optionalAttrs (lib.hasAttr "description" v && builtins.typeOf v.description == "string") { inherit (v) description; }
// lib.optionalAttrs (lib.hasAttr "visible" v && v.visible == false) { hidden = true; };
Expand Down

0 comments on commit e1b2604

Please sign in to comment.