add zshFunctions config option

This commit is contained in:
Griffin Smith 2020-06-08 10:19:05 -04:00
parent d59b69e6a3
commit 77f3860a65
2 changed files with 22 additions and 0 deletions

View file

@ -15,6 +15,7 @@ with lib;
{
imports = [
./lib/zshFunctions.nix
./development/kube.nix
./development/urbint.nix
];

View file

@ -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
);
}