NixConfigLaptops/nixconf.sh
2023-02-13 21:23:18 +01:00

35 lines
1.4 KiB
Bash

#!/bin/bash
#Wlan password:
pw="enter password here"
#nix-shell -p git
echo "=================================================="
echo "replacing config"
echo "=================================================="
cd /etc/nixos/
rm configuration.nix
git clone https://dev.spittank.org/SchoolDeviceMaintainers/NixConfig.git
cp /etc/nixos/NixConfig/configuration.nix /etc/nixos/
rm -r /etc/nixos/NixConfig/
cd /nix/var/nix/profiles/per-user/root/channels-1-link/nixos/nixos/modules/system/boot
rm tmp.nix
git clone https://dev.spittank.org/SchoolDeviceMaintainers/NixConfig.git
cp /nix/var/nix/profiles/per-user/root/channels-1-link/nixos/nixos/modules/system/boot/NixConfig/tmp.nix /nix/var/nix/profiles/per-user/root/channels-1-link/nixos/nixos/modules/system/boot/
rm -r /nix/var/nix/profiles/per-user/root/channels-1-link/nixos/nixos/modules/system/boot/NixConfig/
echo "=================================================="
sed -i "s/nixoslaptop/nixoslaptop$number/g" configuration.nix
read -p "name the device number" number
sed -i "s/xxxYYYxxx/$pw/g" configuration.nix
echo "=================================================="
echo "generating config"
echo "=================================================="
nixos-rebuild switch
echo "=================================================="
while true; do
read -p "reboot?" yn
case $yn in
[Yy]* ) reboot;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no";;
esac
done