From 56992b8c945d497a623fe693847c91235be1ae02 Mon Sep 17 00:00:00 2001 From: sefidel Date: Tue, 28 Dec 2021 01:11:25 +0900 Subject: initial commit --- home/modules/programs/zshell/default.nix | 44 ++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 home/modules/programs/zshell/default.nix (limited to 'home/modules/programs/zshell') diff --git a/home/modules/programs/zshell/default.nix b/home/modules/programs/zshell/default.nix new file mode 100644 index 0000000..514002a --- /dev/null +++ b/home/modules/programs/zshell/default.nix @@ -0,0 +1,44 @@ +{ config, lib, ... }: +let + cfg = config.programs.zshell; + aliasesStr = lib.concatStringsSep "\n" + (lib.mapAttrsToList (k: v: "alias ${k}=${lib.escapeShellArg v}") + cfg.aliases); + sourcesStr = + lib.concatStringsSep "\n" (builtins.map (s: ". ${s}") cfg.sources); +in +{ + options.programs.zshell = { + aliases = lib.mkOption { + default = { }; + example = { + ll = "ls -l"; + ".." = "cd .."; + }; + description = '' + An attribute set that maps aliases (the top level attribute names in + this option) to command strings or directly to build outputs. + ''; + type = lib.types.attrsOf lib.types.str; + }; + sources = lib.mkOption { + default = [ ]; + type = lib.types.listOf lib.types.str; + }; + }; + + config = { + home.file = { + ".zsh/boot/aliases.zsh" = { + text = '' + ${aliasesStr} + ''; + }; + ".zsh/boot/sourcing.zsh" = { + text = '' + ${sourcesStr} + ''; + }; + }; + }; +} -- cgit 1.4.1