Skip to content

Install zsh, configure oh-my-zsh on per-user basis with themes and plugins.

Notifications You must be signed in to change notification settings

arlimus/chef-zsh

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

zsh cookbook

Configure zsh for your system and users. Uses oh-my-zsh for theme and plugin configuration, if set.

Requirements

You must create the user on the system before using this cookbook. User management and identification is done based on fnichol/chef-user and it is highly recommended.

Attributes

# set a list of users you wish to modify
['users']                  = [ ]

# list of urls of extra themes to add
['oh-my-zsh']['themes']    = [ ]

# hashmap of extra plugin names and urls to add
['oh-my-zsh']['plugins']   = { }

Data Bag fields

Usage

Just include chef-zsh in your node's run_list. Configure your users in users attribute.

{
  "users": [ "test" ],
  "run_list": [
    "recipe[user]",
    "recipe[zsh]"
  ]
}

Add users to your data_bags. Example test user (data_bags/users/test.json):

{
  "id"          : "test",
  "gid"         : "users",
  "home"        : "/home/test",

  "shell"       : "/usr/bin/zsh",
  "zsh_theme"   : "zero-dark",
  "zsh_plugins" : "git extract zero web-search",
  "zsh_aliases" : {
    "gll": "git log --color --all"
  }
}

A fully customized example:

{
  "users": [
    "test"
  ],
  "oh-my-zsh": {
    "themes": [
      "https://raw.github.com/arlimus/zero.zsh/master/themes/zero.zsh-theme.base",
      "https://raw.github.com/arlimus/zero.zsh/master/themes/zero-dark.zsh-theme",
      "https://raw.github.com/arlimus/zero.zsh/master/themes/zero-light.zsh-theme"
    ],
    "plugins": {
      "zero": "https://raw.github.com/arlimus/zero.zsh/master/plugins/zero/zero.plugin.zsh"
    }
  },
  "run_list": [
    "recipe[user]",
    "recipe[zsh]"
  ]
}

Root user

As for the root user, it's only slightly different. You create a data_bags/users/root.json as you would for every other user.

{
  "id"            : "root",

  "shell"         : "/usr/bin/zsh",
  "zsh_theme"     : "zero-dark",
  "zsh_plugins"   : "git extract zero web-search",
}

However, you don't add root to your users array in the attributes:

{
  "users": [ "alice", "bob", "unkle" ],
  "run_list": [
    "recipe[user]",
    "recipe[zsh]"
  ]
}

The root user is the one exception, where the json in your data_bags is getting interpreted as soon as it is created, without the user being in the users list. (This is necessary to get along with the chef-user cookbook, while still being able to configure root.)

Contributing

  1. Fork the repository on Github
  2. Create a named feature branch (like add_component_x)
  3. Write you change
  4. Write tests for your change (if applicable)
  5. Run the tests, ensuring they all pass
  6. Submit a Pull Request using Github

License and Authors

Authors: Dominik Richter dominik.richter@googlemail.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Install zsh, configure oh-my-zsh on per-user basis with themes and plugins.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages