NixOS modules: Difference between revisions
VTimofeenko (talk | contribs) →Function: expand the description of the module arguments |
→With Flakes: fix? typo and typesetting; idk what {{|c|nixos-rebuild}} was intended to be |
||
| (One intermediate revision by the same user not shown) | |||
| Line 360: | Line 360: | ||
The module system itself is rather complex, but here's a short overview. A module evaluation consists of a set of "modules", which can do three things: | The module system itself is rather complex, but here's a short overview. A module evaluation consists of a set of "modules", which can do three things: | ||
* Import other modules (through imports = [ ./other-module.nix ]) | * Import other modules (through <code>imports = [ ./other-module.nix ]</code>) | ||
* Declare options (through options = { ... }) | * Declare options (through <code>options = { ... }</code>) | ||
* Define option values (through | * Define option values (through <code>config = { ... }</code>, or without the config key as a shorthand if you don't have imports or options) | ||
To do the actual evaluation, there's these rough steps: | To do the actual evaluation, there's these rough steps: | ||
| Line 409: | Line 409: | ||
If you want to develop a module from a git repo, you can use `--override-input`. For example, if you have an input in your flake called {{ic|jovian}},, you can use | If you want to develop a module from a git repo, you can use `--override-input`. For example, if you have an input in your flake called {{ic|jovian}},, you can use | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
nixos-rebuild switch --override-input jovian <path-to-url> | nixos-rebuild switch --override-input jovian <path-to-url> --flake <uri> | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Of course, it doesn't have to | Of course, it doesn't have to [[nixos-rebuild|<code>nixos-rebuild</code>]] in particular. | ||
== References == | == References == | ||