2023-09-05 21:23:05 -07:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
# Activate the modified configuyrsation.nix
|
|
|
|
|
|
|
|
## Setup ##
|
|
|
|
|
|
|
|
DIR="$(dirname -- "${BASH_SOURCE[0]}")"
|
|
|
|
PROG="$(basename -- "${BASH_SOURCE[0]}")"
|
|
|
|
|
Finalize Working Version (#1)
* Add more GNOME helpers.
* Fix typo, adjust output.
* Update readme.
* Add more programs and a TBD.
* Add OpenJDK 8 as well.
* More programs, fix mlocate, start working on GNOME settings.
* Add success message.
* Fixing favorites, for some reason the files are different on NixOS than systems using Ansible.
* Add cron. Start working on header details.
* Modify Python configuration for ansible playbooks.
* More work on Python. Still not getting success with psutil.
* NixOS, python, and psutil are still being dumb with ansible.
* Add imagemagick for compressing file sizes.
* Automatically create backups the first time this is run each day.
* Create an example file.
* More comments, SSHD config, a few fixes, some TBDs, and general reorganization.
* Add a disclaimer.
* Make the file look more like a developer wrote it.
* Try adding wallets. Exodus seems broken. Monero works.
* Start trying a different route for dconf settings. May require "home manager".
* Add Docker.
* Create a static and ansible file. Import them, and give examples of what they are for.
* Add comments brainstorming how to do the different setups.
* Add home-manager. Still no luck with dconf. Not in Ansible either.
* Add godot.
* Add zsh.
* Move to Godot4.
* Remove extra space.
* Add balena etcher for USB sticks.
* Remove etcher, seems to have broken ability to update or install anything.
* Add a bittorrent client.
* Remove excess ssh ports. They were probably for testing.
2023-10-17 04:33:40 -07:00
|
|
|
nix_ext="nix"
|
|
|
|
nixos_dir="/etc/nixos"
|
|
|
|
date_YYYYMMDD="`date "+%Y%m%d"`"
|
|
|
|
backup_dir="$nixos_dir/${date_YYYYMMDD}_Backups"
|
|
|
|
|
2023-09-05 21:23:05 -07:00
|
|
|
## Main ##
|
|
|
|
|
|
|
|
echo "Requesting sudo password if it has not already been requested recently."
|
Finalize Working Version (#1)
* Add more GNOME helpers.
* Fix typo, adjust output.
* Update readme.
* Add more programs and a TBD.
* Add OpenJDK 8 as well.
* More programs, fix mlocate, start working on GNOME settings.
* Add success message.
* Fixing favorites, for some reason the files are different on NixOS than systems using Ansible.
* Add cron. Start working on header details.
* Modify Python configuration for ansible playbooks.
* More work on Python. Still not getting success with psutil.
* NixOS, python, and psutil are still being dumb with ansible.
* Add imagemagick for compressing file sizes.
* Automatically create backups the first time this is run each day.
* Create an example file.
* More comments, SSHD config, a few fixes, some TBDs, and general reorganization.
* Add a disclaimer.
* Make the file look more like a developer wrote it.
* Try adding wallets. Exodus seems broken. Monero works.
* Start trying a different route for dconf settings. May require "home manager".
* Add Docker.
* Create a static and ansible file. Import them, and give examples of what they are for.
* Add comments brainstorming how to do the different setups.
* Add home-manager. Still no luck with dconf. Not in Ansible either.
* Add godot.
* Add zsh.
* Move to Godot4.
* Remove extra space.
* Add balena etcher for USB sticks.
* Remove etcher, seems to have broken ability to update or install anything.
* Add a bittorrent client.
* Remove excess ssh ports. They were probably for testing.
2023-10-17 04:33:40 -07:00
|
|
|
sudo echo "Success!"
|
|
|
|
|
|
|
|
# Make a backup if one does not already exist for today.
|
|
|
|
if [[ ! -e "$backup_dir" ]]; then
|
|
|
|
echo -e "\nSaving backups for today."
|
|
|
|
sudo mkdir -pv "$backup_dir"
|
|
|
|
sudo cp -v "$nixos_dir"/*."$nix_ext" "$backup_dir"/
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Ensure unmaintained files exist for import.
|
|
|
|
nix_static=$nixos_dir/static.nix
|
|
|
|
if [[ ! -e $nix_static ]]; then
|
|
|
|
echo "Creating '$nix_static'."
|
|
|
|
echo -e "{ config, pkgs, nix, ... }:\n\n{\n #\n}" | sudo tee $nix_static
|
|
|
|
fi
|
|
|
|
nix_ansible=$nixos_dir/ansible.nix
|
|
|
|
if [[ ! -e $nix_ansible ]]; then
|
|
|
|
echo "Creating '$nix_ansible' from '$nix_static'."
|
|
|
|
cp -v $nix_static $nix_ansible
|
|
|
|
fi
|
2023-09-05 21:23:05 -07:00
|
|
|
|
|
|
|
# Start the chain.
|
Finalize Working Version (#1)
* Add more GNOME helpers.
* Fix typo, adjust output.
* Update readme.
* Add more programs and a TBD.
* Add OpenJDK 8 as well.
* More programs, fix mlocate, start working on GNOME settings.
* Add success message.
* Fixing favorites, for some reason the files are different on NixOS than systems using Ansible.
* Add cron. Start working on header details.
* Modify Python configuration for ansible playbooks.
* More work on Python. Still not getting success with psutil.
* NixOS, python, and psutil are still being dumb with ansible.
* Add imagemagick for compressing file sizes.
* Automatically create backups the first time this is run each day.
* Create an example file.
* More comments, SSHD config, a few fixes, some TBDs, and general reorganization.
* Add a disclaimer.
* Make the file look more like a developer wrote it.
* Try adding wallets. Exodus seems broken. Monero works.
* Start trying a different route for dconf settings. May require "home manager".
* Add Docker.
* Create a static and ansible file. Import them, and give examples of what they are for.
* Add comments brainstorming how to do the different setups.
* Add home-manager. Still no luck with dconf. Not in Ansible either.
* Add godot.
* Add zsh.
* Move to Godot4.
* Remove extra space.
* Add balena etcher for USB sticks.
* Remove etcher, seems to have broken ability to update or install anything.
* Add a bittorrent client.
* Remove excess ssh ports. They were probably for testing.
2023-10-17 04:33:40 -07:00
|
|
|
sleep 0 &&
|
2023-09-05 21:23:05 -07:00
|
|
|
|
|
|
|
# Essentials, jeez!
|
Finalize Working Version (#1)
* Add more GNOME helpers.
* Fix typo, adjust output.
* Update readme.
* Add more programs and a TBD.
* Add OpenJDK 8 as well.
* More programs, fix mlocate, start working on GNOME settings.
* Add success message.
* Fixing favorites, for some reason the files are different on NixOS than systems using Ansible.
* Add cron. Start working on header details.
* Modify Python configuration for ansible playbooks.
* More work on Python. Still not getting success with psutil.
* NixOS, python, and psutil are still being dumb with ansible.
* Add imagemagick for compressing file sizes.
* Automatically create backups the first time this is run each day.
* Create an example file.
* More comments, SSHD config, a few fixes, some TBDs, and general reorganization.
* Add a disclaimer.
* Make the file look more like a developer wrote it.
* Try adding wallets. Exodus seems broken. Monero works.
* Start trying a different route for dconf settings. May require "home manager".
* Add Docker.
* Create a static and ansible file. Import them, and give examples of what they are for.
* Add comments brainstorming how to do the different setups.
* Add home-manager. Still no luck with dconf. Not in Ansible either.
* Add godot.
* Add zsh.
* Move to Godot4.
* Remove extra space.
* Add balena etcher for USB sticks.
* Remove etcher, seems to have broken ability to update or install anything.
* Add a bittorrent client.
* Remove excess ssh ports. They were probably for testing.
2023-10-17 04:33:40 -07:00
|
|
|
echo -e "\nMaking sure that /bin/bash is available." &&
|
|
|
|
sudo ln -vfs `which bash` /bin/bash &&
|
|
|
|
|
|
|
|
# Install Home Manager for usage in configuration.nix type files.
|
|
|
|
echo -e "\nAdd Home Manager." &&
|
|
|
|
sudo nix-channel \
|
|
|
|
--add https://github.com/nix-community/home-manager/archive/master.tar.gz \
|
|
|
|
home-manager
|
|
|
|
sudo nix-channel --update
|
2023-09-05 21:23:05 -07:00
|
|
|
|
|
|
|
# Main install.
|
Finalize Working Version (#1)
* Add more GNOME helpers.
* Fix typo, adjust output.
* Update readme.
* Add more programs and a TBD.
* Add OpenJDK 8 as well.
* More programs, fix mlocate, start working on GNOME settings.
* Add success message.
* Fixing favorites, for some reason the files are different on NixOS than systems using Ansible.
* Add cron. Start working on header details.
* Modify Python configuration for ansible playbooks.
* More work on Python. Still not getting success with psutil.
* NixOS, python, and psutil are still being dumb with ansible.
* Add imagemagick for compressing file sizes.
* Automatically create backups the first time this is run each day.
* Create an example file.
* More comments, SSHD config, a few fixes, some TBDs, and general reorganization.
* Add a disclaimer.
* Make the file look more like a developer wrote it.
* Try adding wallets. Exodus seems broken. Monero works.
* Start trying a different route for dconf settings. May require "home manager".
* Add Docker.
* Create a static and ansible file. Import them, and give examples of what they are for.
* Add comments brainstorming how to do the different setups.
* Add home-manager. Still no luck with dconf. Not in Ansible either.
* Add godot.
* Add zsh.
* Move to Godot4.
* Remove extra space.
* Add balena etcher for USB sticks.
* Remove etcher, seems to have broken ability to update or install anything.
* Add a bittorrent client.
* Remove excess ssh ports. They were probably for testing.
2023-10-17 04:33:40 -07:00
|
|
|
echo -e "\nSwitching to the new configuration." &&
|
|
|
|
sudo cp "$DIR"/*."$nix_ext" "$nixos_dir"/ &&
|
2023-09-05 21:23:05 -07:00
|
|
|
sudo nixos-rebuild switch &&
|
Finalize Working Version (#1)
* Add more GNOME helpers.
* Fix typo, adjust output.
* Update readme.
* Add more programs and a TBD.
* Add OpenJDK 8 as well.
* More programs, fix mlocate, start working on GNOME settings.
* Add success message.
* Fixing favorites, for some reason the files are different on NixOS than systems using Ansible.
* Add cron. Start working on header details.
* Modify Python configuration for ansible playbooks.
* More work on Python. Still not getting success with psutil.
* NixOS, python, and psutil are still being dumb with ansible.
* Add imagemagick for compressing file sizes.
* Automatically create backups the first time this is run each day.
* Create an example file.
* More comments, SSHD config, a few fixes, some TBDs, and general reorganization.
* Add a disclaimer.
* Make the file look more like a developer wrote it.
* Try adding wallets. Exodus seems broken. Monero works.
* Start trying a different route for dconf settings. May require "home manager".
* Add Docker.
* Create a static and ansible file. Import them, and give examples of what they are for.
* Add comments brainstorming how to do the different setups.
* Add home-manager. Still no luck with dconf. Not in Ansible either.
* Add godot.
* Add zsh.
* Move to Godot4.
* Remove extra space.
* Add balena etcher for USB sticks.
* Remove etcher, seems to have broken ability to update or install anything.
* Add a bittorrent client.
* Remove excess ssh ports. They were probably for testing.
2023-10-17 04:33:40 -07:00
|
|
|
|
|
|
|
# Completed successfully.
|
|
|
|
echo -e "\nSuccess!" &&
|
2023-09-05 21:23:05 -07:00
|
|
|
exit 0
|
|
|
|
|
|
|
|
## Errors ##
|
|
|
|
|
|
|
|
status="$?"
|
|
|
|
echo "ERROR: A command failed with status $status, please check the output."
|
|
|
|
exit $status
|