Skip to content

Commit

Permalink
modules/performance: refactor after code review
Browse files Browse the repository at this point in the history
  • Loading branch information
stasjok committed Jul 24, 2024
1 parent fa30bc6 commit 435713d
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions modules/top-level/output.nix
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ in
removeDependencies = ps: map (p: p // { plugin = removeAttrs p.plugin [ "dependencies" ]; }) ps;

# Separated start and opt plugins
partitionedPlugins = builtins.partition (p: p.optional) allPlugins;
startPlugins = partitionedPlugins.wrong;
partitionedOptStartPlugins = builtins.partition (p: p.optional) allPlugins;
startPlugins = partitionedOptStartPlugins.wrong;
# Remove opt plugin dependencies since they are already available in start plugins
optPlugins = removeDependencies partitionedPlugins.right;
optPlugins = removeDependencies partitionedOptStartPlugins.right;

# Test if plugin shouldn't be included in plugin pack
isStandalone =
Expand All @@ -114,25 +114,24 @@ in
|| builtins.elem (lib.getName p.plugin) config.performance.combinePlugins.standalonePlugins;

# Separated standalone and combined start plugins
partitionedStartPlugins = builtins.partition isStandalone startPlugins;
toCombinePlugins = partitionedStartPlugins.wrong;
partitionedStandaloneStartPlugins = builtins.partition isStandalone startPlugins;
toCombinePlugins = partitionedStandaloneStartPlugins.wrong;
# Remove standalone plugin dependencies since they are already available in start plugins
standaloneStartPlugins = removeDependencies partitionedStartPlugins.right;
standaloneStartPlugins = removeDependencies partitionedStandaloneStartPlugins.right;

# Combine start plugins into a single pack
pluginPack =
let
# Plugins with doc tags removed
# Every plugin has its own generated help tags (doc/tags)
# Remove them to avoid collisions, new help tags
# will be generate for the entire pack later on
overriddenPlugins = map (
plugin:
plugin.plugin.overrideAttrs (prev: {
nativeBuildInputs = lib.remove pkgs.vimUtils.vimGenDocHook prev.nativeBuildInputs or [ ];
configurePhase = builtins.concatStringsSep "\n" (
builtins.filter (s: s != ":") [
prev.configurePhase or ":"
"rm -vf doc/tags"
]
);
configurePhase = ''
${prev.configurePhase or ""}
rm -vf doc/tags'';
})
) toCombinePlugins;

Expand Down

0 comments on commit 435713d

Please sign in to comment.