nixos-config/lib/nixos.nix

15 lines
476 B
Nix
Raw Normal View History

# All of the functions suitable only for NixOS.
{ pkgs, lib }:
rec {
2024-02-28 10:44:27 +00:00
# Checks if the NixOS configuration is part of the nixos-generator build.
# Typically, we just check if there's a certain attribute that is imported
# from it.
hasNixosFormat = config:
2024-02-28 10:44:27 +00:00
pkgs.lib.hasAttrByPath [ "formatAttr" ] config;
# Checks if the NixOS config is being built for a particular format.
isFormat = config: format:
hasNixosFormat config && config.formatAttr == format;
}