-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathVagrantfile
170 lines (136 loc) · 4.85 KB
/
Vagrantfile
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
# SPDX-FileCopyrightText: 2021 Aleksandr Mezin <[email protected]>
#
# SPDX-License-Identifier: GPL-3.0-or-later
# See docs/Vagrant.md
require 'open3'
require 'pathname'
CPUS = 4
MEMORY = 4096
PROJECT_DIR = Pathname.new(__FILE__).realpath.dirname
SYNCED_FOLDER = "/home/vagrant/#{PROJECT_DIR.basename}"
UUID = '[email protected]'
PACK_FILE_FALLBACK = Pathname.getwd / "#{UUID}.shell-extension.zip"
PACK_FILE_FALLBACK_LEGACY = Pathname.getwd / "#{UUID}.legacy.shell-extension.zip"
if not PACK_FILE_FALLBACK.exist? and PACK_FILE_FALLBACK_LEGACY.exist?
PACK_FILE_FALLBACK = PACK_FILE_FALLBACK_LEGACY
end
PACK_FILE = Pathname.getwd / ENV.fetch('DDTERM_BUILT_PACK', PACK_FILE_FALLBACK.to_s)
stdout, status = Open3.capture2(
'git',
'ls-files',
'--exclude-standard',
'-oi',
'--deduplicate',
'--directory',
'--no-empty-directory',
'--full-name',
':/'
)
if status.success?
rsync_excludes = stdout.split(/\n/).map { |p| "/#{p}" }
else
rsync_excludes = []
end
rsync_args = [
'-avcS',
'--exclude-from=.gitignore',
]
Vagrant.configure("2") do |config|
config.vagrant.plugins = 'vagrant-libvirt'
config.vm.provider 'libvirt' do |libvirt, override|
libvirt.qemu_use_session = true
libvirt.cpus = CPUS
libvirt.memory = MEMORY
libvirt.cputopology :sockets => '1', :cores => "#{CPUS}", :threads => '1'
end
config.vm.synced_folder '.', '/vagrant', disabled: true
config.vm.synced_folder '.', SYNCED_FOLDER,
type: 'rsync',
rsync__exclude: rsync_excludes,
rsync__args: rsync_args
config.vm.provision 'copy',
type: 'file',
source: PACK_FILE,
destination: "$HOME/#{PACK_FILE.basename}",
before: 'install',
run: 'always'
config.vm.provision 'install', type: 'shell', privileged: false, run: 'always', inline: <<-SCRIPT
gnome-extensions install -f $HOME/#{PACK_FILE.basename}
if [ -z "$DBUS_SESSION_BUS_ADDRESS" ] && [ -z "$XDG_RUNTIME_DIR" ]; then
dbus-run-session -- gnome-extensions enable #{UUID}
else
gnome-extensions enable #{UUID}
fi
SCRIPT
config.vm.provision 'reload', type: 'shell', run: 'always', after: 'install', inline: <<-SCRIPT
if [ "$(loginctl show-user --property=State --value vagrant)" = "active" ]; then
loginctl terminate-user vagrant
fi
SCRIPT
config.vm.define "fedora41", autostart: false do |version|
version.vm.box = "gnome-shell-box/fedora41"
end
config.vm.define "silverblue41", autostart: false do |version|
version.vm.box = "gnome-shell-box/silverblue41"
end
config.vm.define "fedora40", autostart: false do |version|
version.vm.box = "gnome-shell-box/fedora40"
end
config.vm.define "silverblue40", autostart: false do |version|
version.vm.box = "gnome-shell-box/silverblue40"
end
config.vm.define "ubuntu2204", autostart: false do |version|
version.vm.box = "gnome-shell-box/ubuntu2204"
end
config.vm.define "ubuntu2404", primary: true do |version|
version.vm.box = "gnome-shell-box/ubuntu2404"
end
config.vm.define "ubuntu2410", autostart: false do |version|
version.vm.box = "gnome-shell-box/ubuntu2410"
end
config.vm.define "opensusetumbleweed", autostart: false do |version|
version.vm.box = "gnome-shell-box/opensusetumbleweed"
end
config.vm.define "opensuseleap156", autostart: false do |version|
version.vm.box = "gnome-shell-box/opensuseleap156"
end
config.vm.define "debian12", autostart: false do |version|
version.vm.box = "gnome-shell-box/debian12"
end
config.vm.define "alpine318", autostart: false do |version|
version.vm.box = "gnome-shell-box/alpine318"
version.ssh.sudo_command = "doas -n -u root %c"
version.vm.synced_folder '.', SYNCED_FOLDER,
type: 'rsync',
rsync__exclude: rsync_excludes,
rsync__rsync_path: 'doas -u root rsync',
rsync__args: rsync_args
end
config.vm.define "alpine319", autostart: false do |version|
version.vm.box = "gnome-shell-box/alpine319"
version.ssh.sudo_command = "doas -n -u root %c"
version.vm.synced_folder '.', SYNCED_FOLDER,
type: 'rsync',
rsync__exclude: rsync_excludes,
rsync__rsync_path: 'doas -u root rsync',
rsync__args: rsync_args
end
config.vm.define "alpine320", autostart: false do |version|
version.vm.box = "gnome-shell-box/alpine320"
version.ssh.sudo_command = "doas -n -u root %c"
version.vm.synced_folder '.', SYNCED_FOLDER,
type: 'rsync',
rsync__exclude: rsync_excludes,
rsync__rsync_path: 'doas -u root rsync',
rsync__args: rsync_args
end
config.vm.define "alpine321", autostart: false do |version|
version.vm.box = "gnome-shell-box/alpine321"
version.ssh.sudo_command = "doas -n -u root %c"
version.vm.synced_folder '.', SYNCED_FOLDER,
type: 'rsync',
rsync__exclude: rsync_excludes,
rsync__rsync_path: 'doas -u root rsync',
rsync__args: rsync_args
end
end