Improve README, remove broken zcc script and improve install script

This commit is contained in:
Tyler Kelley 2024-02-19 03:47:42 -06:00
parent 0409e3a16f
commit 662271c21d
4 changed files with 62 additions and 145 deletions

View File

@ -1,6 +1,9 @@
<div align="center">
# ZaneyOS 🟰 Best ❄️ NixOS Configs
# MAINTENANCE MODE: ACTIVE
*The repo is currently under active edits and may contain undocumented changes as well as possibly broken configurations. This is temporary and will change after the repository is stable!*
## ZaneyOS 🟰 Best ❄️ NixOS Configs
ZaneyOS is a way of reproducing my configuration on any NixOS system. This includes the wallpaper, scripts, applications, config files, and more. *Please remember to change username and hostname in flake.nix.*
@ -8,12 +11,21 @@ ZaneyOS is a way of reproducing my configuration on any NixOS system. This inclu
</div>
> [!IMPORTANT]
> This project has a [Wiki](https://gitlab.com/Zaney/zaneyos/-/wikis/home). Please read it to find out information on subjects that you may need to learn more about!
> **This project has a [Wiki](https://gitlab.com/Zaney/zaneyos/-/wikis/home). Please read it to find out information on subjects that you may need to learn more about!**
> **I have put a lot of effort into the documentation so it should be accurate. However, please if you notice that something is wrong with it create an issue or reach out to me on Discord.**
## READ THE WIKI
#### 🍖 Requirements
- You must be running on NixOS.
- Must have installed using GPT & UEFI.
- Change settings through script or manually editing options.nix file.
If you want to learn more about my system, [this project has a Wiki](https://gitlab.com/Zaney/zaneyos/-/wikis/home) that explains a ton. It even explains what NixOS is why you may want to choose it and so much more.
#### 🎹 Pipewire, Spotify, & Notification Menu Controls
- We are using the latest and greatest audio solution for Linux. If you like listening to music Spotify comes pre-installed out of the box. Not to mention you will have media and volume controls in the notification center available in the top bar.
#### 🏇 Optimized Workflow, tmpfs For Speed, & Simple Yet Elegant Neovim
- Using scratchpads with Hyprland for increased functionality and effeciency.
- A tmpfs for the /tmp directory is created improving rebuild time and reducing strain on hdd/ssd.
- No massive Neovim project here. This is my simple, easy to understand, yet incredible Neovim setup. You can grep recursively through entire folders and find specific files without ever leaving the text editor!
<div align="center">
@ -23,15 +35,45 @@ Please do yourself a favor and [read the wiki](https://gitlab.com/Zaney/zaneyos/
</div>
# Install / Steps To Reproduce My System
#### 📦 How To Install Packages?
- You can search the Nix Packages & Options pages for what a package may be named or if it has options available that take care of configuration hurdles you may face.
- To add a package there are the packages.nix files located in config/system and config/home folders. One is for programs available system wide and the other for your users environment only.
- Run this command to ensure Git is installed:
#### 🙋 Having Issues / Questions?
- Please feel free to raise an issue on the repo, please label a feature request with the title beginning with [feature request], thank you!
- Contact me on [Discord](https://discord.gg/2cRdBs8) as well, for a potentially faster response.
#### ⚠️ Important Changes!
- **The stable branch is gone, this means this project changes as my system changes. This will help with managing documentation. From now on before updating the repository please ensure the flake is not in maintenance mode. If an announcement has not been made on top of this page and Discord then its safe to pull and use the repository.**
- **Impermanence/persistence has been moved to only being sourced inside the hardware.nix file. If you want to use this feature then please read the Wiki page about how to implement it.**
### ⬇️ Install
#### 📜 Script:
This is the easiest and recommended way of starting out. The script is not meant to allow you to change every option that you can in the flake or help you install extra packages. It is simply here so you can get my configuration installed with as little chances of breakages and then fiddle to your hearts content!
Simply make sure you have git installed already or install it with:
```
nix-shell -p git vim
nix-shell -p git
```
- Clone this repo & enter it:
then run:
```
Coming Soon
```
#### 🦽 Manual:
Run this command to ensure Git & Vim are installed:
```
nix-shell -p git vim
```
Clone this repo & enter it:
```
git clone https://gitlab.com/zaney/zaneyos.git
@ -40,29 +82,21 @@ cd zaneyos
- *You should stay in this folder for the rest of the install*
**If you want to run a stable release you will need to run a command like this:**
**🪧🪧🪧 Edit options.nix 🪧🪧🪧**
```
git switch stable-1.0
```
### Change any options in options.nix that you may want / need to
- Generate your hardware.nix like so:
Generate your hardware.nix like so:
```
nixos-generate-config --show-hardware-config > hardware.nix
```
- Run this to enable flakes and install the flake:
Run this to enable flakes and install the flake replacing hostname with whatever you put in the options.nix file:
```
NIX_CONFIG="experimental-features = nix-command flakes"
sudo nixos-rebuild switch --flake .#thehostnameyousetinoptions.nix
sudo nixos-rebuild switch --flake .#hostname
```
## You Are Done!
This Flake's user will have the password be set for them as *password*. If you want to change it run a command replacing password with whatever you want to be your password. You then need to copy the output that it gives you like below into your hashedPassword in the system.nix file.
```

View File

@ -23,7 +23,6 @@ in {
(import ./../scripts/web-search.nix { inherit pkgs; })
(import ./../scripts/rofi-launcher.nix { inherit pkgs; })
(import ./../scripts/screenshootin.nix { inherit pkgs; })
(import ./../scripts/zcc.nix { inherit pkgs; })
];
programs.gh.enable = true;

View File

@ -1,121 +0,0 @@
{ pkgs, ... }:
let
inherit (import ../../options.nix) flakeDir flakePrev flakeBackup;
in
pkgs.writeShellScriptBin "zcc" ''
if [ "$#" -eq 0 ]; then
echo "The ZaneyOS Control Center requires an option like 'zcc [OPTION]'."
elif [ "$#" -eq 1 ]; then
if [ "$ZANEYOS" != /dev/null ]; then
choice="$1"
if [[ "$choice" = "update" ]]; then
# Add your update logic here
# If ~/zaneyos-previous exists, backup the configuration
if [[ -d ${flakePrev} ]]; then
# Check if ~/zaneyos-backup exists, otherwise create it
if [[ ! -d ${flakeBackup} ]]; then
mkdir ${flakeBackup}
fi
# Create a unique backup folder name with date and time
backup_folder=${flakeBackup}/$(date +"%Y%m%d%H%M%S")
# Backup previous configuration
sudo mv ${flakePrev} "$backup_folder"
echo "---"
echo "Previous configuration saved in $backup_folder"
fi
# Copy the previous repository
sudo cp -rp ${flakeDir} ${flakePrev}
echo "---"
echo "Actual configuration saved on $FLAKEPREV"
# Change directory
cd ${flakeDir} || exit 1
# Run git status to get only modified, tracked but not committed files
files_to_check=$(git status -s --untracked-files=no | awk '{print $2}')
# Stash changes and update the local repo from the remote one
echo "---"
echo "Updating zaneyos..."
git stash && git pull
# Show files to check to the user
echo "---"
echo "Files to review:"
echo $files_to_check
# Initialize the unresolved_files list
unresolved_files=()
# Verify and overwrite files if the user confirms or save files to be manually reviewed
for file in $files_to_check; do
echo "---"
echo "Differences on $file:"
diff "$file" ~/zaneyos-previous/"$file"
echo "---"
read -p "Overwrite file $file with your? [Y/n]: " choice
case "$choice" in
*)
cp ~/zaneyos-previous/"$file" "$file"
;;
n|N)
# Add the file to unresolved_files
unresolved_files+=("$file")
;;
esac
done
# If unresolved_files contains one or more files
if [[ ''${#unresolved_files[@]} -gt 0 ]]; then
# Show the user files to be manually reviewed and exit
echo "---"
echo "Review manually the following files:"
printf '%s\n' "''${unresolved_files[@]}"
else
# Prompt for updating flake.nix
echo "---"
read -p "Do you want to update flake? [Y/n]: " update_flake
update_flake=''${update_flake:-Y} # Set Y as default option
if [[ $update_flake == [Yy] ]]; then
# Run flake-update
echo "---"
echo "Running flake-update..."
sudo nix flake update ~/zaneyos
# Prompt for system rebuild
echo "---"
read -p "Do you want to rebuild the system? [Y/n]: " rebuild_system
rebuild_system=''${rebuild_system:-Y} # Set Y as default option
if [[ $rebuild_system == [Yy] ]]; then
# Run flake-rebuild
echo "---"
echo "Running flake-rebuild..."
sudo nixos-rebuild switch --flake ~/zaneyos
else
echo "---"
echo "Ok, the system will not be rebuilt"
fi
else
echo "---"
echo "Ok, flake will not be updated"
fi
fi
echo "---"
echo "Ok. Press any key to exit."
read -n 1 -s
elif [[ "$choice" = "install" ]]; then
echo "Installing..."
# Add logic for when the user chooses not to update
else
echo "Invalid option. Try zcc update or zcc install"
fi
else
echo "ZANEYOS is false"
fi
else
echo "Too many arguments. Please provide one argument."
fi
''

View File

@ -9,8 +9,13 @@ else
exit
fi
echo "Installing Git & Vim"
nix-shell -p git vim
if command -v git &> /dev/null; then
echo "Git is installed, continuing with installation."
else
echo "Git is not installed. Please install Git and try again."
echo "Example: nix-shell -p git"
exit 1
fi
echo "-----"