-
Couldn't load subscription status.
- Fork 31
Open
Description
When I use this kind of expression:
{
description = i.description or "";
}statix throws warning:
[W04] Warning: Assignment instead of inherit from
╭─[./lib/users.nix:11:7]
│
11 │ description = i.description or "";
· ─────────────────┬────────────────
· ╰────────────────── This assignment is better written with inherit
────╯
When I got this warning for the first time, I thought I can use syntax like this:
{
inherit (i) description or "";
}However nix didn't evaluate throwing syntax error:
error: attribute '""' missing
at /nix/store/8ql1d9h3r74b0jmxk0kcxzswd9c9yh1x-source/lib/users.nix:11:34:
10| isNormalUser = true;
11| inherit (i) description or "";
| ^
12| # description = i.description or "";
which means, it's trying to lookup for key '""' inside i.
I have two guesses whether I'm missing some syntax knowledge in nix (which I'd love to and appreciate to know) or statix is judging based on first description = i.description ignoring or keyword next to it.
bahrom04
Metadata
Metadata
Assignees
Labels
No labels