{ lib, config, ... }:
let cfg = config.cos.emacs; in
{
  options.cos.emacs = {
    enable = lib.mkEnableOption "emacs";
    org-directory = lib.mkOption {
      type = lib.types.str;
      default = "~/org";
    };
  };

  config = lib.mkIf cfg.enable {
    home-manager.users.${config.cos.username} = {pkgs, ...}: {
      programs.emacs = {
        enable = true;
        extraConfig = ''
          (setq package-archives nil)
        '';
      };
    };
  };
}
