2024-02-11 07:16:25 +00:00
|
|
|
# All of the functions suitable only for NixOS.
|
2024-03-03 08:39:32 +00:00
|
|
|
{ pkgs, lib, self }:
|
2022-07-09 05:46:06 +00:00
|
|
|
|
2024-03-03 08:39:32 +00:00
|
|
|
{
|
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.
|
2024-03-01 10:09:47 +00:00
|
|
|
hasNixosFormat = config:
|
2024-03-03 08:39:32 +00:00
|
|
|
lib.hasAttrByPath [ "formatAttr" ] config;
|
2024-02-28 10:44:27 +00:00
|
|
|
|
|
|
|
# Checks if the NixOS config is being built for a particular format.
|
2024-03-01 10:09:47 +00:00
|
|
|
isFormat = config: format:
|
2024-03-03 08:39:32 +00:00
|
|
|
(config.formatAttr or "") == format;
|
2022-07-09 05:46:06 +00:00
|
|
|
}
|