From 1fc5d125fb14835ee12122395adb85b26c8f732e Mon Sep 17 00:00:00 2001 From: Lauren Yim <31467609+cherryblossom000@users.noreply.github.com> Date: Mon, 12 Jun 2023 16:08:03 +1000 Subject: [PATCH] docs: clarify how to use inputs with flakes This commit clarifies that in order to access `inputs` in a host configuration, the `inputs` argument must be used. This commit also documents how `specialArgs` can be used to access the inputs as arguments directly. --- README.md | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 87a9786f..e7865e37 100644 --- a/README.md +++ b/README.md @@ -94,15 +94,30 @@ A minimal example of using an existing configuration.nix: } ``` -Inputs from the flake can also be passed to `darwinSystem`, these inputs are then -accessible as an argument, similar to pkgs and lib inside the configuration. +Inputs from the flake can also be passed to `darwinSystem`. These inputs are then +accessible as an argument `inputs`, similar to `pkgs` and `lib`, inside the configuration. ```nix darwin.lib.darwinSystem { system = "x86_64-darwin"; - modules = [ ... ]; + modules = [ ./configuration.nix ]; inputs = { inherit darwin dotfiles nixpkgs; }; } +# in configuration.nix: +{ pkgs, lib, inputs }: +# inputs.darwin, inputs.dotfiles, and inputs.nixpkgs can be accessed here +``` + +Alternatively, `specialArgs` could be used: + +```nix +darwin.lib.darwinSystem { + system = "x86_64-darwin"; + modules = [ ./configuration.nix ]; + specialArgs = { inherit darwin dotfiles nixpkgs; }; +} +# in configuration.nix: +{ pkgs, lib, darwin, dotfiles, nixpkgs }: ``` Since the installer doesn't work with flakes out of the box yet, nix-darwin will need to