anchor.diff:      assertions = [
         {
           assertion = cfg.octoprintIntegration -> config.services.octoprint.enable;
  -        message = "Option klipper.octoprintIntegration requires Octoprint to be enabled on this system. Please enable services.octoprint to use it.";
  +        message = "Option services.klipper.octoprintIntegration requires Octoprint to be enabled on this system. Please enable services.octoprint to use it.";
         }
         {
           assertion = cfg.user != null -> cfg.group != null;
  -        message = "Option klipper.group is not set when a user is specified.";
  -      }
  -      {
  -        assertion = foldl (a: b: a && b) true (mapAttrsToList (mcu: _: mcu != null -> (hasAttrByPath [ "${mcu}" "serial" ] cfg.settings)) cfg.firmwares);
  -        message = "Option klipper.settings.$mcu.serial must be set when klipper.firmware.$mcu is specified";
  +        message = "Option services.klipper.group is not set when services.klipper.user is specified.";
  +      }
  +      {
  +        assertion = cfg.settings != null -> foldl (a: b: a && b) true (mapAttrsToList (mcu: _: mcu != null -> (hasAttrByPath [ "${mcu}" "serial" ] cfg.settings)) cfg.firmwares);
  +        message = "Option services.klipper.settings.$mcu.serial must be set when settings.klipper.firmware.$mcu is specified";
  +      }
  +      {
  +        assertion = (cfg.configFile != null) != (cfg.settings != null);
  +        message = "You need to either specify services.klipper.settings or services.klipper.defaultConfig.";
         }
       ];
   
  -    environment.etc."klipper.cfg".source = format.generate "klipper.cfg" cfg.settings;
  +    environment.etc = mkIf (!cfg.mutableConfig) {
  +      "klipper.cfg".source = if cfg.settings != null then format.generate "klipper.cfg" cfg.settings else cfg.configFile;
  +    };
   
       services.klipper = mkIf cfg.octoprintIntegration {
         user = config.services.octoprint.user;
  
positive.code:     environment.systemPackages =
        with pkgs;
        let
          firmwares = filterAttrs (n: v: v!= null) (mapAttrs
            (mcu: { enable, configFile }: if enable then pkgs.klipper-firmware.override {
              mcu = lib.strings.sanitizeDerivationName mcu;
              firmwareConfig = configFile;
            } else null)
  
negative.code:           (mcu: firmware: pkgs.klipper-flash.override {
              mcu = lib.strings.sanitizeDerivationName mcu;
              klipper-firmware = firmware;
              flashDevice = default cfg.firmwares."${mcu}".serial cfg.settings."${mcu}".serial;
              firmwareConfig = cfg.firmwares."${mcu}".configFile;
            })
            firmwares;
        in
        [ klipper-genconf ] ++ firmwareFlasher ++ attrValues firmwares;
    };
    meta.maintainers = [
      maintainers.cab404
    ];
  }
  