Update
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script is used to copy my own configuration to the `./hosts/guest` one, and changing some settings
|
||||
|
||||
[[ -d "./hosts" ]] || (
|
||||
echo "Folder ./hosts not found"
|
||||
exit 1
|
||||
)
|
||||
|
||||
LAPTOP_CONFIG="./hosts/laptop"
|
||||
GUEST_CONFIG="./hosts/guest"
|
||||
|
||||
# Remove the NVIDIA driver import
|
||||
config=$(cat "$LAPTOP_CONFIG/configuration.nix")
|
||||
config=$(echo "$config" | sed 's/..\/modules\/nvidia/# ..\/modules\/nvidia/')
|
||||
config=$(echo "$config" | sed 's/..\/modules\/prime/# ..\/modules\/prime/')
|
||||
echo "$config" >"$GUEST_CONFIG/configuration.nix"
|
||||
|
||||
variables=$(cat "$LAPTOP_CONFIG/variables.nix")
|
||||
variables=$(echo "$variables" | sed 's/112569860+anotherhadi@users.noreply.github.com/your_email/')
|
||||
variables=$(echo "$variables" | sed 's/hadi/your_username/')
|
||||
variables=$(echo "$variables" | sed 's/Hadi/your_username/')
|
||||
variables=$(echo "$variables" | sed 's/sops = true/sops = false/')
|
||||
variables=$(echo "$variables" | sed 's/obsidian = true/obsidian = false/')
|
||||
variables=$(echo "$variables" | sed 's/tailscale = true/tailscale = false/')
|
||||
echo "$variables" >"$GUEST_CONFIG/variables.nix"
|
||||
|
||||
home=$(cat "$LAPTOP_CONFIG/home.nix")
|
||||
home=$(echo "$home" | sed 's/\.\/secrets/# .\/secrets/')
|
||||
echo "$home" >"$GUEST_CONFIG/home.nix"
|
||||
@@ -1,78 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# https://github.com/anotherhadi/nixy
|
||||
# Installation script: Should be run on fresh nixos install.
|
||||
|
||||
printf "\n\e[0;92m- \e[0m\e[1;77mNixy's Installation Script\e[0;96m [anotherhadi/nixy]\e[0m"
|
||||
|
||||
# Check if we're on the good directory
|
||||
[[ -f "./docs/scripts/install.sh" ]] || (
|
||||
printf "\n\e[0;91mx \e[0m\e[1;77mNot in the project root directory\e[0m"
|
||||
exit 1
|
||||
)
|
||||
DIR=$PWD
|
||||
|
||||
# Create a new configuration
|
||||
read -rp $'\n\e[0;92m+\e[0m\e[1;77m Username: \e[0;96m' username
|
||||
read -rp $'\n\e[0;92m+\e[0m\e[1;77m Hostname: \e[0;96m' hostname
|
||||
|
||||
HOST_DIR="./hosts/$hostname"
|
||||
mkdir "$HOST_DIR"
|
||||
|
||||
nixos-generate-config --show-hardware-config >"$HOST_DIR/hardware-configuration.nix"
|
||||
|
||||
printf "\n\e[0;92m? \e[0m\e[1;77mInstall Nvidia drivers?\e[0;96m [y/N]\e[0m"
|
||||
read -r yn
|
||||
yn=$(echo "$yn" | tr '[:upper:]' '[:lower:]')
|
||||
if [[ $yn == "y" || $yn == "yes" ]]; then
|
||||
nvidia=true
|
||||
else
|
||||
nvidia=false
|
||||
fi
|
||||
|
||||
printf "\n\e[0;92m? \e[0m\e[1;77mInstall prime?\e[0;96m [y/N]\e[0m"
|
||||
read -r yn
|
||||
yn=$(echo "$yn" | tr '[:upper:]' '[:lower:]')
|
||||
if [[ $yn == "y" || $yn == "yes" ]]; then
|
||||
prime=true
|
||||
else
|
||||
prime=false
|
||||
fi
|
||||
|
||||
cp "$LAPTOP_CONFIG/configuration.nix" "$HOST_DIR/configuration.nix"
|
||||
cp "$LAPTOP_CONFIG/variables.nix" "$HOST_DIR/variables.nix"
|
||||
|
||||
config=$(cat "$LAPTOP_CONFIG/configuration.nix")
|
||||
if [[ $nvidia == false ]]; then
|
||||
config=$(echo "$config" | sed 's/..\/shared\/nvidia/# ..\/shared\/nvidia/')
|
||||
fi
|
||||
if [[ $prime == false ]]; then
|
||||
config=$(echo "$config" | sed 's/..\/shared\/prime/# ..\/shared\/prime/')
|
||||
fi
|
||||
echo "$config" >"$HOST_DIR/configuration.nix"
|
||||
|
||||
variables=$(cat "$LAPTOP_CONFIG/variables.nix")
|
||||
variables=$(echo "$variables" | sed 's/112569860+anotherhadi@users.noreply.github.com/your_email/')
|
||||
variables=$(echo "$variables" | sed "s/hadi/$username/")
|
||||
variables=$(echo "$variables" | sed "s/nixy/$hostname/") # FIXME: Host name can be mixed with themes
|
||||
variables=$(echo "$variables" | sed "s/Hadi/$username/")
|
||||
variables=$(echo "$variables" | sed 's/sops = true/sops = false/')
|
||||
variables=$(echo "$variables" | sed 's/obsidian = true/obsidian = false/')
|
||||
variables=$(echo "$variables" | sed 's/tailscale = true/tailscale = false/')
|
||||
echo "$variables" >"$HOST_DIR/variables.nix"
|
||||
|
||||
# Add it to the git index
|
||||
git add .
|
||||
|
||||
printf "\n\e[0;92m+ \e[0m\e[1;77mHost added!\e[0m"
|
||||
|
||||
# REBUILD
|
||||
|
||||
printf "\n\e[0;92m? \e[0m\e[1;77mDo you want to rebuild?\e[0;96m [y/N]\e[0m"
|
||||
read -r yn
|
||||
yn=$(echo "$yn" | tr '[:upper:]' '[:lower:]')
|
||||
if [[ $yn == "y" || $yn == "yes" ]]; then
|
||||
sudo nixos-rebuild switch --flake "$DIR"#"$hostname"
|
||||
fi
|
||||
|
||||
printf "\n\e[0;92m✓ \e[0m\e[1;77mDone!\e[0m"
|
||||
@@ -20,9 +20,8 @@ It's a simple way to manage your system configuration and dotfiles.
|
||||
- 'system' is some desktop environment like configuration
|
||||
- 'wallpapers' are... wallpapers
|
||||
- 💻 `hosts` are the system configuration files
|
||||
- 'laptop' is my configuration for my laptop with Nvidia
|
||||
- 'laptop' is my configuration for my laptop with Nvidia that you can copy
|
||||
- 'server' is for my homeserver (w/nextcloud, nginx, vaultwarden, ... look `hosts/server`)
|
||||
- 'guest' is a *template* that you can copy and modify for *your own system*
|
||||
- 'themes' contains all the *themes* available *(see [THEMES.md](docs/THEMES.md))*
|
||||
- 'modules' are some nix modules that you can import (Nvidia, prime, fonts, ...)
|
||||
|
||||
@@ -32,9 +31,9 @@ It's a simple way to manage your system configuration and dotfiles.
|
||||
git clone https://github.com/anotherhadi/nixy ~/.config/nixos
|
||||
```
|
||||
|
||||
- Copy the `hosts/guest` folder, rename it to your system name, and change the variables inside the `variables.nix` file
|
||||
- Copy the `hosts/laptop` folder, rename it to your system name, and change the variables inside the `variables.nix` file
|
||||
- Add your `hardware-configuration.nix` to your new host's folder
|
||||
- Add your 'nixosConfigurations' inside `flake.nix` (You can edit the "yourhostname" one and change the lines containing '# CHANGEME')
|
||||
- Add your 'nixosConfigurations' inside `flake.nix` (You can edit your hostname one and change the lines containing '# CHANGEME')
|
||||
|
||||
> [!NOTE]
|
||||
> When you add new files, don't forget to run `git add .` to add them to the git repository
|
||||
|
||||
Reference in New Issue
Block a user