{
  marleylib,
  config,
  osConfig,
  lib,
  pkgs,
  inputs,
  ...
}: let
  inherit (marleylib.module) mkEnableOption';

  cfg = config.marleyos.programs.phpstorm;
  osCfg = osConfig.marleyos.programs.phpstorm.enable or false;
in {
  options.marleyos.programs.phpstorm.enable = mkEnableOption' "phpstorm" osCfg;

  config = lib.mkIf cfg.enable {
    # JetBrains products are unfree.
    nixpkgs = {
      config.allowUnfree = lib.mkIf pkgs.stdenv.isLinux (lib.mkForce true);

      overlays = [
        (import ../../../../overlays/jetbrains.nix {inherit inputs;})
      ];
    };

    home.packages = lib.mkIf pkgs.stdenv.isLinux (with pkgs; [
      # jetbrains.phpstorm
      marleyos.phpstorm-with-node
    ]);

    home.file.".ideavimrc".source = ./.ideavimrc;
  };
}
