* refactor: Inherit where possible
As recommended by `statix check`.
* refactor: Remove unnecessary parentheses
As recommended by `statix check`.
* refactor: Remove unnecessary comparison with `true`
As recommended by `statix check`.
* refactor: Avoid using deprecated `isNull`
As recommended by `statix check` and the documentation
<https://nixos.org/manual/nix/stable/language/builtins.html#builtins-isNull>.
* refactor: Simplify conditionals
As recommended by `statix check`.
* Update sources version
---------
Co-authored-by: Nicolas Mattia <nicolas@nmattia.com>
When combining Nix Flakes with niv, `builtins.currentSystem` is
disabled. This allows to bootstrap nixpkgs by passing the system from
the flake evaluation.
Instead, sources now record either `branch` or `tag`. The fetcher
specifies the correct ref (`/refs/heads/...` or `/refs/tags/...`) which
works in the newest version of Nix. The `ref` attribute can still be set
to override the logic.
This updates the sources.nix to replace the `outPath` field of package
`foo` with the content of envionment variable `NIV_OVERRIDE_foo`. In the
environment variable name, all characters outside of `[a-zA-Z0-9_]` are
escaped to `_`.
This changes the logic to make sure the first `if` branch -- which pulls nixpkgs from sources.json -- is evaluated first. Moreover the `<nixpkgs>` check is changed to avoid actually evaluating `<nixpkgs>`.
This turns `sources.nix` into a functor that acceps an argument:
``` nix
{ sourcesJson = <path/to/sources.json> ; }
```
The `sourcesJson` will be used instead of `./sources.json`.