work/root.sh

62 lines
1.3 KiB
Bash

#!/bin/bash
echo "##### build/root.sh"
export LANG="en_US.UTF-8"
export LANGUAGE="en_US:en"
set -x
set -e
TD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"
cd "$TD"
SSH_HOST_KEY_FILES="
ssh_host_ecdsa_key
ssh_host_ecdsa_key.pub
ssh_host_ed25519_key
ssh_host_ed25519_key.pub
ssh_host_rsa_key
ssh_host_rsa_key.pub
"
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
locale-gen en_US.UTF-8
update-locale LANG="en_US.UTF-8" LANGUAGE="en_US"
dpkg-reconfigure locales
for FN in $SSH_HOST_KEY_FILES ; do
rm -f /etc/ssh/$FN
ln -s /hostroot/etc/ssh/$FN /etc/ssh/$FN
done
#ln -s /hostroot/root /root/.home
# install other stuff here
# FIXME do these with nix:
#pip3 install -U pip
#pip3 install black
# install python packages
# install yarn
# install prettier
# install vim-go
# i don't know how to make the terraform-libvirt provider
# build with nix's libvirt, this works for now
apt update && apt install -y libvirt0
mkdir -p /home/user/.ssh
cp /root/.ssh/authorized_keys /home/user/.ssh/authorized_keys
chown -R user:user /home/user
echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/user
groupadd -g 131 docker
usermod -aG docker user
#mkdir -p /etc/nix
#echo 'sandbox = false' > /etc/nix/nix.conf
#chown -R user:user /nix /etc/nix