mirror of
https://github.com/nix-community/home-manager.git
synced 2025-11-08 19:46:05 +01:00
Since we're checking out the `pull_request_target` and not the `pull_request` branch. We can't evaluate the files from the PR branch. We can skip the files for evaluation without crashing the entire extraction. Signed-off-by: Austin Horstman <khaneliman12@gmail.com>
73 lines
2.4 KiB
Nix
73 lines
2.4 KiB
Nix
{
|
|
lib ? import ../../modules/lib/stdlib-extended.nix (import <nixpkgs> { }).lib,
|
|
changedFilesJson ? throw "provide either changedFiles or changedFilesJson",
|
|
changedFiles ? builtins.fromJSON changedFilesJson,
|
|
}:
|
|
let
|
|
config = { };
|
|
releaseInfo = lib.importJSON ../../release.json;
|
|
|
|
extractMaintainersFromFile =
|
|
file:
|
|
let
|
|
isNixFile = lib.hasSuffix ".nix" file;
|
|
filePath = ../../. + "/${file}";
|
|
fileExists = builtins.pathExists filePath;
|
|
|
|
moduleResult =
|
|
if isNixFile && fileExists then
|
|
let
|
|
result = builtins.tryEval (
|
|
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 [ ]
|
|
);
|
|
in
|
|
if result.success then result.value else [ ]
|
|
else
|
|
[ ];
|
|
in
|
|
moduleResult;
|
|
in
|
|
lib.pipe changedFiles [
|
|
(map extractMaintainersFromFile)
|
|
lib.concatLists
|
|
lib.unique
|
|
(map (maintainer: maintainer.github))
|
|
]
|