docs(tips): add pitfalls section

Changed files
+59 -2
docs
+59 -2
docs/tips_n_tricks.md
···
*pointers by \@natsukagami*
-
# @ (at) syntax
+
## @ (at) syntax
very simple.
```nix
···
```
from [nixos wiki](https://nixos.wiki/wiki/Nginx#LEMP_stack)
-
# adding a package with an overlay to a package set
+
## adding a package with an overlay to a package set
for package sets with a scope, you will have to do something like
```nix
···
however i do not think that's the best way lol
+
# Common pitfalls
+
## importing nixpkgs with an empty attrset
+
+
ever had this in your flake.nix
+
+
```nix
+
{
+
outputs = { nixpkgs, ... }@inputs: let
+
pkgs = import nixpkgs {};
+
lib = nixpkgs.lib;
+
in {
+
# ...
+
};
+
}
+
```
+
+
... and got fucked with this?
+
```shell
+
error:
+
… while checking flake output 'nixosConfigurations'
+
+
at /nix/store/lz2ra1180qfffmpwg41jpyg1z602qdgx-source/flake.nix:50:5:
+
+
49| in {
+
50| nixosConfigurations = {
+
| ^
+
51| koumakan = (import ./systems/koumakan { inherit pkgs lib inputs; });
+
+
… while checking the NixOS configuration 'nixosConfigurations.koumakan'
+
+
at /nix/store/lz2ra1180qfffmpwg41jpyg1z602qdgx-source/flake.nix:51:7:
+
+
50| nixosConfigurations = {
+
51| koumakan = (import ./systems/koumakan { inherit pkgs lib inputs; });
+
| ^
+
52| };
+
+
(stack trace truncated; use '--show-trace' to show the full trace)
+
+
error: attribute 'currentSystem' missing
+
+
at /nix/store/5c0k827yjq7j24qaq8l2fcnsxp7nv8v1-source/pkgs/top-level/impure.nix:17:43:
+
+
16| # (build, in GNU Autotools parlance) platform.
+
17| localSystem ? { system = args.system or builtins.currentSystem; }
+
| ^
+
18|
+
```
+
+
just don't!!!11 remove the pkgs definition. (note that this only applies to `pkgs = import nixpkgs {};`)
+
+
### explanation
+
> you shouldn't ever really import nixpkgs with an empty attrset either
+
>
+
> that causes it to fall back on guessing your system using `builtins.currentSystem`,
+
> which is impure and so not allowed in pure evaluation mode
+
— \@getchoo
## Useful links
Builtin stdlib functions search engine: https://noogle.dev/