Skip to content

Commit 6d9506b

Browse files
authored
fix(wrapperModules.niri): scheduled removal of deprecation warning (#557)
v2-settings is now the only version
1 parent e72bd9c commit 6d9506b

1 file changed

Lines changed: 19 additions & 85 deletions

File tree

wrapperModules/n/niri/module.nix

Lines changed: 19 additions & 85 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,6 @@
66
...
77
}:
88
let
9-
# deprecates `{ _attrs = ??; ... }` and `null` to `_: { props = ??; content = ...; }` and `_: {}` respectively
10-
# remove on June 1, 2026
11-
convertAndWarn =
12-
let
13-
endOfWarningMessage = "\n" + ''
14-
Warning will be removed on June 1, 2026,
15-
but you can remove this deprecation layer ahead of time
16-
after fixing your configuration by setting `v2-settings = true`.
17-
'';
18-
recurse =
19-
path: v:
20-
if builtins.isAttrs v then
21-
let
22-
hasAttrs = v ? _attrs;
23-
rest = lib.removeAttrs v [ "_attrs" ];
24-
processedRest = lib.mapAttrs (n: val: recurse (path ++ [ n ]) val) rest;
25-
in
26-
if hasAttrs then
27-
lib.warn
28-
(
29-
"wrapperModules.niri: Deprecated `{ _attrs = ??; ... }` at ${lib.concatStringsSep "." path}. Use `_: { props = ??; content = ...; }` instead."
30-
+ endOfWarningMessage
31-
)
32-
(_: {
33-
props = recurse (path ++ [ "_attrs" ]) v._attrs;
34-
content = processedRest;
35-
})
36-
else
37-
processedRest
38-
else if builtins.isList v && builtins.all builtins.isAttrs v then
39-
map (i: recurse (path ++ [ "[${toString i}]" ]) i) v
40-
else if v == null then
41-
lib.warn (
42-
"wrapperModules.niri: Deprecated `null` at ${lib.concatStringsSep "." path}. Use `_: {}` instead."
43-
+ endOfWarningMessage
44-
) (_: { })
45-
else
46-
v;
47-
in
48-
if config.v2-settings then v: v else v: recurse [ ] v;
49-
509
mkRule =
5110
# "window-rules" "layer-rules"
5211
node: r:
@@ -106,33 +65,16 @@ in
10665

10766
options = {
10867
v2-settings = lib.mkOption {
109-
type = lib.types.bool;
110-
default = false;
111-
description = ''
112-
If you have converted your configuration from the old version of the niri module's kdl translation to the new one already,
113-
you may set this to true to stop it from checking for the old version.
114-
115-
On July 1, 2026, when that version is removed, this option will warn that it no longer has any effect.
116-
117-
The change was as follows:
118-
119-
For doing
120-
121-
```kdl
122-
node "some" "args" "y"=100 {
123-
}
124-
```
125-
126-
`{ _attrs = ??; ... }` was changed to `_: { props = ??; content = ...; }`
127-
128-
And in the context of declaring a node which is just a name with no children or props:
129-
130-
`null` was changed to `_: {}` because `null` is an actual value you may want to provide.
131-
132-
Functions were the only type of value we could not translate.
133-
134-
The argument to the function is provided by calling the function with `lib.fix`.
135-
'';
68+
type = lib.types.nullOr lib.types.bool;
69+
default = null;
70+
internal = true;
71+
apply =
72+
x:
73+
lib.warnIf (x != null) ''
74+
nix-wrapper-modules niri v2-settings option no longer has any effect!
75+
`v2-settings == true` is now the default behaviour, and the deprecations for v1 have been removed.
76+
You should remove `v2-settings = true` from your config, this option will be removed in a future version.
77+
'';
13678
};
13779
settings = lib.mkOption {
13880
description = ''
@@ -150,7 +92,6 @@ in
15092
default = { };
15193
type = wlib.types.attrsRecursive;
15294
description = "Bindings of niri";
153-
apply = convertAndWarn;
15495
example = lib.literalMD ''
15596
```nix
15697
binds = {
@@ -170,7 +111,6 @@ in
170111
default = { };
171112
type = wlib.types.attrsRecursive;
172113
description = "Layout definitions";
173-
apply = convertAndWarn;
174114
example = lib.literalMD ''
175115
```nix
176116
layout = {
@@ -218,7 +158,6 @@ in
218158
default = [ ];
219159
type = lib.types.listOf lib.types.attrs;
220160
description = "List of window rules";
221-
apply = convertAndWarn;
222161
example = [
223162
{
224163
matches = [ { app-id = ".*"; } ];
@@ -234,7 +173,6 @@ in
234173
default = [ ];
235174
type = lib.types.listOf lib.types.attrs;
236175
description = "List of layer rules";
237-
apply = convertAndWarn;
238176
example = [
239177
{
240178
matches = [ { namespace = "^notifications$"; } ];
@@ -247,7 +185,6 @@ in
247185
default = { };
248186
type = lib.types.attrsOf (lib.types.nullOr lib.types.anything);
249187
description = "Named workspace definitions";
250-
apply = convertAndWarn;
251188
example = lib.literalMD ''
252189
```nix
253190
workspaces = {
@@ -263,7 +200,6 @@ in
263200
default = { };
264201
type = wlib.types.attrsRecursive;
265202
description = "Output configuration";
266-
apply = convertAndWarn;
267203
example = lib.literalMD ''
268204
```nix
269205
{
@@ -401,17 +337,15 @@ in
401337
(attrAsArg "workspace" config.settings.workspaces)
402338
(attrAsArg "output" config.settings.outputs)
403339
[
404-
(convertAndWarn (
405-
lib.removeAttrs config.settings [
406-
"window-rules"
407-
"layer-rules"
408-
"spawn-at-startup"
409-
"spawn-sh-at-startup"
410-
"workspaces"
411-
"outputs"
412-
"extraConfig"
413-
]
414-
))
340+
(lib.removeAttrs config.settings [
341+
"window-rules"
342+
"layer-rules"
343+
"spawn-at-startup"
344+
"spawn-sh-at-startup"
345+
"workspaces"
346+
"outputs"
347+
"extraConfig"
348+
])
415349
]
416350
config.extraSettings
417351
];

0 commit comments

Comments
 (0)