submodule-support: add default values for top-level configs
This way the end user can easily check whether the home-manager
configuration is part of the module or not. Example of use:
```nix
{ lib, nixosConfig, ... }:
let
mkIfNixos = lib.mkIf nixosConfig != null;
in
{
programs.foot.enable = mkIfNixos true;
}
```
This commit is contained in:
parent
5dc2535656
commit
c2cd2a52e0
1 changed files with 15 additions and 0 deletions
|
|
@ -29,4 +29,19 @@ with lib;
|
|||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = {
|
||||
# To make it easier for the end user to override the values in the
|
||||
# configuration depending on the installation method, we set default values
|
||||
# for the arguments that are defined in the NixOS/nix-darwin modules.
|
||||
#
|
||||
# Without these defaults, these attributes would simply not exist, and the
|
||||
# module system can not inform modules about their non-existence; see
|
||||
# https://github.com/NixOS/nixpkgs/issues/311709#issuecomment-2110861842
|
||||
_module.args = {
|
||||
osConfig = mkDefault null;
|
||||
nixosConfig = mkDefault null;
|
||||
darwinConfig = mkDefault null;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue