-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
# Module Arguments | ||
|
||
Each of your NixOS, nix-darwin and home-manager modules implicitly receive a [`specialArgs`](https://nixos.asia/en/nix-modules) called `flake`. | ||
|
||
The components of this `flake` attrset are: | ||
|
||
| Name | Description | | ||
| ---- | ----------- | | ||
| `inputs` | The `inputs` of your flake; `inputs.self` referring to the flake itself | | ||
| `config` | The flake-parts perSystem `config` | | ||
|
||
[Here](https://github.com/srid/nixos-config/blob/a420e5f531172aef753b07a411de8e254207f5c6/modules/darwin/default.nix#L2-L5) is an example of how these can be used: | ||
|
||
```nix | ||
{ flake, pkgs, lib, ... }: | ||
let | ||
inherit (flake) config inputs; | ||
inherit (inputs) self; | ||
in | ||
{ | ||
imports = [ | ||
# Reference a flake input directly from a nix-darwin module | ||
inputs.agenix.darwinModules.default | ||
]; | ||
# Reference an arbitrary flake-parts config | ||
home-manager.users.${config.me.username} = { }; | ||
} | ||
``` | ||
|
||
While the above example uses a nix-darwin module, you can do the same on NixOS or home-manager modules. |