25 Sep 2024 |
| luna-null changed their display name from luna-null to Autumn. | 06:39:16 |
| @brian:bmcgee.ie left the room. | 08:38:01 |
30 Sep 2024 |
Matt Sturgeon | I'm getting weird and hard to reproduce issues when attempting to extend/override a type's merge function.
I ran into this a while back when extending coercedTo into a deprecation transition type.
I just ran into it again when attempting to remove a deprecated attr from a submodule's final value.
I've attempted to find a MRE, but in simple examples overriding the type's merge attr seems to behave as expected.
Have I found a nix bug? Or is there some other quirkiness going on here?
| 07:11:04 |
Matt Sturgeon | * I'm getting weird and hard to reproduce issues when attempting to extend/override an option-type's merge function.
I ran into this a while back when extending coercedTo into a deprecation transition type.
I just ran into it again when attempting to remove a deprecated attr from a submodule's final value.
I've attempted to find a MRE, but in simple examples overriding the type's merge attr seems to behave as expected.
Have I found a nix bug? Or is there some other quirkiness going on here?
| 07:11:21 |
Matt Sturgeon | My MRE attempt is producing the expected behavior:
nix-repl> (lib.modules.mergeDefinitions [] result.list-type' [ { file = "."; value = ["a"]; } { file = "."; value = ["b"]; } ]).mergedValue [ "a'" "b'" ]
nix-repl> (lib.modules.mergeDefinitions [] result.configuration.options.list'.type [ { file = "."; value = ["a"]; } { file = "."; value = ["b"]; } ]).mergedV[ "a'" "b'" ]
nix-repl> (lib.modules.mergeDefinitions [] result.attrs-type' [ { file = "."; value = { a = "a"; }; } { file = "."; value = { b = "b"; }; } ]).mergedValue { a = "a'"; b = "b'"; }
nix-repl> (lib.modules.mergeDefinitions [] result.configuration.options.attrs'.type [ { file = "."; value = { a = "a"; }; } { file = "."; value = { b = "b"; { a = "a'"; b = "b'"; }
So I'm struggling to understand why in #2342 I have issues where the the type behaves differently after being used in evalModules and/or listOf :
nix-repl> (lib.modules.mergeDefinitions [] lib.nixvim.keymaps.deprecatedMapOptionSubmodule [ { file = "."; value = {key = "a"; action = "b";}; } ]).mergedValue
{ action = "b"; key = "a"; mode = ""; options = { ... }; }
nix-repl> (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type.nestedTypes.elemType [ { file = "."; value ={ action = "b"; key = "a"; lua = «error: error:
… while evaluating the attribute 'value'
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `lua' was accessed but has no value defined. Try setting the option.»; mode = ""; options = { ... }; }
nix-repl> builtins.head (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type [ { file = "."; value = [{key = "a"; action = "b";}]; } { file = "."; value = [{ key = "c"; action = "d";}]; } ]).mergedValue
{ action = "b"; key = "a"; lua = «error: error:
… while evaluating the attribute 'value'
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `"[definition 1-entry 1]".lua' was accessed but has no value defined. Try setting the option.»; mode = ""; options = { ... }; }
NOTE: legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type.nestedTypes.elemType and lib.nixvim.keymaps.deprecatedMapOptionSubmodule should be the same thing, but one works correctly while the other does not.
| 07:37:44 |
Matt Sturgeon | * My MRE attempt is producing the expected behavior:
nix-repl> (lib.modules.mergeDefinitions [] result.list-type' [ { file = "."; value = ["a"]; } { file = "."; value = ["b"]; } ]).mergedValue
[ "a'" "b'" ]
nix-repl> (lib.modules.mergeDefinitions [] result.configuration.options.list'.type [ { file = "."; value = ["a"]; } { file = "."; value = ["b"]; } ]).mergedValue
[ "a'" "b'" ]
nix-repl> (lib.modules.mergeDefinitions [] result.attrs-type' [ { file = "."; value = { a = "a"; }; } { file = "."; value = { b = "b"; }; } ]).mergedValue
{ a = "a'"; b = "b'"; }
nix-repl> (lib.modules.mergeDefinitions [] result.configuration.options.attrs'.type [ { file = "."; value = { a = "a"; }; } { file = "."; value = { b = "b"; }; } ]).mergedValue
{ a = "a'"; b = "b'"; }
So I'm struggling to understand why in #2342 I have issues where the the type behaves differently after being used in evalModules and/or listOf :
nix-repl> (lib.modules.mergeDefinitions [] lib.nixvim.keymaps.deprecatedMapOptionSubmodule [ { file = "."; value = {key = "a"; action = "b";}; } ]).mergedValue
{ action = "b"; key = "a"; mode = ""; options = { ... }; }
nix-repl> (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type.nestedTypes.elemType [ { file = "."; value ={ action = "b"; key = "a"; lua = «error: error:
… while evaluating the attribute 'value'
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `lua' was accessed but has no value defined. Try setting the option.»; mode = ""; options = { ... }; }
nix-repl> builtins.head (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type [ { file = "."; value = [{key = "a"; action = "b";}]; } { file = "."; value = [{ key = "c"; action = "d";}]; } ]).mergedValue
{ action = "b"; key = "a"; lua = «error: error:
… while evaluating the attribute 'value'
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `"[definition 1-entry 1]".lua' was accessed but has no value defined. Try setting the option.»; mode = ""; options = { ... }; }
NOTE: legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type.nestedTypes.elemType and lib.nixvim.keymaps.deprecatedMapOptionSubmodule should be the same thing, but one works correctly while the other does not.
| 07:41:01 |
Matt Sturgeon | * My MRE attempt is producing the expected behavior:
nix-repl> (lib.modules.mergeDefinitions [] result.list-type' [ { file = "."; value = ["a"]; } { file = "."; value = ["b"]; } ]).mergedValue
[ "a'" "b'" ]
nix-repl> (lib.modules.mergeDefinitions [] result.configuration.options.list'.type [ { file = "."; value = ["a"]; } { file = "."; value = ["b"]; } ]).mergedValue
[ "a'" "b'" ]
nix-repl> (lib.modules.mergeDefinitions [] result.attrs-type' [ { file = "."; value = { a = "a"; }; } { file = "."; value = { b = "b"; }; } ]).mergedValue
{ a = "a'"; b = "b'"; }
nix-repl> (lib.modules.mergeDefinitions [] result.configuration.options.attrs'.type [ { file = "."; value = { a = "a"; }; } { file = "."; value = { b = "b"; }; } ]).mergedValue
{ a = "a'"; b = "b'"; }
So I'm struggling to understand why in #2342 I have issues where the the type behaves differently after being used in evalModules and/or listOf :
nix-repl> (lib.modules.mergeDefinitions [] lib.nixvim.keymaps.deprecatedMapOptionSubmodule [ { file = "."; value = {key = "a"; action = "b";}; } ]).mergedValue
{ action = "b"; key = "a"; mode = ""; options = { ... }; }
nix-repl> (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type.nestedTypes.elemType [ { file = "."; value ={ action = "b"; key = "a"; lua = «error: error:
… while evaluating the attribute 'value'
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `lua' was accessed but has no value defined. Try setting the option.»; mode = ""; options = { ... }; }
nix-repl> builtins.head (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type [ { file = "."; value = [{key = "a"; action = "b";}]; } { file = "."; value = [{ key = "c"; action = "d";}]; } ]).mergedValue
{ action = "b"; key = "a"; lua = «error: error:
… while evaluating the attribute 'value'
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `"[definition 1-entry 1]".lua' was accessed but has no value defined. Try setting the option.»; mode = ""; options = { ... }; }
NOTE: legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type.nestedTypes.elemType and lib.nixvim.keymaps.deprecatedMapOptionSubmodule should be the same thing, but one works correctly while the other does not.
EDIT: Accessing lib via special args also does not produce the issue (i.e. works correctly):
nix-repl> (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration._module.specialArgs.lib.nixvim.keymaps.deprecatedMapOptionSubmodule [ { file = "."; value = {key = "a"; action = "b";}; } ]).mergedValue
{ action = "b"; key = "a"; mode = ""; options = { ... }; }
| 07:45:01 |
Matt Sturgeon | * My MRE attempt is producing the expected behavior:
nix-repl> (lib.modules.mergeDefinitions [] result.list-type' [ { file = "."; value = ["a"]; } { file = "."; value = ["b"]; } ]).mergedValue
[ "a'" "b'" ]
nix-repl> (lib.modules.mergeDefinitions [] result.configuration.options.list'.type [ { file = "."; value = ["a"]; } { file = "."; value = ["b"]; } ]).mergedValue
[ "a'" "b'" ]
nix-repl> (lib.modules.mergeDefinitions [] result.attrs-type' [ { file = "."; value = { a = "a"; }; } { file = "."; value = { b = "b"; }; } ]).mergedValue
{ a = "a'"; b = "b'"; }
nix-repl> (lib.modules.mergeDefinitions [] result.configuration.options.attrs'.type [ { file = "."; value = { a = "a"; }; } { file = "."; value = { b = "b"; }; } ]).mergedValue
{ a = "a'"; b = "b'"; }
So I'm struggling to understand why in #2342 I have issues where the the type behaves differently after being used in evalModules and/or listOf :
nix-repl> (lib.modules.mergeDefinitions [] lib.nixvim.keymaps.deprecatedMapOptionSubmodule [ { file = "."; value = {key = "a"; action = "b";}; } ]).mergedValue
{ action = "b"; key = "a"; mode = ""; options = { ... }; }
nix-repl> (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type.nestedTypes.elemType [ { file = "."; value ={ action = "b"; key = "a"; lua = «error: error:
… while evaluating the attribute 'value'
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `lua' was accessed but has no value defined. Try setting the option.»; mode = ""; options = { ... }; }
nix-repl> builtins.head (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type [ { file = "."; value = [{key = "a"; action = "b";}]; } { file = "."; value = [{ key = "c"; action = "d";}]; } ]).mergedValue
{ action = "b"; key = "a"; lua = «error: error:
… while evaluating the attribute 'value'
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `"[definition 1-entry 1]".lua' was accessed but has no value defined. Try setting the option.»; mode = ""; options = { ... }; }
NOTE: legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type.nestedTypes.elemType and lib.nixvim.keymaps.deprecatedMapOptionSubmodule should be the same thing, but one works correctly while the other does not. The keymaps option is literally defined as:
keymaps = lib.mkOption {
type = lib.types.listOf helpers.keymaps.deprecatedMapOptionSubmodule;
# ...
}
EDIT: Accessing lib via special args also does not produce the issue (i.e. works correctly):
nix-repl> (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration._module.specialArgs.lib.nixvim.keymaps.deprecatedMapOptionSubmodule [ { file = "."; value = {key = "a"; action = "b";}; } ]).mergedValue
{ action = "b"; key = "a"; mode = ""; options = { ... }; }
| 07:48:54 |
Matt Sturgeon | * My MRE attempt is producing the expected behavior:
nix-repl> (lib.modules.mergeDefinitions [] result.list-type' [ { file = "."; value = ["a"]; } { file = "."; value = ["b"]; } ]).mergedValue
[ "a'" "b'" ]
nix-repl> (lib.modules.mergeDefinitions [] result.configuration.options.list'.type [ { file = "."; value = ["a"]; } { file = "."; value = ["b"]; } ]).mergedValue
[ "a'" "b'" ]
nix-repl> (lib.modules.mergeDefinitions [] result.attrs-type' [ { file = "."; value = { a = "a"; }; } { file = "."; value = { b = "b"; }; } ]).mergedValue
{ a = "a'"; b = "b'"; }
nix-repl> (lib.modules.mergeDefinitions [] result.configuration.options.attrs'.type [ { file = "."; value = { a = "a"; }; } { file = "."; value = { b = "b"; }; } ]).mergedValue
{ a = "a'"; b = "b'"; }
So I'm struggling to understand why in #2342 I have issues where the the type behaves differently after being used in evalModules and/or listOf :
nix-repl> (lib.modules.mergeDefinitions [] lib.nixvim.keymaps.deprecatedMapOptionSubmodule [ { file = "."; value = {key = "a"; action = "b";}; } ]).mergedValue
{ action = "b"; key = "a"; mode = ""; options = { ... }; }
nix-repl> (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type.nestedTypes.elemType [ { file = "."; value ={ action = "b"; key = "a"; lua = «error: error:
… while evaluating the attribute 'value'
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `lua' was accessed but has no value defined. Try setting the option.»; mode = ""; options = { ... }; }
nix-repl> builtins.head (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type [ { file = "."; value = [{key = "a"; action = "b";}]; } { file = "."; value = [{ key = "c"; action = "d";}]; } ]).mergedValue
{ action = "b"; key = "a"; lua = «error: error:
… while evaluating the attribute 'value'
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `"[definition 1-entry 1]".lua' was accessed but has no value defined. Try setting the option.»; mode = ""; options = { ... }; }
NOTE: legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type.nestedTypes.elemType and lib.nixvim.keymaps.deprecatedMapOptionSubmodule should be the same thing, but one works correctly while the other does not.
The keymaps option is literally defined as:
keymaps = lib.mkOption {
type = lib.types.listOf helpers.keymaps.deprecatedMapOptionSubmodule;
# ...
}
EDIT: Accessing lib via special args also does not produce the issue (i.e. works correctly):
nix-repl> (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration._module.specialArgs.lib.nixvim.keymaps.deprecatedMapOptionSubmodule [ { file = "."; value = {key = "a"; action = "b";}; } ]).mergedValue
{ action = "b"; key = "a"; mode = ""; options = { ... }; }
| 07:49:22 |
Matt Sturgeon | * My MRE attempt is producing the expected behavior:
nix-repl> (lib.modules.mergeDefinitions [] result.list-type' [ { file = "."; value = ["a"]; } { file = "."; value = ["b"]; } ]).mergedValue
[ "a'" "b'" ]
nix-repl> (lib.modules.mergeDefinitions [] result.configuration.options.list'.type [ { file = "."; value = ["a"]; } { file = "."; value = ["b"]; } ]).mergedValue
[ "a'" "b'" ]
nix-repl> (lib.modules.mergeDefinitions [] result.attrs-type' [ { file = "."; value = { a = "a"; }; } { file = "."; value = { b = "b"; }; } ]).mergedValue
{ a = "a'"; b = "b'"; }
nix-repl> (lib.modules.mergeDefinitions [] result.configuration.options.attrs'.type [ { file = "."; value = { a = "a"; }; } { file = "."; value = { b = "b"; }; } ]).mergedValue
{ a = "a'"; b = "b'"; }
So I'm struggling to understand why in #2342 I have issues where the the type behaves differently after being used in evalModules and/or listOf :
nix-repl> (lib.modules.mergeDefinitions [] lib.nixvim.keymaps.deprecatedMapOptionSubmodule [ { file = "."; value = {key = "a"; action = "b";}; } ]).mergedValue
{ action = "b"; key = "a"; mode = ""; options = { ... }; }
nix-repl> (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type.nestedTypes.elemType [ { file = "."; value ={ action = "b"; key = "a"; lua = «error: error:
… while evaluating the attribute 'value'
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `lua' was accessed but has no value defined. Try setting the option.»; mode = ""; options = { ... }; }
nix-repl> builtins.head (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type [ { file = "."; value = [{key = "a"; action = "b";}]; } { file = "."; value = [{ key = "c"; action = "d";}]; } ]).mergedValue
{ action = "b"; key = "a"; lua = «error: error:
… while evaluating the attribute 'value'
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:9:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
… while calling the 'addErrorContext' builtin
at /nix/store/fpivx4sjcp2vk4rp9nhliln5cwcp3kc6-source/lib/modules.nix:821:17:
820| in warnDeprecation opt //
821| { value = addErrorContext "while evaluating the option `${showOption loc}':" value;
| ^
822| inherit (res.defsFinal') highestPrio;
(stack trace truncated; use '--show-trace' to show the full trace)
error: The option `"[definition 1-entry 1]".lua' was accessed but has no value defined. Try setting the option.»; mode = ""; options = { ... }; }
NOTE: legacyPackages.x86_64-linux.nixvimConfiguration.options.keymaps.type.nestedTypes.elemType and lib.nixvim.keymaps.deprecatedMapOptionSubmodule should be the same thing, but one works correctly while the other does not.
The keymaps option is literally defined as:
keymaps = lib.mkOption {
type = lib.types.listOf lib.nixvim.keymaps.deprecatedMapOptionSubmodule;
# ...
}
EDIT: Accessing lib via special args also does not produce the issue (i.e. works correctly):
nix-repl> (lib.modules.mergeDefinitions [] legacyPackages.x86_64-linux.nixvimConfiguration._module.specialArgs.lib.nixvim.keymaps.deprecatedMapOptionSubmodule [ { file = "."; value = {key = "a"; action = "b";}; } ]).mergedValue
{ action = "b"; key = "a"; mode = ""; options = { ... }; }
| 07:49:46 |
1 Oct 2024 |
| -_o joined the room. | 21:03:34 |
2 Oct 2024 |
| cafkafk 🏳️⚧️ joined the room. | 12:19:06 |
4 Oct 2024 |
| terrorjack joined the room. | 17:38:04 |
7 Oct 2024 |
| Thunder joined the room. | 08:26:57 |
| Sam Lehman changed their profile picture. | 14:24:14 |
10 Oct 2024 |
| p4cmanus3r joined the room. | 13:24:45 |
11 Oct 2024 |
Sam Lehman | Are there any good writeups on using lib.types ?
I've gone through the manual, the nix.dev deep dive, and a bunch of other Nix module related posts, but nothing seems to cover the more advanced use cases of lib.types and submodules.
| 15:12:19 |
| Artturin joined the room. | 19:28:40 |
15 Oct 2024 |
| dish [Fox/It/She] joined the room. | 03:21:06 |
19 Oct 2024 |
| jwillikers joined the room. | 12:07:59 |
21 Oct 2024 |
| (artur 'manuel) changed their display name from (lambda (f l) (format nil "~a ~a")) "Artur" "Manuel" to (artur 'manuel). | 20:04:44 |
23 Oct 2024 |
| luna-null changed their display name from Autumn to luna-null. | 09:49:21 |
24 Oct 2024 |
| jopejoe1 set a profile picture. | 07:35:14 |
| dish [Fox/It/She] left the room. | 08:18:07 |