-
Notifications
You must be signed in to change notification settings - Fork 49
Expand file tree
/
Copy pathVagrantfile
More file actions
180 lines (145 loc) · 5.18 KB
/
Copy pathVagrantfile
File metadata and controls
180 lines (145 loc) · 5.18 KB
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
171
172
173
174
175
176
177
178
179
180
# SPDX-FileCopyrightText: 2021 Aleksandr Mezin <mezin.alexander@gmail.com>
#
# SPDX-License-Identifier: GPL-3.0-or-later
# See docs/Vagrant.md
# In case of "`virbr0': No such device" do:
#
# sudo virsh net-start default
require 'open3'
require 'pathname'
CPUS = 4
MEMORY = 8192
PROJECT_DIR = Pathname.new(__FILE__).realpath.dirname
SYNCED_FOLDER = "/home/vagrant/#{PROJECT_DIR.basename}"
UUID = 'ddterm@amezin.github.com'
EXTENSION_BUNDLE = Pathname.getwd / ENV.fetch('EXTENSION_BUNDLE') do |; bundles|
bundles = Pathname.getwd.glob('**/*.shell-extension.zip')
raise 'Found no extension bundle in the current directory or subdirectories, use meson devenv' if bundles.empty?
raise "Found multiple extension bundles: #{bundles}, use meson devenv" if bundles.length > 1
bundles[0]
end
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: EXTENSION_BUNDLE,
destination: "$HOME/#{EXTENSION_BUNDLE.basename}",
before: 'install',
run: 'always'
config.vm.provision 'install', type: 'shell', privileged: false, run: 'always', inline: <<-SCRIPT
gnome-extensions install -f $HOME/#{EXTENSION_BUNDLE.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 "fedora43", autostart: false do |version|
version.vm.box = "gnome-shell-box/fedora43"
end
config.vm.define "silverblue43", autostart: false do |version|
version.vm.box = "gnome-shell-box/silverblue43"
end
config.vm.define "fedora44", autostart: false do |version|
version.vm.box = "gnome-shell-box/fedora44"
end
config.vm.define "silverblue44", autostart: false do |version|
version.vm.box = "gnome-shell-box/silverblue44"
end
config.vm.define "ubuntu2404", autostart: false do |version|
version.vm.box = "gnome-shell-box/ubuntu2404"
end
config.vm.define "ubuntu2510", autostart: false do |version|
version.vm.box = "gnome-shell-box/ubuntu2510"
end
config.vm.define "ubuntu2604", autostart: false do |version|
version.vm.box = "gnome-shell-box/ubuntu2604"
end
config.vm.define "debian13", autostart: false do |version|
version.vm.box = "gnome-shell-box/debian13"
end
config.vm.define "opensuseleap16", autostart: false do |version|
version.vm.box = "gnome-shell-box/opensuseleap16"
end
config.vm.define "opensusetumbleweed", autostart: false do |version|
version.vm.box = "gnome-shell-box/opensusetumbleweed"
end
config.vm.define "nixos", autostart: false do |version|
version.vm.box = "gnome-shell-box/nixos"
end
config.vm.define "archlinux", autostart: false do |version|
version.vm.box = "gnome-shell-box/archlinux"
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
config.vm.define "alpine322", autostart: false do |version|
version.vm.box = "gnome-shell-box/alpine322"
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 "alpine323", autostart: false do |version|
version.vm.box = "gnome-shell-box/alpine323"
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 "alpine324", autostart: false do |version|
version.vm.box = "gnome-shell-box/alpine324"
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