-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
59 lines (47 loc) · 1.18 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# frozen_string_literal: true
HOME = ENV["HOME"]
PKGS_ALL = %w{atuin bat direnv fd fish fzf ripgrep starship zoxide}
PKGS_CONTAINER = PKGS_ALL | %w{delta lazygit neovim}
PKGS = {
"host" => PKGS_ALL,
"ar" => PKGS_CONTAINER | %w{[email protected]},
"sys" => PKGS_CONTAINER
}
DIRS = {
"#{HOME}/.local/share/backgrounds" => "backgrounds",
"#{HOME}/.config" => "config",
"#{HOME}/.local/bin/sys-setup" => "scripts/setup",
}
BREW = "/home/linuxbrew/.linuxbrew/bin/brew"
TARGET = ENV["CONTAINER_ID"] || "host"
IMAGE = "ghcr.io/david/devbox:latest"
desc "Setup current environment"
task :setup => "setup:default"
namespace :image do
task :create do
sh "distrobox", "create",
"--home=#{File.join(HOME, "Projects")}",
"--image=#{IMAGE}",
"--name=",
"--pull",
"--yes"
end
end
namespace :setup do
task default: ["clean", *DIRS.keys, "packages:#{TARGET}"]
task :clean do
DIRS.keys.each { |f| rm_f f }
end
DIRS.each do |k, v|
file k => v do |t|
ln_s File.expand_path(t.source), t.name
end
end
namespace :packages do
PKGS.each do |target, pkgs|
task target do
sh BREW, "install", "--quiet", *pkgs
end
end
end
end