Using flake output package in existing service

  1. Name the argset that’s passed to the outputs functon of the consumer flake. Usually people call it inputs but the name doesn’t matter as long as you’re consistent.
  outputs =
    inputs @ {
  1. Pass the binding into your config via the specialArgs arg of lib.nixosSystem:
nixosConfiguratios.FOO = lib.nixosSystem {
  specialArgs = { inherit inputs; }
  # ...
};
  1. Use that module arg in your config
{ pkgs, inputs, ... }:
{
  services.caddy.package = inputs.caddy.packages.${pkgs.stdenv.hostPlatform.system}.default;
}

I’m not 100% familiar with caddy or its module, but that’s usually what I do for other modules.