nixos-config/nixos/legacy/shell-zsh.nix

112 lines
2.9 KiB
Nix
Raw Normal View History

2019-10-24 02:20:38 +02:00
{ config, pkgs, lib, ... }:
with lib;
let
cfg = config.programs.custom.zsh;
2021-11-01 09:20:42 +01:00
in
{
2019-10-24 02:20:38 +02:00
options.programs.custom.zsh = {
enable = mkEnableOption "enable zsh";
mainUser = mkOption {
2019-12-20 05:54:26 +01:00
type = with types; nullOr str;
2019-10-24 02:20:38 +02:00
default = null;
description = ''
the main User if available
'';
};
};
config = mkIf cfg.enable {
programs.zsh = {
2019-12-20 05:54:26 +01:00
enable = true;
enableCompletion = true;
2019-10-24 02:20:38 +02:00
syntaxHighlighting.enable = true;
ohMyZsh = {
custom = "/etc/zshcustom/";
enable = false;
2019-10-24 02:20:38 +02:00
# powerline themes
# ----------------
theme = "powerlevel9k/powerlevel9k";
plugins = [
"git"
"git-flow"
"screen"
"taskwarrior"
2019-10-24 02:20:38 +02:00
"systemd"
"tmux"
"vi-mode"
"wd"
];
};
#loginShellInit = ''
# export TERM="xterm-256color"
#'';
2019-10-24 02:20:38 +02:00
shellAliases = {
2019-12-20 05:54:26 +01:00
ls = "ls --color=tty";
l = "ls -CFh";
la = "ls -Ah";
ll = "ls -lh";
lt = "ls -lct --reverse";
less = "less -S";
top = "htop";
2019-10-24 02:20:38 +02:00
version = "date '+%Y%m%d%H%M%S'";
2019-12-20 05:54:26 +01:00
vclip = "xclip -selection clipboard";
df = "df -h";
2019-10-24 02:20:38 +02:00
timestamp = "date +%Y%m%d%H%M%S";
#nix-search = "nix-env -qaP";
#nix-list = ''nix-env -qaP "*" --description'';
#nix-list-haskell = ''nix-env -f "<nixpkgs>" -qaP -A haskellPackages'';
#nix-list-node = ''nix-env -f "<nixpkgs>" -qaP -A nodePackages'';
#nix-list-beam = ''nix-env -f "<nixpkgs>" -qaP -A beamPackages'';
#nix-find = "clear ; ${pkgs.nix-index}/bin/nix-locate -1 -w";
2019-10-24 02:20:38 +02:00
nix-show-garbadge-roots = "ls -lh /nix/var/nix/gcroots/auto/";
};
};
# only used to make quick config changes
# --------------------------------------
#environment.etc."zshcustom/mainuser.zsh".source =
# pkgs.writeText "mainuser-zsh" (if (cfg.mainUser != null) then ''
# source ${config.users.users.mainUser.home}/.zshrc
# '' else
# "# programs.custom.zsh.mainUser not set ");
2019-10-24 02:20:38 +02:00
# Theme
# -----
#environment.etc."zshcustom/themes/powerlevel9k".source =
# pkgs.fetchFromGitHub {
# owner = "bhilburn";
# repo = "powerlevel9k";
# rev = "v0.6.4";
# sha256 = "104wvlni3rilpw9v1dk848lnw8cm8qxl64xs70j04ly4s959dyb5";
# };
#environment.etc."zshcustom/powerlevel9kpatch.zsh".source =
# pkgs.writeText "powerlevel9kpatch.zsh" ''
# # prompt elements
# # ---------------
# POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(vi_mode context dir vcs custom_jail background_jobs time status)
# POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=()
#
# # root_indicator
# # --------------
# POWERLEVEL9K_ROOT_ICON="#"
# POWERLEVEL9K_ROOT_INDICATOR_FOREGROUND="black"
# POWERLEVEL9K_ROOT_INDICATOR_BACKGROUND="red"
# '';
2019-10-24 02:20:38 +02:00
};
}