63 lines
2.3 KiB
Nix
63 lines
2.3 KiB
Nix
# ready to use customizations to apply on images
|
|
{ pkgs, lib, system, commons, ... }:
|
|
with commons;
|
|
with scriptsNFiles;
|
|
{
|
|
# essential functionalities like ssh, networking etc
|
|
essentials = {
|
|
install = [ "htop" "openssh-server" "inetutils-ping" "dnsutils" "cloud-guest-utils" "qemu-guest-agent" ];
|
|
commands = ''
|
|
upload ${grub-ifnames-0}:/etc/default/grub.d/90-ifnames-0.cfg
|
|
upload ${grub-disable-microcode}:/etc/default/grub.d/00-disable-microcode.cfg
|
|
run-command mount /boot/efi && update-grub
|
|
upload ${eth0-dhcp-network}:/etc/systemd/network/00-eth0-dhcp.network
|
|
run ${ssh-service-override-conf-create}
|
|
upload ${grow-root-sh}:/usr/local/sbin/grow-root.sh
|
|
upload ${grow-root-service}:/etc/systemd/system/grow-root.service
|
|
run-command systemctl enable grow-root.service
|
|
'';
|
|
};
|
|
|
|
# set easy root access
|
|
rooted = {
|
|
run = ''
|
|
# set root password and ssh access
|
|
echo "root:root" | chpasswd
|
|
sed -i '/PasswordAuthentication no/d' "/etc/ssh/sshd_config"
|
|
echo "PasswordAuthentication yes\nPermitRootLogin yes" >> "/etc/ssh/sshd_config"
|
|
'';
|
|
};
|
|
|
|
# install proxmox
|
|
proxmoxOnDebian12 = {
|
|
diskSize = "+2G";
|
|
smp = 4;
|
|
memSize = 4096;
|
|
run = ''
|
|
# script originally taken from https://pve.proxmox.com/wiki/Install_Proxmox_VE_on_Debian_12_Bookworm
|
|
# exit if error
|
|
set -e
|
|
|
|
# grow root partition - script installed in "base" image
|
|
/usr/local/sbin/grow-root.sh
|
|
|
|
# mount efi for grub changes
|
|
mount /boot/efi
|
|
|
|
# add proxmox repo
|
|
echo "deb [arch=amd64] http://download.proxmox.com/debian/pve bookworm pve-no-subscription" > /etc/apt/sources.list.d/pve-install-repo.list
|
|
wget https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg -O /etc/apt/trusted.gpg.d/proxmox-release-bookworm.gpg
|
|
apt-get update && apt full-upgrade -y --no-install-recommends;
|
|
|
|
# necessary precursors
|
|
echo "0.0.0.0\t\t`cat /etc/hostname`" >> /etc/hosts; # necessary for SSL certificate creation
|
|
mkdir -p /run/network; # bug https://github.com/CumulusNetworks/ifupdown2/issues/276
|
|
|
|
# install
|
|
apt install -y proxmox-default-kernel proxmox-ve postfix open-iscsi chrony --no-install-recommends;
|
|
|
|
# remove previous kernels
|
|
apt remove -y os-prober linux-image-amd64 'linux-image-6.*';
|
|
'';
|
|
};
|
|
}
|