1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00
home-manager/lib/nix/extract-maintainers.nix
Austin Horstman 37fec70bd5
ci: extract maintainers with single file eval (#7548)
Currently, we send all files as a list but it can be problematic with
files that can't be evaluated properly. Instead of crashing the entire
extraction process, we will send a file at a time for eval so we can
just bypass files causing issues.

Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
2025-07-26 13:26:14 -05:00

58 lines
1.7 KiB
Nix

{
lib ? import ../../modules/lib/stdlib-extended.nix (import <nixpkgs> { }).lib,
file ? throw "provide file argument",
}:
let
config = { };
releaseInfo = lib.importJSON ../../release.json;
isNixFile = lib.hasSuffix ".nix" file;
filePath = ../../. + "/${file}";
fileExists = builtins.pathExists filePath;
maintainers =
if isNixFile && fileExists then
let
fileContent = import filePath;
module =
if lib.isFunction fileContent then
# TODO: Find a better way of handling this...
if lib.hasPrefix "docs/" file then
if lib.hasSuffix "home-manager-manual.nix" file then
fileContent {
stdenv = {
mkDerivation = x: x;
};
inherit lib;
documentation-highlighter = { };
revision = "unknown";
home-manager-options = {
home-manager = { };
nixos = { };
nix-darwin = { };
};
nixos-render-docs = { };
}
else
fileContent {
inherit lib;
pkgs = null;
inherit (releaseInfo) release isReleaseBranch;
}
else if lib.hasPrefix "lib/" file then
fileContent { inherit lib; }
else
fileContent {
inherit lib config;
pkgs = null;
}
else
fileContent;
in
module.meta.maintainers or [ ]
else
[ ];
in
map (maintainer: maintainer.github) maintainers