old
 1{
 2  lib,
 3  pkgs,
 4  config,
 5  helix-steel,
 6  ...
 7}: let
 8  inherit (lib) mkOption types;
 9
10  cfg = config.programs.helix.steelEventSystem;
11in {
12  options.programs.helix.steelEventSystem = {
13    enable = lib.mkEnableOption "Enable Helix Steel event system.";
14    steelPackage = lib.mkPackageOption pkgs "steel" {};
15    initScm = mkOption {
16      type = types.either types.lines types.path;
17      default = "";
18    };
19    helixScm = mkOption {
20      type = types.either types.lines types.path;
21      default = "";
22    };
23  };
24
25  config = lib.mkIf cfg.enable {
26    home.packages = [cfg.steelPackage];
27    programs.helix.package = lib.mkDefault helix-steel.packages.${pkgs.system}.default;
28
29    xdg.configFile."helix/init.scm" = let
30      scm = cfg.initScm;
31    in
32      lib.mkIf (lib.stringLength scm != 0) {
33        source = lib.mkIf (lib.isPath scm) scm;
34        text = lib.mkIf (!(lib.isPath scm)) scm;
35      };
36    xdg.configFile."helix/helix.scm" = let
37      scm = cfg.helixScm;
38    in
39      lib.mkIf (lib.stringLength scm != 0) {
40        source = lib.mkIf (lib.isPath scm) scm;
41        text = lib.mkIf (!(lib.isPath scm)) scm;
42      };
43  };
44}