NixConfigLaptops/nixconf.sh

36 lines
1.4 KiB
Bash
Raw Normal View History

2023-02-10 23:10:24 +01:00
#!/bin/bash
2023-02-12 15:49:57 +01:00
#Wlan password:
pw="enter password here"
2023-02-11 00:27:02 +01:00
#nix-shell -p git
2023-02-12 10:15:11 +01:00
echo "=================================================="
echo "replacing config"
echo "=================================================="
2023-02-10 23:10:24 +01:00
cd /etc/nixos/
rm configuration.nix
2023-02-12 15:53:33 +01:00
git clone https://dev.spittank.org/SchoolDeviceMaintainers/NixConfig.git
2023-02-10 23:59:11 +01:00
cp /etc/nixos/NixConfig/configuration.nix /etc/nixos/
rm -r /etc/nixos/NixConfig/
2023-02-13 21:23:18 +01:00
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/
2023-02-12 10:15:11 +01:00
echo "=================================================="
sed -i "s/nixoslaptop/nixoslaptop$number/g" configuration.nix
2023-02-12 15:49:57 +01:00
read -p "name the device number" number
sed -i "s/xxxYYYxxx/$pw/g" configuration.nix
2023-02-12 10:15:11 +01:00
echo "=================================================="
echo "generating config"
echo "=================================================="
2023-02-10 23:10:24 +01:00
nixos-rebuild switch
2023-02-12 10:15:11 +01:00
echo "=================================================="
2023-02-10 23:10:24 +01:00
while true; do
read -p "reboot?" yn
case $yn in
[Yy]* ) reboot;;
[Nn]* ) exit;;
2023-02-12 10:15:11 +01:00
* ) echo "Please answer yes or no";;
2023-02-10 23:10:24 +01:00
esac
done