about summary refs log blame commit diff
path: root/users/grfn/system/home/modules/lib/zshFunctions.nix
blob: 7c39b3478cfdc36f0c51b64dcf4cce0b13d1ab22 (plain) (tree)



















                                                                                
{ config, lib, pkgs, ... }:

with lib;

{
  options = {
    programs.zsh.functions = mkOption {
      description = "An attribute set that maps function names to their source";
      default = {};
      type = with types; attrsOf (either str path);
    };
  };

  config.programs.zsh.initExtra = concatStringsSep "\n" (
    mapAttrsToList (name: funSrc: ''
      function ${name}() {
        ${funSrc}
      }
    '') config.programs.zsh.functions
  );
}