Skip to content

A streamlined installation of Homebrew on Synology NAS, featuring libraries and packages to help you install what you need without conflicts. Perfect for enhancing your Synology NAS with additional software and tools.

License

Notifications You must be signed in to change notification settings

MrCee/Synology-Homebrew

Repository files navigation

Synology-Homebrew

  • Neovim installed perfectly.
  • Installer also supports macOS to sync same config on Intel & Apple silicon.

Introduction

Simplify the installation of Homebrew on Synology NAS devices running DSM 7.2 or later with this script. This repository streamlines the process, ensuring comprehensive coverage of available packages for macOS/Linux on Synology. If you would like everything configured exactly the same way on macOS, it's covered here. The installer will replicate the config on macOS.


Why Install Homebrew on Synology NAS or macOS?

Homebrew, a package manager for macOS and Linux, unlocks a vast ecosystem of modern software and libraries. Dive into the richer features as mentioned below.


Key Features

  • Installation Options:
    Choose between a Minimal or Advanced installation. If you just want Homebrew to work, then the Minimal install is for you.

  • Profile Creation:
    Configures the default Synology ash/sh profile and newly installed zsh to work seamlessly with Homebrew.

  • Synology Integration:
    Resolves conflicts with existing Synology packages without removing anything from your NAS.

  • Easy Uninstall:
    Revert to the original state of your NAS with the included uninstall script.

  • Cross-Platform Compatibility:
    This same installer can be used on macOS. Linuxbrew and Homebrew will work with the config.yaml to provide the same experience, however you choose to configure it.

  • COMING SOON:
    A choice of terminal emulators preconfigured and further themes.


Prerequisites

Before you begin, ensure the following setup:

  1. Synology NAS Requirements:

    • A Synology NAS running DSM 7.2 or later.
    • SSH access enabled on your NAS.
    • User homes enabled on your NAS.
    • A scheduled task to ensure Homebrew is mounted after each restart (detailed instructions below).
  2. Synology Git Installation via CLI:

    If Git is not already installed in your Synology environment, you can quickly install it via CLI. This will later be upgraded to Homebrew's Git version:

    curl -sSL https://raw.githubusercontent.com/MrCee/Synology-Git/refs/heads/main/install-synology-git.sh | bash
  3. iTerm2 Configuration:

    Use iTerm2 (or an alternative terminal emulator other than macOS Terminal.app) on your local machine for an improved experience.

    Ensure the following:

    • Compatible Nerd Fonts installed.
    • A configured color profile.

    Refer to the iTerm2 Configuration Guide for detailed setup instructions.


Installation

Quick Start:

SSH into your Synology NAS running DSM 7.2 or above and run the following command to download the installer into your home directory and execute it:

git clone https://github.com/MrCee/Synology-Homebrew.git ~/Synology-Homebrew && \
~/Synology-Homebrew/install-synology-homebrew.sh

Select your install type:

1) Minimal Install:

This will provide the Homebrew basics, ignore packages in config.yaml, leaving the rest to you.

You can also use this option to uninstall packages in config.yaml installed by option 2 by running the script again.

2) Advanced Install:

Full setup includes packages in config.yaml.

Recommended if you want to get started with Neovim or install some of the great packages listed.

Both install types include the following essential packages to ensure Homebrew runs smoothly on Synology:

  • git, ruby, glibc, gcc, clang-build-analyzer (which includes latest python & pip), yq, zsh, oh-my-zsh.

Configuration for Advanced install (config.yaml)

To manage packages, plugins, and themes, edit the config.yaml file and set the action flag to one of three options:

  • install: Install the package, plugin, or theme.
  • uninstall: Uninstall the package, plugin, or theme.
  • skip: Do nothing, leaving the current state unchanged.

Plugins and themes can be defined under the plugins section. Plugin names will be updated to reflect the last part of the URL for consistency.

config.yaml example

The below is a snippet of how config.yaml should be formatted. Please see the file downloaded from this repository for the full scope.

packages:
  make:
    action: install
    aliases: []
    eval: []
  jq:
    action: install
    aliases: []
    eval: []
  perl:
    action: install
    aliases: []
    eval:
      - "perl -I$HOME/perl5/lib/perl5 -Mlocal::lib=$HOME/perl5"
  neovim:
    action: install
    aliases:
      vim: "nvim"
    eval: []
  stow:
    action: skip
    aliases: []
    eval: []
  fzf:
    action: install
    aliases: []
    eval:
      - "fzf --zsh"
  bat:
    action: install
    aliases:
      cat: "bat --paging=never"
    eval: []
  eza:
    action: install
    aliases:
      ls: "eza --color=always --group-directories-first --icons"
      ll: "eza -la --icons --octal-permissions --group-directories-first --icons"
      l: "eza -bGF --header --git --color=always --group-directories-first --icons"
      llm: "eza -lbGd --header --git --sort=modified --color=always --group-directories-first --icons"
      la: "eza --long --all --group --group-directories-first"
      lx: "eza -lbhHigUmuSa@ --time-style=long-iso --git --color-scale --color=always --group-directories-first --icons"
      lS: "eza -1 --color=always --group-directories-first --icons"
      lt: "eza --tree --level=2 --color=always --group-directories-first --icons"
      l.: "eza -a | grep -E '^\\.'"
    eval: []
  thefuck:
    action: install
    aliases: []
    eval:
      - "thefuck --alias"
  zoxide:
    action: install
    aliases:
      cd: "z"
    eval:
      - "zoxide init zsh"
  jesseduffield/lazygit/lazygit:
    action: install
    aliases:
      lg: "lazygit"
    eval: []
plugins:
  powerlevel10k:
    action: install
    url: "https://github.com/romkatv/powerlevel10k"
    directory: "~/.oh-my-zsh/custom/themes/powerlevel10k"
    aliases: []
    eval: []
  kickstart.nvim:
    action: install
    url: "https://github.com/nvim-lua/kickstart.nvim"
    directory: "~/.config/nvim-kickstart"
    aliases:
      nvim: "NVIM_APPNAME=\"nvim-kickstart\" nvim"
    eval: []

Installed packages

Modify packages to be installed by editing config.yaml and setting the action flag to install, uninstall, or skip.

Package Description Dependency
brew Homebrew - The Missing Package Manager now for MacOS & Linux. Essential for: Synology-Homebrew
git Latest version replaces Synology Package Centre version. Essential for: Synology-Homebrew
ruby Latest version replaces Synology Package Centre version. Essential for: Synology-Homebrew
zsh UNIX shell (command interpreter). Essential for: Synology-Homebrew
python3 / pip3 Installed with clang-build-analyzer. Latest version 3.12.3 Essential for: Synology-Homebrew
glibc The GNU C Library - The project provides the core libraries for the GNU system. Essential for: Synology-Homebrew
gcc GNU compiler collection. Essential for: Synology-Homebrew
clang installed with clang-build-analyzer containing many essential tools. Essential for: Synology-Homebrew
oh-my-zsh Oh My Zsh is a delightful, open source, community-driven framework for managing your Zsh configuration. Essential for: Synology-Homebrew, zsh
jq Latest version of Lightweight and flexible command-line JSON processor Essential for: Synology-Homebrew
make Utility for directing compilation. Essential for: neovim plugins
node JavaScript runtime environment. Essential for: neovim
neovim Hyperextensible Vim-based text editor. Recommended for: Synology
powerlevel10k A theme for zsh. Recommended for: oh-my-zsh
zsh-syntax-highlighting A plugin for zsh. Recommended for: oh-my-zsh
zsh-autosuggestions A plugin for zsh. Recommended for: oh-my-zsh
ripgrep Ripgrep is a line-oriented search tool that recursively searches the current directory for a regex pattern. Essential for: neovim, telescope, fzf
fd Simple, fast and user-friendly alternative to find. Essential for: neovim, telescope
fzf A command-line fuzzy finder. Essential for: neovim, telescope
fzf-git.sh Bash and zsh key bindings for Git objects. Recommended for: neovim, telescope, fzf
bat A cat clone with syntax highlighting and Git integration. Recommended for: zsh, neovim
git-delta Language syntax highlighting for diff using a Levenshtein edit inference algorithm. Recommended for: neovim
eza A modern, maintained replacement for the venerable file-listing command-line program ls Recommended for: zsh, neovim
tldr The tldr-pages project is a collection of community-maintained help pages for command-line tools Recommended for: neovim
thefuck A magnificent app that corrects errors in previous console command. Recommended for: zsh
kickstart.nvim A starting point for Neovim. Optional for: neovim
perl Highly capable, feature-rich programming language. Essential for: stow
stow GNU Stow: Organize software neatly under a single directory tree. Optional
zoxide Zoxide is a smarter cd command, inspired by z and autojump Recommended for: zsh
lazygit AMAZING Simple terminal UI for git commands Recommended for: zsh, neovim

Neovim

Neovim (nvim) is ready to go with essential requirements configured within a separate file nvim_config.sh in which you can run indepenently to enable clipboard and further required files. This includes:

  • Enable clipboard over SSH using OSC52 for all nvim configurations stored or symlinked in ~/.config.
  • Linting Python with pip3 install pynvim.
  • Installing neovim gem.
  • Updating outdated gems.
  • Adding fzf-git.sh with Git key bindings to ~/.scripts directory.

Kickstart Neovim with Lazy (optional)

In the plugins section of config.yaml, set kickstart.nvim action: install to gp ahead and configure Neovim with kickstart.nvim. This provides a lazy configuration with everything working out of the box. It will be installed to the specified directory in config.yaml with a backup of any existing config to your home folder.

To switch between Neovim configurations easily, use aliases in ~/.zshrc and swap to your config:

alias nvim="NVIM_APPNAME=\"nvim-kickstart\" nvim"

# or for example if you have your own nvim config...

alias nvim="NVIM_APPNAME=\"nvim-mrcee\" nvim"

See kickstart.nvim provided in the config.yaml example above.

If no alias is set, Neovim will attempt to use the default nvim config location ~/.config/nvim

Run :checkhealth in Neovim after installation to see more detail about any further plugins you may need.

Customizing Your zsh

The Synology-Homebrew + Neovim setup comes pre-configured with a sleek Zsh theme and several useful plugins to enhance your command-line experience. Customize your zsh with ease using the p10k configure command and enjoy a fully tailored terminal environment.

Synology Task Scheduler to Persist Installation after Restart

To ensure the Homebrew directory is mounted after each restart, add a Triggered Task with a User-defined script. Go to Control Panel > Task Scheduler, click Create, and select Triggered Task >> User-defined Script and enter the following...

1st tab:

  • Task name: "Homebrew Boot"
  • User: root
  • Event: Boot-up
  • Enabled: True

2nd tab:

  • Paste the following User-defined script...
#!/bin/bash
[[ ! -d /home ]] && mkdir /home
mount -o bind "/volume1/homes" /home

Usage and Contributions

Refer to Homebrew documentation for usage instructions. Contributions are welcome! Open an issue or submit a pull request on GitHub for feedback or suggestions.

Disclaimer and License

This script is provided as-is without any warranty. Review and understand the script's changes to your system before running it. This project is licensed under the MIT License.

Acknowledgements

Thanks to the many people and teams that contribute to the packages installed by this script, the GitHub & Synology community, and some of the best on youtube. @ogerardin, @AppleBoiy, @josean-dev, @tjdevries.

About

A streamlined installation of Homebrew on Synology NAS, featuring libraries and packages to help you install what you need without conflicts. Perfect for enhancing your Synology NAS with additional software and tools.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages