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

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

  config = lib.mkIf cfg.enable {
    programs.less.enable = true;

    home.sessionVariables = let
      osEnv = osConfig.programs.less.envVariables;
    in
      lib.mkIf (osEnv ? LESS) {
        inherit (osEnv) LESS;
      };

    programs.lesspipe.enable = true;
  };
}
