aboutsummaryrefslogtreecommitdiff
path: root/scripts/hostclass/desktop
blob: 2a85f1665a6b299108ae290b1756872f9c9a2b5b (plain) (blame)
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
#!/bin/sh

load_kernel_module linux linux64 acpi_ibm

pkg install -y \
  chromium \
  compton \
  dino \
  dmenu \
  eclipse \
  firefox \
  git \
  krb5 \
  i3 \
  libreoffice \
  libva-intel-media-driver \
  networkmgr \
  py${python_version}-pip  \
  stow \
  terminus-font \
  terminus-ttf \
  tmux \
  tree \
  wireguard-tools \
  xfontsel \
  xidle \
  xorg \
  xterm

case $desktop_type in
  i3)
    pkg install \
      i3 \
      i3lock \
      i3status
    ;;
  kde)
    pkg install \
      juk \
      k3b \
      kde5 \
      kid3-qt6 \
      kmix \
      konversation \
      sddm
    ;;
esac

set_sysctl \
  net.local.stream.recvspace=65536 \
  net.local.stream.sendspace=65536 \
  kern.sched.preempt_thresh=224 \
  vfs.usermount=1 \
  hw.snd.latency=7

set_loader_conf \
  kern.ipc.shmseg=1024 \
  kern.ipc.shmmni=1024 \
  kern.maxproc=100000 \
  linux_load=YES \
  linux64_load=YES \
  acpi_ibm_load=YES \
  compat.linuxkpi.i915_enable_dc=2 \
  compat.linuxkpi.i915_enable_fbc=1 \
  compat.linuxkpi.i915_fastboot=1 \
  compat.linuxkpi.i915_disable_power_well=1 \
  machdep.hwpstate_pkg_ctrl=0 \
  vfs.zfs.txg.timeout=10 \
  hw.pci.do_power_nodriver=3

# Create policy file for firefox.
install_directory -m 0755 /usr/local/lib/firefox/distribution
install_template -m 0644  /usr/local/lib/firefox/distribution/policies.json

# Create policy file for chromium.
install_directory -m 0755 \
  /usr/local/etc/chromium/policies \
  /usr/local/etc/chromium/policies/managed
install_template -m 0644 /usr/local/etc/chromium/policies/managed/policies.json

# Configure libreoffice
install_file -m 0644 /usr/local/lib/libreoffice/program/sofficerc

# Add terminus font to X11
install_file -m 0644 /usr/local/etc/X11/xorg.conf.d/terminus.conf

# Enable dbus.
sysrc -v dbus_enable=YES
service dbus status || service dbus start

# Configure graphics drivers.
case $graphics_type in
  intel)
    pkg install -y drm-kmod
    sysrc -v kld_list+=i915kms
    load_kernel_module i915kms
    ;;
esac

# On some graphics cards, kern.vt.suspendswitch=1 (the default) breaks graphics
# acceleration after resuming from sleep.
set_sysctl kern.vt.suspendswitch="${vt_suspendswitch:-1}"