From 77f3860a651ee7f35c8e65747c0c45fb001cfb0b Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 8 Jun 2020 10:19:05 -0400 Subject: add zshFunctions config option --- home/modules/development.nix | 1 + home/modules/lib/zshFunctions.nix | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 home/modules/lib/zshFunctions.nix diff --git a/home/modules/development.nix b/home/modules/development.nix index 8474456e678d..9bb24b256110 100644 --- a/home/modules/development.nix +++ b/home/modules/development.nix @@ -15,6 +15,7 @@ with lib; { imports = [ + ./lib/zshFunctions.nix ./development/kube.nix ./development/urbint.nix ]; diff --git a/home/modules/lib/zshFunctions.nix b/home/modules/lib/zshFunctions.nix new file mode 100644 index 000000000000..7c39b3478cfd --- /dev/null +++ b/home/modules/lib/zshFunctions.nix @@ -0,0 +1,21 @@ +{ 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 + ); +} -- cgit 1.4.1