···
1
-
<chapter xmlns="http://docbook.org/ns/docbook"
2
-
xmlns:xlink="http://www.w3.org/1999/xlink"
3
-
xmlns:xi="http://www.w3.org/2001/XInclude"
5
-
xml:id="module-programs-zsh-ohmyzsh">
6
-
<title>Oh my ZSH</title>
8
-
<link xlink:href="https://ohmyz.sh/"><literal>oh-my-zsh</literal></link> is a
9
-
framework to manage your <link xlink:href="https://www.zsh.org/">ZSH</link>
10
-
configuration including completion scripts for several CLI tools or custom
13
-
<section xml:id="module-programs-oh-my-zsh-usage">
14
-
<title>Basic usage</title>
1
+
<chapter xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xml:id="module-programs-zsh-ohmyzsh">
2
+
<title>Oh my ZSH</title>
17
-
The module uses the <literal>oh-my-zsh</literal> package with all available
18
-
features. The initial setup using Nix expressions is fairly similar to the
19
-
configuration format of <literal>oh-my-zsh</literal>.
4
+
<link xlink:href="https://ohmyz.sh/"><literal>oh-my-zsh</literal></link>
5
+
is a framework to manage your
6
+
<link xlink:href="https://www.zsh.org/">ZSH</link> configuration
7
+
including completion scripts for several CLI tools or custom prompt
10
+
<section xml:id="module-programs-oh-my-zsh-usage">
11
+
<title>Basic usage</title>
13
+
The module uses the <literal>oh-my-zsh</literal> package with all
14
+
available features. The initial setup using Nix expressions is
15
+
fairly similar to the configuration format of
16
+
<literal>oh-my-zsh</literal>.
24
-
plugins = [ "git" "python" "man" ];
22
+
plugins = [ "git" "python" "man" ];
23
+
theme = "agnoster";
29
-
For a detailed explanation of these arguments please refer to the
30
-
<link xlink:href="https://github.com/robbyrussell/oh-my-zsh/wiki"><literal>oh-my-zsh</literal>
35
-
The expression generates the needed configuration and writes it into your
36
-
<literal>/etc/zshrc</literal>.
39
-
<section xml:id="module-programs-oh-my-zsh-additions">
40
-
<title>Custom additions</title>
43
-
Sometimes third-party or custom scripts such as a modified theme may be
44
-
needed. <literal>oh-my-zsh</literal> provides the
45
-
<link xlink:href="https://github.com/robbyrussell/oh-my-zsh/wiki/Customization#overriding-internals"><literal>ZSH_CUSTOM</literal></link>
46
-
environment variable for this which points to a directory with additional
51
-
The module can do this as well:
28
+
For a detailed explanation of these arguments please refer to the
29
+
<link xlink:href="https://github.com/robbyrussell/oh-my-zsh/wiki"><literal>oh-my-zsh</literal>
33
+
The expression generates the needed configuration and writes it
34
+
into your <literal>/etc/zshrc</literal>.
37
+
<section xml:id="module-programs-oh-my-zsh-additions">
38
+
<title>Custom additions</title>
40
+
Sometimes third-party or custom scripts such as a modified theme
41
+
may be needed. <literal>oh-my-zsh</literal> provides the
42
+
<link xlink:href="https://github.com/robbyrussell/oh-my-zsh/wiki/Customization#overriding-internals"><literal>ZSH_CUSTOM</literal></link>
43
+
environment variable for this which points to a directory with
47
+
The module can do this as well:
54
-
programs.zsh.ohMyZsh.custom = "~/path/to/custom/scripts";
51
+
programs.zsh.ohMyZsh.custom = "~/path/to/custom/scripts";
59
-
<section xml:id="module-programs-oh-my-zsh-environments">
60
-
<title>Custom environments</title>
63
-
There are several extensions for <literal>oh-my-zsh</literal> packaged in
64
-
<literal>nixpkgs</literal>. One of them is
65
-
<link xlink:href="https://github.com/spwhitt/nix-zsh-completions">nix-zsh-completions</link>
66
-
which bundles completion scripts and a plugin for
67
-
<literal>oh-my-zsh</literal>.
71
-
Rather than using a single mutable path for <literal>ZSH_CUSTOM</literal>,
72
-
it's also possible to generate this path from a list of Nix packages:
55
+
<section xml:id="module-programs-oh-my-zsh-environments">
56
+
<title>Custom environments</title>
58
+
There are several extensions for <literal>oh-my-zsh</literal>
59
+
packaged in <literal>nixpkgs</literal>. One of them is
60
+
<link xlink:href="https://github.com/spwhitt/nix-zsh-completions">nix-zsh-completions</link>
61
+
which bundles completion scripts and a plugin for
62
+
<literal>oh-my-zsh</literal>.
65
+
Rather than using a single mutable path for
66
+
<literal>ZSH_CUSTOM</literal>, it's also possible to generate this
67
+
path from a list of Nix packages:
programs.zsh.ohMyZsh.customPkgs = [
···
82
-
Internally a single store path will be created using
83
-
<literal>buildEnv</literal>. Please refer to the docs of
84
-
<link xlink:href="https://nixos.org/nixpkgs/manual/#sec-building-environment"><literal>buildEnv</literal></link>
85
-
for further reference.
89
-
<emphasis>Please keep in mind that this is not compatible with
90
-
<literal>programs.zsh.ohMyZsh.custom</literal> as it requires an immutable
91
-
store path while <literal>custom</literal> shall remain mutable! An
92
-
evaluation failure will be thrown if both <literal>custom</literal> and
93
-
<literal>customPkgs</literal> are set.</emphasis>
96
-
<section xml:id="module-programs-oh-my-zsh-packaging-customizations">
97
-
<title>Package your own customizations</title>
100
-
If third-party customizations (e.g. new themes) are supposed to be added to
101
-
<literal>oh-my-zsh</literal> there are several pitfalls to keep in mind:
79
+
Internally a single store path will be created using
80
+
<literal>buildEnv</literal>. Please refer to the docs of
81
+
<link xlink:href="https://nixos.org/nixpkgs/manual/#sec-building-environment"><literal>buildEnv</literal></link>
82
+
for further reference.
107
-
To comply with the default structure of <literal>ZSH</literal> the entire
108
-
output needs to be written to <literal>$out/share/zsh.</literal>
85
+
<emphasis>Please keep in mind that this is not compatible with
86
+
<literal>programs.zsh.ohMyZsh.custom</literal> as it requires an
87
+
immutable store path while <literal>custom</literal> shall remain
88
+
mutable! An evaluation failure will be thrown if both
89
+
<literal>custom</literal> and <literal>customPkgs</literal> are
93
+
<section xml:id="module-programs-oh-my-zsh-packaging-customizations">
94
+
<title>Package your own customizations</title>
113
-
Completion scripts are supposed to be stored at
114
-
<literal>$out/share/zsh/site-functions</literal>. This directory is part
116
-
<link xlink:href="http://zsh.sourceforge.net/Doc/Release/Functions.html"><literal>fpath</literal></link>
117
-
and the package should be compatible with pure <literal>ZSH</literal>
118
-
setups. The module will automatically link the contents of
119
-
<literal>site-functions</literal> to completions directory in the proper
96
+
If third-party customizations (e.g. new themes) are supposed to be
97
+
added to <literal>oh-my-zsh</literal> there are several pitfalls
103
+
To comply with the default structure of <literal>ZSH</literal>
104
+
the entire output needs to be written to
105
+
<literal>$out/share/zsh.</literal>
110
+
Completion scripts are supposed to be stored at
111
+
<literal>$out/share/zsh/site-functions</literal>. This
112
+
directory is part of the
113
+
<link xlink:href="http://zsh.sourceforge.net/Doc/Release/Functions.html"><literal>fpath</literal></link>
114
+
and the package should be compatible with pure
115
+
<literal>ZSH</literal> setups. The module will automatically
116
+
link the contents of <literal>site-functions</literal> to
117
+
completions directory in the proper store path.
122
+
The <literal>plugins</literal> directory needs the structure
123
+
<literal>pluginname/pluginname.plugin.zsh</literal> as
125
+
<link xlink:href="https://github.com/robbyrussell/oh-my-zsh/tree/91b771914bc7c43dd7c7a43b586c5de2c225ceb7/plugins">upstream
125
-
The <literal>plugins</literal> directory needs the structure
126
-
<literal>pluginname/pluginname.plugin.zsh</literal> as structured in the
127
-
<link xlink:href="https://github.com/robbyrussell/oh-my-zsh/tree/91b771914bc7c43dd7c7a43b586c5de2c225ceb7/plugins">upstream
131
+
A derivation for <literal>oh-my-zsh</literal> may look like this:
134
-
A derivation for <literal>oh-my-zsh</literal> may look like this:
{ stdenv, fetchFromGitHub }:
stdenv.mkDerivation rec {
139
-
name = "exemplary-zsh-customization-${version}";
137
+
name = "exemplary-zsh-customization-${version}";
138
+
version = "1.0.0";
# path to the upstream repository
···