You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

101 lines
2.9 KiB

  1. #!/bin/sh
  2. # vim: set ft=sh sw=2 et :
  3. install_nix() {
  4. # This one courtesy of:
  5. # https://github.com/shadowrylander/shadowrylander/blob/35bb51822c46578d0a5da5810263fa85d464043c/.config/yadm/bootstrap#L56
  6. install_nix_bin() {
  7. # Single User install
  8. # Alternate nix-daemon path: . /nix/var/nix/profiles/per-user/${USER}/profile/etc/profile.d/nix-daemon.sh
  9. # curl -L https://nixos.org/nix/install | sh
  10. #. $HOME/.nix-profile/etc/profile.d/nix.sh
  11. # For Multi-User install
  12. curl -L https://nixos.org/nix/install | sh -s -- --daemon --yes
  13. . '/nix/var/nix/profiles/default/etc/profile.d/nix-daemon.sh'
  14. if [ -f "$HOME/.config/nix/installed_packages" ]; then
  15. # This list created with `nix-env -qaPs|grep '^I'|awk '{print $2}' > ~/.config/nix/installed_packages`
  16. cat "$HOME/.config/nix/installed_packages" | xargs nix-env -iA
  17. fi
  18. }
  19. command -v nix >/dev/null 2>&1 || install_nix_bin
  20. }
  21. configure_vim() {
  22. # Install vim-plug for Vim
  23. #curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  24. #vim +'PlugInstall --sync' +qa
  25. # Install vim-plug for Neovim
  26. # This is temporary disable, because that it hundreds modules and many error on compilation stage of this
  27. curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
  28. nvim +'PlugInstall --sync' +qa
  29. }
  30. install_starship() {
  31. # https://starship.rs/guide/#%F0%9F%9A%80-installation
  32. curl -sS https://starship.rs/install.sh | sh -s -- -f
  33. }
  34. install_spacevim() {
  35. # https://habr.com/ru/companies/cloud4y/articles/574450/
  36. curl -sLf https://spacevim.org/install.sh | bash
  37. }
  38. download_font() {
  39. url="https://raw.githubusercontent.com/ryanoasis/nerd-fonts/master/patched-fonts/SourceCodePro/Regular/complete/${1// /%20}"
  40. path="/usr/share/fonts/$1"
  41. if [[ -f "$path" && ! -s "$path" ]]; then
  42. rm "$path"
  43. fi
  44. if [[ -f "$path" ]]; then
  45. success "Downloaded $1"
  46. else
  47. info "Downloading $1"
  48. curl -s -o "$path" "$url"
  49. success "Downloaded $1"
  50. fi
  51. }
  52. install_fonts() {
  53. download_font "Sauce Code Pro Nerd Font Complete.ttf"
  54. info "Updating font cache, please wait ..."
  55. fc-cache -fv >/dev/null
  56. success "font cache done!"
  57. }
  58. install_pathogen() {
  59. mkdir -p ~/.vim/autoload ~/.vim/bundle
  60. curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
  61. }
  62. install_vim_plugins() {
  63. cd ~/.vim/bundle
  64. git clone https://github.com/tpope/vim-sensible.git
  65. git clone https://github.com/altercation/vim-colors-solarized.git
  66. git clone https://github.com/cespare/vim-toml.git
  67. }
  68. # That is not work, because starship.toml not exists on the bootstrap stage
  69. #change_starship_character() {
  70. # # shellcheck disable=SC2039
  71. # if [[ "$USER" != root ]]; then
  72. # sed -i 's/#/\\$/g' "$HOME"/.config/starship.toml
  73. # fi
  74. #}
  75. #install_nix
  76. #configure_vim
  77. #install_starship
  78. #install_spacevim
  79. install_pathogen
  80. install_vim_plugins
  81. #change_starship_character