{
  config,
  lib,
  inputs,
  ...
}:
with lib;
let
  cfg = config.eboskma.pixiecore;

  installerSystem = import ./installer.nix { inherit (inputs.nixpkgs.lib) nixosSystem; };
  build = installerSystem.config.system.build;
in
{
  options.eboskma.pixiecore = {
    enable = mkEnableOption "pixiecore with NixOS Installer";
  };

  config = mkIf cfg.enable {
    services.pixiecore = {
      enable = true;
      openFirewall = true;
      dhcpNoBind = true;

      mode = "boot";
      kernel = "${build.kernel}/bzImage";
      initrd = "${build.netbootRamdisk}/initrd";
      cmdLine = "init=${build.toplevel}/init loglevel=4";
      debug = true;
    };
  };
}