nixos-config/lib/home-manager.nix

31 lines
792 B
Nix
Raw Normal View History

2023-12-19 09:59:55 +00:00
# Custom libraries for home-manager library.
{ lib }:
rec {
2023-12-19 09:59:55 +00:00
/*
Checks if there is the `osConfig` attribute and get the attribute path from
its system configuration.
*/
getOSConfigPath =
# The configuration attribute set of the home-manager configuration.
attrs:
# A list of strings representing the attribute path.
attrPath:
# The default value when `attrPath` is missing.
default:
attrs ? osConfig && lib.attrByPath attrPath default attrs;
/*
A quick function to check if the optional system module is enabled.
*/
hasOSModuleEnabled =
# The configuration attribute set of the home-manager configuration.
attrs:
# A list of strings representing the attribute path.
attrPath:
getOSConfigPath attrs attrPath false;
2023-12-19 09:59:55 +00:00
}