Skip to content

Commit 5740d1b

Browse files
committed
Add options type called codeMirrorLines
1 parent b286790 commit 5740d1b

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

modules/kernels/ruby/module.nix

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ in
5959

6060
lsp.solargraph.rubocopYaml = mkOption {
6161
example = "YAML configuration for the rubocop reporter";
62-
type = types.lines;
62+
type = types.codeMirrorLines "yaml";
6363
default = ''
6464
# Disable whitespace-related rules that don't play well with notebooks
6565
Layout/EmptyLines:

nix/convert-type.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ let
44
convertType = target: type:
55
if (type.name == "str") then { type = "string"; }
66
else if (type.name == "separatedString") then { type = "lines"; }
7+
else if (type.name == "codeMirrorLines") then { type = "lines"; codeMirrorMode = type.codeMirrorMode; }
78
else if (type.name == "anything") then { type = "any"; }
89
else if (type.name == "bool") then { type = "boolean"; }
910
else if (type.name == "attrs") then {

nix/evaluate-config.nix

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,24 @@
77

88
config:
99

10-
lib.evalModules {
10+
let
11+
extendedLib = lib.extend (final: prev: {
12+
types = prev.types // {
13+
codeMirrorLines = mode: prev.mkOptionType {
14+
name = "codeMirrorLines";
15+
description = "string (${mode})";
16+
check = builtins.isString;
17+
merge = prev.options.mergeEqualOption;
18+
} // { codeMirrorMode = mode; };
19+
};
20+
});
21+
22+
in
23+
24+
extendedLib.evalModules {
1125
specialArgs = {
26+
lib = extendedLib;
27+
1228
nixosOptionsToSettingsSchema = pkgsStable.callPackage ./nixos-options-to-settings-schema.nix {};
1329
boilerplate = {
1430
attrsTitle = "Notebook attributes";

0 commit comments

Comments
 (0)