refactor(core): move the zsh module over to configz

This commit is contained in:
Ade Attwood 2023-11-25 11:31:26 +00:00
parent fe53b83ca9
commit 4742f38122
3 changed files with 51 additions and 63 deletions

View file

@ -3,3 +3,4 @@ require "modules.lua-lsp"
require "modules.nvim"
require "modules.nvm"
require "modules.tmux"
require "modules.zsh"

50
modules/zsh.lua Normal file
View file

@ -0,0 +1,50 @@
local git = require "lib.git"
local zsh_dir = os.getenv "HOME" .. "/.oh-my-zsh"
git.repo { src = "https://github.com/ohmyzsh/ohmyzsh.git", target = zsh_dir, version = "master" }
local zshrc = os.getenv "HOME" .. "/.zshrc"
if not configz.is_file(zshrc) then
configz.link(zshrc, {
source = os.getenv "PWD" .. "/site-modules/core/files/zshrc",
})
end
configz.directory(zsh_dir .. "/custom/plugins")
if not configz.is_directory(zsh_dir .. "/custom/custom") then
configz.link(zsh_dir .. "/custom/custom", {
source = os.getenv "PWD" .. "/site-modules/core/oh-my-zsh/custom",
})
end
if not configz.is_directory(zsh_dir .. "/custom/lib") then
configz.link(zsh_dir .. "/custom/lib", {
source = os.getenv "PWD" .. "/site-modules/core/oh-my-zsh/lib",
})
end
if not configz.is_file(zsh_dir .. "/custom/custom.zsh") then
configz.link(zsh_dir .. "/custom/custom.zsh", {
source = os.getenv "PWD" .. "/site-modules/core/oh-my-zsh/custom.zsh",
})
end
if not configz.is_directory(zsh_dir .. "/custom/plugins/notmuch") then
configz.link(zsh_dir .. "/custom/plugins/notmuch", {
source = os.getenv "PWD" .. "/site-modules/core/oh-my-zsh/plugins/notmuch",
})
end
git.repo {
src = "https://github.com/zsh-users/zsh-autosuggestions",
target = zsh_dir .. "/custom/plugins/zsh-autosuggestions",
version = "master",
}
git.repo {
src = "https://github.com/zsh-users/zsh-syntax-highlighting.git",
target = zsh_dir .. "/custom/plugins/zsh-syntax-highlighting",
version = "master",
}

View file

@ -1,63 +0,0 @@
class core::zsh {
vcsrepo { "${user_home}/.oh-my-zsh":
source => 'https://github.com/ohmyzsh/ohmyzsh.git',
provider => 'git',
user => $user,
revision => 'master',
}
file { "${user_home}/.zshrc":
ensure => 'link',
owner => $user,
target => find_file('core/zshrc'),
}
file { "${user_home}/.oh-my-zsh/custom/plugins":
ensure => 'directory',
owner => $user,
}
file {"${user_home}/.oh-my-zsh/custom/custom":
ensure => 'link',
owner => $user,
target => find_file('core/oh-my-zsh/custom'),
require => [Vcsrepo["${user_home}/.oh-my-zsh"]],
force => true,
}
file {"${user_home}/.oh-my-zsh/custom/lib":
ensure => 'link',
owner => $user,
target => find_file('core/oh-my-zsh/lib'),
require => [Vcsrepo["${user_home}/.oh-my-zsh"]],
force => true,
}
file {"${user_home}/.oh-my-zsh/custom/custom.zsh":
ensure => 'link',
owner => $user,
target => find_file('core/oh-my-zsh/custom.zsh'),
require => [Vcsrepo["${user_home}/.oh-my-zsh"]],
force => true,
}
file {"${user_home}/.oh-my-zsh/custom/plugins/notmuch":
ensure => 'link',
owner => $user,
target => find_file('core/oh-my-zsh/plugins/notmuch'),
require => [Vcsrepo["${user_home}/.oh-my-zsh"]],
force => true,
}
vcsrepo { "${user_home}/.oh-my-zsh/custom/plugins/zsh-autosuggestions":
source => 'https://github.com/zsh-users/zsh-autosuggestions',
provider => 'git',
user => $user,
}
vcsrepo { "${user_home}/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting":
source => 'https://github.com/zsh-users/zsh-syntax-highlighting.git',
provider => 'git',
user => $user,
}
}