Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 74a1ea1f89c9
Choose a base ref
...
head repository: NixOS/nixpkgs
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 1c5f4ae5d281
Choose a head ref
  • 9 commits
  • 5 files changed
  • 3 contributors

Commits on Jun 12, 2017

  1. oh-my-zsh: add module (#25140)

    * 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
    
    (cherry picked from commit 9ec64d2)
    Ma27 authored and peti committed Jun 12, 2017
    Copy the full SHA
    6f295b8 View commit details
  2. zsh-syntax-highlighting: Add more configuration options and move to m…

    …odule (#25153)
    
    * programs.zsh: factor zsh-syntax-highlighting out into its own module
    
    * programs.zsh.syntax-highlighting: add `highlighters` option
    
    * programs.zsh: document BC break introduced by moving zsh-syntax-completion into its own module
    
    (cherry picked from commit 0a12aaf)
    Ma27 authored and peti committed Jun 12, 2017

    Verified

    This commit was signed with the committer’s verified signature.
    vcunat Vladimír Čunát
    Copy the full SHA
    533f813 View commit details
  3. programs.zsh.syntax-highlighting: refactor highlighters option for …

    …proper validation
    
    Right now the `programs.zsh.syntax-highlighting.highlighters` option
    lacks appropriate validation which can cause confusing things when
    mistyping a higlighter for zsh-syntax-highlighting.
    
    (cherry picked from commit baa3b3e)
    Ma27 authored and peti committed Jun 12, 2017

    Verified

    This commit was signed with the committer’s verified signature.
    vcunat Vladimír Čunát
    Copy the full SHA
    ffb4c1f View commit details
  4. Verified

    This commit was signed with the committer’s verified signature.
    vcunat Vladimír Čunát
    Copy the full SHA
    07973d1 View commit details
  5. zsh module: rename option syntax-highlighting

    rename zsh-option "syntax-highlighting" -> "syntaxHighlighting"
    
    (cherry picked from commit 4e4f7a2)
    WilliButz authored and peti committed Jun 12, 2017

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    8039870 View commit details
  6. programs.zsh: rename oh-my-zsh to ohMyZsh

    This is intended to provide better consistency with other NixOS modules.
    Please refer to mayflower#21 for further information.
    
    (cherry picked from commit a549596)
    Ma27 authored and peti committed Jun 12, 2017
    Copy the full SHA
    9045bd0 View commit details
  7. programs.zsh.syntaxHighlighting: refactor to use attr sets rather tha…

    …n recursive lists for patterns
    
    The idea has been described here: #25323 (comment)
    
    (cherry picked from commit 0925f79)
    Ma27 authored and peti committed Jun 12, 2017
    Copy the full SHA
    6a5ce16 View commit details
  8. programs.zsh.syntax-highlighting: simplify enable option by using `mk…

    …EnableOption`
    
    (cherry picked from commit c4e4071)
    Ma27 authored and peti committed Jun 12, 2017
    Copy the full SHA
    19a2cb8 View commit details
  9. programs.zsh.syntaxHighlighting: Fix default value for patterns

    (cherry picked from commit b8ebc60)
    danielfullmer authored and peti committed Jun 12, 2017
    Copy the full SHA
    1c5f4ae View commit details
2 changes: 2 additions & 0 deletions nixos/modules/module-list.nix
Original file line number Diff line number Diff line change
@@ -99,7 +99,9 @@
./programs/wvdial.nix
./programs/xfs_quota.nix
./programs/xonsh.nix
./programs/zsh/oh-my-zsh.nix
./programs/zsh/zsh.nix
./programs/zsh/zsh-syntax-highlighting.nix
./rename.nix
./security/acme.nix
./security/apparmor.nix
66 changes: 66 additions & 0 deletions nixos/modules/programs/zsh/oh-my-zsh.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{ config, lib, pkgs, ... }:

with lib;

let
cfg = config.programs.zsh.ohMyZsh;
in
{
options = {
programs.zsh.ohMyZsh = {
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
'';
};
}
78 changes: 78 additions & 0 deletions nixos/modules/programs/zsh/zsh-syntax-highlighting.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{ config, lib, pkgs, ... }:

with lib;

let
cfg = config.programs.zsh.syntaxHighlighting;
in
{
options = {
programs.zsh.syntaxHighlighting = {
enable = mkEnableOption "zsh-syntax-highlighting";

highlighters = mkOption {
default = [ "main" ];

# https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
type = types.listOf(types.enum([
"main"
"brackets"
"pattern"
"cursor"
"root"
"line"
]));

description = ''
Specifies the highlighters to be used by zsh-syntax-highlighting.
The following defined options can be found here:
https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters.md
'';
};

patterns = mkOption {
default = {};
type = types.attrsOf types.string;

example = literalExample ''
{
"rm -rf *" = "fg=white,bold,bg=red";
}
'';

description = ''
Specifies custom patterns to be highlighted by zsh-syntax-highlighting.
Please refer to the docs for more information about the usage:
https://github.com/zsh-users/zsh-syntax-highlighting/blob/master/docs/highlighters/pattern.md
'';
};
};
};

config = mkIf cfg.enable {
environment.systemPackages = with pkgs; [ zsh-syntax-highlighting ];

programs.zsh.interactiveShellInit = with pkgs; with builtins; ''
source ${zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
${optionalString (length(cfg.highlighters) > 0)
"ZSH_HIGHLIGHT_HIGHLIGHTERS=(${concatStringsSep " " cfg.highlighters})"
}
${let
n = attrNames cfg.patterns;
in
optionalString (length(n) > 0)
(assert(elem "pattern" cfg.highlighters); (foldl (
a: b:
''
${a}
ZSH_HIGHLIGHT_PATTERNS+=('${b}' '${attrByPath [b] "" cfg.patterns}')
''
) "") n)
}
'';
};
}
16 changes: 1 addition & 15 deletions nixos/modules/programs/zsh/zsh.nix
Original file line number Diff line number Diff line change
@@ -84,14 +84,6 @@ in
type = types.bool;
};

enableSyntaxHighlighting = mkOption {
default = false;
description = ''
Enable zsh-syntax-highlighting
'';
type = types.bool;
};

enableAutosuggestions = mkOption {
default = false;
description = ''
@@ -130,10 +122,6 @@ in
${if cfg.enableCompletion then "autoload -U compinit && compinit" else ""}
${optionalString (cfg.enableSyntaxHighlighting)
"source ${pkgs.zsh-syntax-highlighting}/share/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh"
}
${optionalString (cfg.enableAutosuggestions)
"source ${pkgs.zsh-autosuggestions}/share/zsh-autosuggestions/zsh-autosuggestions.zsh"
}
@@ -143,7 +131,6 @@ in
${cfge.interactiveShellInit}
HELPDIR="${pkgs.zsh}/share/zsh/$ZSH_VERSION/help"
'';

@@ -206,8 +193,7 @@ in
environment.etc."zinputrc".source = ./zinputrc;

environment.systemPackages = [ pkgs.zsh ]
++ optional cfg.enableCompletion pkgs.nix-zsh-completions
++ optional cfg.enableSyntaxHighlighting pkgs.zsh-syntax-highlighting;
++ optional cfg.enableCompletion pkgs.nix-zsh-completions;

environment.pathsToLink = optional cfg.enableCompletion "/share/zsh";

10 changes: 10 additions & 0 deletions nixos/modules/rename.nix
Original file line number Diff line number Diff line change
@@ -194,5 +194,15 @@ with lib;
(mkRemovedOptionModule [ "services" "dovecot2" "package" ] "")
(mkRemovedOptionModule [ "services" "xserver" "displayManager" "sddm" "themes" ]
"Set the option `services.xserver.displayManager.sddm.package' instead.")

# ZSH
(mkRenamedOptionModule [ "programs" "zsh" "enableSyntaxHighlighting" ] [ "programs" "zsh" "syntaxHighlighting" "enable" ])
(mkRenamedOptionModule [ "programs" "zsh" "syntax-highlighting" "enable" ] [ "programs" "zsh" "syntaxHighlighting" "enable" ])
(mkRenamedOptionModule [ "programs" "zsh" "syntax-highlighting" "highlighters" ] [ "programs" "zsh" "syntaxHighlighting" "highlighters" ])
(mkRenamedOptionModule [ "programs" "zsh" "syntax-highlighting" "patterns" ] [ "programs" "zsh" "syntaxHighlighting" "patterns" ])
(mkRenamedOptionModule [ "programs" "zsh" "oh-my-zsh" "enable" ] [ "programs" "zsh" "ohMyZsh" "enable" ])
(mkRenamedOptionModule [ "programs" "zsh" "oh-my-zsh" "theme" ] [ "programs" "zsh" "ohMyZsh" "theme" ])
(mkRenamedOptionModule [ "programs" "zsh" "oh-my-zsh" "custom" ] [ "programs" "zsh" "ohMyZsh" "custom" ])
(mkRenamedOptionModule [ "programs" "zsh" "oh-my-zsh" "plugins" ] [ "programs" "zsh" "ohMyZsh" "plugins" ])
];
}