summaryrefslogtreecommitdiff
path: root/install-arch.sh
blob: fa0af1e99b09a4eb7b3297a88964cf657fcfe5eb (plain)
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
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
#!/bin/sh

# wiki
# https://wiki.archlinux.org/title/MacBookPro10,x

# #
# Pre-Script Setup
# #

# loadkeys de-latin1

# https://wiki.archlinux.org/title/Fdisk
# https://wiki.archlinux.org/title/Swap
# fdisk /dev/$DISK
# new partition
# set bootable
# new partition swap
# mkfs.ext4 /dev/$PART
# mkswap /dev/$SWAP

# iwctl --passphrase $PHRASE station wlan0 connect $SSID


PART=
SWAP=false
USER=dweipert

OPTS=$(getopt -o '' -l 'part:,swap::,user::' -- "$@")
eval set -- "$OPTS"

while true; do
  case "$1" in
    --part) PART="$2"; shift 2 ;;
    --swap) SWAP="$2"; shift 2 ;;
    --user) USER="$2"; shift 2 ;;
    --) shift; break ;;
    *) echo "ERROR"; break ;;
  esac
done


mount /dev/$PART /mnt
$SWAP && swapon /dev/$SWAP

timedatectl set-ntp true

reflector --country Germany --protocol https --latest 15 --save /etc/pacman.d/mirrorlist

pacstrap /mnt base base-devel linux linux-headers linux-firmware \
  iwd dhcpcd \
  broadcom-wl-dkms # for MacBookPro10,2

genfstab -U /mnt >> /mnt/etc/fstab


# #
# Pre chroot
# #

sed -i 's/#de_DE.UTF-8 UTF-8/de_DE.UTF-8 UTF-8/' /mnt/etc/locale.gen
sed -i 's/#en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /mnt/etc/locale.gen
sed -i 's/#ja_JP.UTF-8 UTF-8/ja_JP.UTF-8 UTF-8/' /mnt/etc/locale.gen


# #
# chroot
# #

arch-chroot /mnt

ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime
hwclock --systohc

locale-gen
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "LC_TIME=de_DE.UTF-8" >> /etc/locale.conf

echo "KEYMAP=de-latin1" > /etc/vconsole.conf

echo "archbook" > /etc/hostname

echo "127.0.0.1 localhost" >> /etc/hosts
echo "::1   localhost" >> /etc/hosts
echo "127.0.0.1 archbook.local archbook" >> /etc/hosts

# create user
useradd -G wheel -m $USER
passwd $USER

sed -i 's/# %wheel/%wheel/' /etc/sudoers

systemctl enable iwd
systemctl enable dhcpcd

echo "DONE"
echo "SETUP BOOTLOADER YOURSELF"
# https://wiki.archlinux.org/title/REFInd
# https://wiki.archlinux.org/title/GRUB
exit


# #
# Post Install
# #

mkdir -p $HOME/Applications
mkdir -p $HOME/Documents
mkdir -p $HOME/Downloads
mkdir -p $HOME/Images

# AUR
REPO="[options]
CacheDir = /var/cache/pacman/pkg
CacheDir = /var/cache/pacman/aurutils
CleanMethod = KeepCurrent

[aurutils]
SigLevel = Optional TrustAll
Server = file:///var/cache/pacman/aurutils"
sudo echo $REPO >> /etc/pacman.d/aurutils
sudo echo "Include = /etc/pacman.d/aurutils" >> /etc/pacman.conf

sudo install -d /var/cache/pacman/aurutils -o $USER
repo-add /var/cache/pacman/aurutils/aurutils.db.tar

sudo pacman -Syu git neovim
export AUR_PAGER=nvim

git clone https://aur.archlinux.org/aurutils.git $HOME/.local/share/aurutils/git
cd $HOME/.local/share/aurutils/git
makepkg -irs

# dotfiles
sudo pacman -Sy yadm
yadm clone https://gitlab.com/drogueronin/dotfiles

# CLI
sudo pacman -Sy \
  openssh zsh man-db \
  eza ripgrep fd starship \
  rclone fuse2 imagemagick \
  btop trash-cli pass git-bug \
  noto-fonts noto-fonts-cjk noto-fonts-emoji

yadm bootstrap

# Desktop
sudo pacman -Sy \
  sway swaybg alacritty waybar \
  libnotify mako \
  xorg-xwayland wofi \
  gammastep \
  alsa-utils brightnessctl \
	cups cups-pdf sane \
  imv grim slurp mpv \
  keepassxc wl-clipboard \
  qutebrowser \
	khal vdirsyncer

sudo systemctl enable cups.service --now
systemctl --user enable vdirsyncer.timer --now

# AUR installs
aur sync -r nerd-fonts-hack
aur sync -r autojump
aur sync -r sway-services-git
aur sync -r nnn-nerd

sudo pacman -Sy \
  nerd-fonts-hack \
  autojump \
  sway-services-git \
  nnn-nerd

# Japanese input
aur sync -ru fcitx5-mozc-ut
sudo pacman -Sy \
  fcitx5-mozc-ut \
  fcitx5-qt fcitx5-gtk \
  fcitx5-configtool

# printer
aur sync -r epson-inkjet-printer-escpr
sudo pacman -Sy epson-inkjet-printer-escpr

# nix
sudo pacman -Sy \
    nix

sed -i 's/# sandbox/sandbox/' /etc/nix/nix.conf

sudo systemctl enable nix-daemon --now

sudo usermod -aG nix-users $USER

nix-channel --add https://nixos.org/channels/nixpkgs-unstable
nix-channel --update
nix-env -u

## nix - debug help with "nix repl ."
echo "import <nixpkgs> {}" > ~/default.nix

# in case of "warning: Nix search path entry '/nix/var/nix/profiles/per-user/$USER/channels' does not exist, ignoring"
sudo mkdir /nix/var/nix/profiles/per-user/$USER
sudo ln -s $HOME/.nix-defexpr/channels /nix/var/nix/profiles/per-user/$USER/channels


# #
# Problem solving
# #

# in case of backlight problems
# acpi_osi=Linux

# SD Card Reader fix
# https://askubuntu.com/questions/695944/sd-card-doesnt-work-well-under-ubuntu-but-does-well-under-windows/704028#704028
# https://cialu.net/how-to-solve-broadcom-sd-card-reader-issue-with-linux/
# https://bbs.archlinux.org/viewtopic.php?id=244223
sudo echo "options sdhci debug_quirks=0x40" >> /etc/modprobe.d/sdhci-pci.conf
sudo echo "options sdhci debug_quirks2=4" >> /etc/modprobe.d/sdhci-pci.conf
sudo modprobe -r sdhci-pci sdhci
sudo modprobe sdhci-pci