nixos-config/lib/home-manager.nix

42 lines
1.1 KiB
Nix
Raw Normal View History

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