add zshFunctions config option
This commit is contained in:
parent
d59b69e6a3
commit
77f3860a65
2 changed files with 22 additions and 0 deletions
|
@ -15,6 +15,7 @@ with lib;
|
|||
|
||||
{
|
||||
imports = [
|
||||
./lib/zshFunctions.nix
|
||||
./development/kube.nix
|
||||
./development/urbint.nix
|
||||
];
|
||||
|
|
21
home/modules/lib/zshFunctions.nix
Normal file
21
home/modules/lib/zshFunctions.nix
Normal 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
|
||||
);
|
||||
}
|
Loading…
Reference in a new issue