1
0
Fork 0
mirror of https://github.com/nix-community/home-manager synced 2024-12-24 02:39:48 +01:00

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:
name_snrl 2024-05-15 04:49:17 +05:00 committed by Robert Helgesson
parent 5dc2535656
commit c2cd2a52e0
No known key found for this signature in database
GPG key ID: 96E745BD17AA17ED

View file

@ -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;
};
};
}