mirror of
https://github.com/foo-dogsquared/nixos-config.git
synced 2025-01-31 16:57:55 +00:00
42 lines
1.1 KiB
Nix
42 lines
1.1 KiB
Nix
# Custom libraries for home-manager library.
|
|
{ pkgs, lib, self }:
|
|
|
|
rec {
|
|
/*
|
|
Checks if there is the `osConfig` attribute and get the attribute path from
|
|
its system configuration.
|
|
*/
|
|
hasNixOSConfigAttr =
|
|
# 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 ? 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 && 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;
|
|
}
|