2023-12-19 09:59:55 +00:00
|
|
|
# Custom libraries for home-manager library.
|
|
|
|
{ lib }:
|
|
|
|
|
2023-12-23 10:40:12 +00:00
|
|
|
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.
|
|
|
|
*/
|
2024-02-14 13:15:15 +00:00
|
|
|
hasNixOSConfigAttr =
|
2023-12-19 09:59:55 +00:00
|
|
|
# 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:
|
2024-02-14 13:15:15 +00:00
|
|
|
attrs ? nixosConfig && lib.attrByPath attrPath default attrs;
|
|
|
|
|
|
|
|
hasDarwinConfigAttr =
|
|
|
|
# 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 ? darwinConfig && lib.attrByPath attrPath default attrs;
|
2023-12-23 10:40:12 +00:00
|
|
|
|
|
|
|
/*
|
2024-02-14 13:15:15 +00:00
|
|
|
A quick function to check if the optional NixOS system module is enabled.
|
2023-12-23 10:40:12 +00:00
|
|
|
*/
|
|
|
|
hasOSModuleEnabled =
|
|
|
|
# The configuration attribute set of the home-manager configuration.
|
|
|
|
attrs:
|
|
|
|
|
|
|
|
# A list of strings representing the attribute path.
|
|
|
|
attrPath:
|
2024-02-14 13:15:15 +00:00
|
|
|
hasNixOSConfigAttr attrs attrPath false;
|
2023-12-19 09:59:55 +00:00
|
|
|
}
|