After running niv init, statix check has a few suggestions for nix/sources.nix:
$ statix check
[bin/src/config.rs:79] [self.ignore.as_slice(), extra_ignores].concat() = []
[W19] Warning: This `if` expression can be simplified with `or`
╭─[./nix/sources.nix:38:7]
│
38 │ ╭─▶ if spec ? ref
44 │ ├─▶ else abort "In git source '${name}': Please specify `ref`, `tag` or `branch`!";
· │
· ╰─────────────────────────────────────────────────────────────────────────────────────────── Consider using spec.ref or (if spec ? branch
then "refs/heads/${spec.branch}"
else if spec ? tag
then "refs/tags/${spec.tag}"
else abort "In git source '${name}': Please specify ref, tag or branch!") instead of this if expression
────╯
[W19] Warning: This `if` expression can be simplified with `or`
╭─[./nix/sources.nix:46:7]
│
46 │ ╭─▶ if spec ? submodules
48 │ ├─▶ else false;
· │
· ╰─────────────────────── Consider using spec.submodules or false instead of this if expression
────╯
[W01] Warning: Unnecessary comparison with boolean
╭─[./nix/sources.nix:52:12]
│
52 │ if submodules == true
· ─────────┬────────
· ╰────────── Comparing submodules with boolean literal true
────╯
[W13] Warning: Found usage of deprecated builtin isNull
╭─[./nix/sources.nix:143:10]
│
143 │ if isNull (builtins.match "[a-zA-Z0-9]" c)
· ───────────────────┬───────────────────
· ╰───────────────────── isNull is deprecated, check equality with null instead
─────╯
[W13] Warning: Found usage of deprecated builtin isNull
╭─[./nix/sources.nix:201:59]
│
201 │ then fetchTarball ({inherit url;} // (optionalAttrs (!isNull name) {inherit name;}))
· ─────┬─────
· ╰─────── isNull is deprecated, check equality with null instead
─────╯
[W13] Warning: Found usage of deprecated builtin isNull
╭─[./nix/sources.nix:213:55]
│
213 │ then fetchurl ({inherit url;} // (optionalAttrs (!isNull name) {inherit name;}))
· ─────┬─────
· ╰─────── isNull is deprecated, check equality with null instead
─────╯
[W13] Warning: Found usage of deprecated builtin isNull
╭─[./nix/sources.nix:235:10]
│
235 │ if isNull sourcesFile
· ─────────┬────────
· ╰────────── isNull is deprecated, check equality with null instead
─────╯
There might be excellent reasons for these (such as backwards compatibility), but since I couldn't find them in the issue tracker I thought they would be worth mentioning.
After running
niv init
,statix check
has a few suggestions fornix/sources.nix
:There might be excellent reasons for these (such as backwards compatibility), but since I couldn't find them in the issue tracker I thought they would be worth mentioning.