2020-06-08 16:19:05 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
{
|
|
|
|
options = {
|
|
|
|
programs.zsh.functions = mkOption {
|
|
|
|
description = "An attribute set that maps function names to their source";
|
2022-01-30 17:06:58 +01:00
|
|
|
default = { };
|
2020-06-08 16:19:05 +02:00
|
|
|
type = with types; attrsOf (either str path);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config.programs.zsh.initExtra = concatStringsSep "\n" (
|
2022-01-30 17:06:58 +01:00
|
|
|
mapAttrsToList
|
|
|
|
(name: funSrc: ''
|
|
|
|
function ${name}() {
|
|
|
|
${funSrc}
|
|
|
|
}
|
|
|
|
'')
|
|
|
|
config.programs.zsh.functions
|
2020-06-08 16:19:05 +02:00
|
|
|
);
|
|
|
|
}
|