Review lib module extension

I would appreciate it if someone could review the set of modules I’m using to extend lib; I’m attempting to import a global set of modules, but when using a function to generate a list of modules to import, it seems as though several attributes from sets in the modules are being interpreted by nix as options:

error: --- ThrownError ------------------------------------------------------------------------------------------------------------ nix
The option `configs' does not exist. Definition values:
- In `/etc/nixos/shared/global/lib/paths.nix': "/etc/nixos/configs"

Or are seemingly absent, whether they be modules present in lib from before (note that the error directly below should now stem from here):

error: --- UndefinedVarError --- nix
at: (189:31) in file: /nix/store/g3ymjp3lc6wvx49q2pj2d92c4nf9yjvl-source/flake.nix

   188|             config = {
   189|                 environment = lib.mkMerge [{ systemPackages = with pkgs; [ raspberrypi-tools ]; }];
      |                               ^
   190|                 boot.kernelParams = ["cma=256M"];

undefined variable 'mkMerge'

Or functions and attribute sets I have added myself:

error: --- EvalError --- nix
at: (18:26) in file: /etc/nixos/shared/global/imd.nix

    17|             virtualisation = lib.mkIf (!_lib.vars.minimal) {
    18|                 inherit (_lib.virtualisation) docker podman;
      |                          ^
    19|                 libvirtd.enable = true;

attribute 'virtualisation' missing

Any help will be greatly appreciated!