2017-04-23 13:58:07 +02:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
2017-05-25 10:51:26 +02:00
|
|
|
cfg = config.programs.zsh.ohMyZsh;
|
2017-04-23 13:58:07 +02:00
|
|
|
in
|
|
|
|
{
|
|
|
|
options = {
|
2017-05-25 10:51:26 +02:00
|
|
|
programs.zsh.ohMyZsh = {
|
2017-04-23 13:58:07 +02:00
|
|
|
enable = mkOption {
|
|
|
|
default = false;
|
|
|
|
description = ''
|
|
|
|
Enable oh-my-zsh.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
plugins = mkOption {
|
|
|
|
default = [];
|
|
|
|
type = types.listOf(types.str);
|
|
|
|
description = ''
|
|
|
|
List of oh-my-zsh plugins
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
custom = mkOption {
|
|
|
|
default = "";
|
|
|
|
type = types.str;
|
|
|
|
description = ''
|
|
|
|
Path to a custom oh-my-zsh package to override config of oh-my-zsh.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
theme = mkOption {
|
|
|
|
default = "";
|
|
|
|
type = types.str;
|
|
|
|
description = ''
|
|
|
|
Name of the theme to be used by oh-my-zsh.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
2017-05-09 17:07:18 +02:00
|
|
|
|
|
|
|
# Prevent zsh from overwriting oh-my-zsh's prompt
|
|
|
|
programs.zsh.promptInit = mkDefault "";
|
|
|
|
|
2017-04-23 13:58:07 +02:00
|
|
|
environment.systemPackages = with pkgs; [ oh-my-zsh ];
|
|
|
|
|
|
|
|
programs.zsh.interactiveShellInit = with pkgs; with builtins; ''
|
|
|
|
# oh-my-zsh configuration generated by NixOS
|
|
|
|
export ZSH=${oh-my-zsh}/share/oh-my-zsh
|
|
|
|
|
|
|
|
${optionalString (length(cfg.plugins) > 0)
|
|
|
|
"plugins=(${concatStringsSep " " cfg.plugins})"
|
|
|
|
}
|
|
|
|
|
|
|
|
${optionalString (stringLength(cfg.custom) > 0)
|
|
|
|
"ZSH_CUSTOM=\"${cfg.custom}\""
|
|
|
|
}
|
|
|
|
|
|
|
|
${optionalString (stringLength(cfg.theme) > 0)
|
|
|
|
"ZSH_THEME=\"${cfg.theme}\""
|
|
|
|
}
|
|
|
|
|
|
|
|
source $ZSH/oh-my-zsh.sh
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|