Merging multiple systems using specialisations

I want to merge multiple nixos configurations into one with specialisations this way:

{
  description = "A very basic flake";

  inputs = {
    nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.05";
    unstable.url = "github:NixOS/nixpkgs/nixos-unstable";
    c1.url = "path:./c1";
    c2.url = "path:./c2";
  };

  outputs = { self, nixpkgs, c1, c2, ... }: {
    nixosConfigurations = let
      hardware-configuration = /etc/nixos/hardware-configuration.nix;
      c1-secrets = import /etc/secrets.nix;
      c2-secrets = import /etc/c2-secrets.nix;
      c1-config = c1.system-definer c1-secrets hardware-configuration;
      c2-config = c1.system-definer c2-secrets hardware-configuration;

    in {
      nixos-home-desktop = (nixpkgs.lib.nixosSystem
        c1-config.nixos-home-desktop).extendModules {
          modules = [{
            specialisation.c2.configuration = builtins.trace (nixpkgs.lib.nixosSystem c2-config.nixos-home-desktop).config (nixpkgs.lib.nixosSystem c2-config.nixos-home-desktop).config;
            specialisation.c2.inheritParentConfig = false;
          }];
        };
    };
  };
}

but I’m having an error that says nixpkgs.pkgs is not accessible (thats for the c2 definition). what do you suggest ?

EDIT:
system-definer just returns something like this :

{
   nixos-home-desktop = {
     inherit specialArgs system;
     modules = [ ./hosts/home-pc.nix ];
   };
 }

Absolute paths are not valid with flakes. I’m sure there’s other issues involved too.

that’s not the issue here since I’m using --impure

this is the exact error :

error:
       … while calling the 'derivationStrict' builtin
         at <nix/derivation-internal.nix>:37:12:
           36|
           37|   strict = derivationStrict drvAttrs;
             |            ^
           38|

       … while evaluating derivation 'nixos-system-nixos-home-desktop-25.05.20251110.c244830'
         whose name attribute is located at /nix/store/y49qqnpqd04nkkanxrq1x637qa61ckpg-source/pkgs/stdenv/generic/make-derivation.nix:480:13

       … while evaluating attribute 'buildCommand' of derivation 'nixos-system-nixos-home-desktop-25.05.20251110.c244830'
         at /nix/store/y49qqnpqd04nkkanxrq1x637qa61ckpg-source/nixos/modules/system/activation/top-level.nix:68:7:
           67|       passAsFile = [ "extraDependencies" ];
           68|       buildCommand = systemBuilder;
             |       ^
           69|

       … while evaluating the option `system.systemBuilderCommands':

       … while evaluating definitions from `/nix/store/y49qqnpqd04nkkanxrq1x637qa61ckpg-source/nixos/modules/system/activation/specialisation.nix':

       … while evaluating the option `specialisation.c2.configuration':

       … while evaluating the module argument `pkgs' in "/nix/store/y49qqnpqd04nkkanxrq1x637qa61ckpg-source/nixos/modules/services/hardware/bluetooth.nix":

       … while evaluating definitions from `<unknown-file>':

       … while evaluating the option `nixpkgs.pkgs':

       (stack trace truncated; use '--show-trace' to show the full, detailed trace)

       error: The option `nixpkgs.pkgs' was accessed but has no value defined. Try setting the option.

allright I finally fixed the issue and found out what causes that issue,

the way that nixos modules work for specializations causes it, it tries to automatically add the base inxos modules itself and that caused the error,

the way that I fixed it was by importing the other config without actually building it ( importing the raw configuration )