Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* programs.zsh: add enableOhMyZsh option to automate setup of oh-my-zsh in global zshrc * programs.zsh: make oh-my-zsh plugins configurable * programs.zsh: add ohMyZshCustom option * programs.zsh: add ohMyZshTheme option * programs.zsh: applying minor fixes to evaluate expressions properly * programs.zsh: fix ordering of oh-my-zsh config and execution * programs.zsh: move all oh-my-zsh params into its own scope named programs.zsh.oh-my-zsh
- Loading branch information
Showing
3 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
{ config, lib, pkgs, ... }: | ||
|
||
with lib; | ||
|
||
let | ||
cfg = config.programs.zsh.oh-my-zsh; | ||
in | ||
{ | ||
options = { | ||
programs.zsh.oh-my-zsh = { | ||
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 { | ||
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 | ||
''; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters