Skip to content

Commit

Permalink
Merge branch 'main' of github.com:codedownio/codedown-languages
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom McLaughlin committed Dec 5, 2024
2 parents 1fd1c3c + e1b2604 commit bd400e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 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
5 changes: 3 additions & 2 deletions tests/src/TestLib/TestSearchers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import qualified Data.List as L
import Data.String.Interpolate
import Data.Text as T
import qualified Data.Text.IO as T
import GHC.Stack
import System.FilePath
import Test.Sandwich
import TestLib.TestBuilding
Expand All @@ -25,14 +26,14 @@ import UnliftIO.Process
-- Testing for successful build

testKernelSearchersBuild :: (
MonadIO m, MonadMask m, MonadUnliftIO m, MonadBaseControl IO m
HasCallStack, MonadIO m, MonadMask m, MonadUnliftIO m, MonadBaseControl IO m
, HasBaseContext context, HasBootstrapNixpkgs context
) => Text -> SpecFree context m ()
testKernelSearchersBuild kernel = it [i|#{kernel}: package searchers build|] $ do
void $ testBuild [i|kernels."#{kernel}".packageSearch|]

testHasExpectedFields :: (
MonadIO m, MonadMask m, MonadUnliftIO m, MonadBaseControl IO m
HasCallStack, MonadIO m, MonadMask m, MonadUnliftIO m, MonadBaseControl IO m
, HasBaseContext context, HasBootstrapNixpkgs context
) => Text -> SpecFree context m ()
testHasExpectedFields kernel = it [i|#{kernel}: has expected fields|] $ do
Expand Down

0 comments on commit bd400e8

Please sign in to comment.