script update
This commit is contained in:
parent
aa440d7660
commit
cf53c2fdad
@ -5,7 +5,5 @@
|
||||
- to start installation you can simply run:
|
||||
|
||||
```bash
|
||||
nix-shell -p git --command "nix run --experimental-features 'nix-command flakes' github:foglar/nixos-config"
|
||||
# or
|
||||
nix-shell -p git --command "nix run --experimental-features 'nix-command flakes' git+https://git.foglar.tech/foglar/dotfiles.git"
|
||||
nix-shell -p git --command "nix run --experimental-features 'nix-command flakes' git+https://git.foglar.tech/foglar/psychonix-install.git"
|
||||
```
|
||||
|
||||
38
install.sh
38
install.sh
@ -6,47 +6,47 @@ else
|
||||
SCRIPT_DIR=~/.dotfiles
|
||||
fi
|
||||
|
||||
if [ -d $SCRIPT_DIR ]; then
|
||||
gum confirm "The directory $SCRIPT_DIR already exists. Do you want to delete it?" && yes | rm -rv $SCRIPT_DIR
|
||||
if [ -d "$SCRIPT_DIR" ]; then
|
||||
gum confirm "The directory $SCRIPT_DIR already exists. Do you want to delete it?" && rm -rfv "$SCRIPT_DIR"
|
||||
fi
|
||||
|
||||
nixos_profile=$(gum choose kogami ginoza)
|
||||
download_wallpapers=$(gum confirm "Do you want to download wallpapers (it may take longer)?" && echo true || echo false)
|
||||
|
||||
if [ -d $SCRIPT_DIR ]; then
|
||||
if [ -d "$SCRIPT_DIR" ]; then
|
||||
gum log --structured --level warn "The directory $SCRIPT_DIR already exists. Downloading updates..."
|
||||
cd $SCRIPT_DIR && git pull
|
||||
cd "$SCRIPT_DIR" && git pull
|
||||
else
|
||||
nix-shell -p git --command "git clone https://git.foglar.tech/foglar/dotfiles.git $SCRIPT_DIR"
|
||||
fi
|
||||
|
||||
sudo nixos-generate-config --show-hardware-config >$SCRIPT_DIR/kogami/hardware-configuration.nix
|
||||
gum log --structured --level info "Creating hardware configuration..." file $SCRIPT_DIR/kogami/hardware-configuration.nix
|
||||
sudo nixos-generate-config --show-hardware-config >$SCRIPT_DIR/ginoza/hardware-configuration.nix
|
||||
gum log --structured --level info "Creating hardware configuration..." file $SCRIPT_DIR/kogami/hardware-configuration.nix
|
||||
sudo nixos-generate-config --show-hardware-config tee "$SCRIPT_DIR/kogami/hardware-configuration.nix" >sudo
|
||||
gum log --structured --level info "Creating hardware configuration..." file "$SCRIPT_DIR/kogami/hardware-configuration.nix"
|
||||
sudo nixos-generate-config --show-hardware-config tee "$SCRIPT_DIR/ginoza/hardware-configuration.nix" >sudo
|
||||
gum log --structured --level info "Creating hardware configuration..." file "$SCRIPT_DIR/kogami/hardware-configuration.nix"
|
||||
|
||||
# Username
|
||||
sed -i "0,/shinya/s//$(whoami)/" $SCRIPT_DIR/flake.nix
|
||||
gum log --structured --level info "Setting user name in flake.nix..." file $SCRIPT_DIR/flake.nix
|
||||
sed -i "0,/shinya/s//$(whoami)/" "$SCRIPT_DIR/flake.nix"
|
||||
gum log --structured --level info "Setting user name in flake.nix..." file "$SCRIPT_DIR/flake.nix"
|
||||
# Set hostname by selected profile
|
||||
sed -i "0,/kogami/s//$nixos_profile/" $SCRIPT_DIR/flake.nix
|
||||
gum log --structured --level info "Setting hostname in flake.nix..." file $SCRIPT_DIR/flake.nix
|
||||
sed -i "0,/kogami/s//$nixos_profile/" "$SCRIPT_DIR/flake.nix"
|
||||
gum log --structured --level info "Setting hostname in flake.nix..." file "$SCRIPT_DIR/flake.nix"
|
||||
# Set dotfiles path as $SCRIPT_DIR path
|
||||
#! IMPORTANT
|
||||
|
||||
# Editor
|
||||
if [ -z $EDITOR ]; then
|
||||
if [ -z "$EDITOR" ]; then
|
||||
EDITOR=nano
|
||||
fi
|
||||
gum log --structured --level info "Opening flake.nix in $EDITOR..." file $SCRIPT_DIR/flake.nix
|
||||
$EDITOR $SCRIPT_DIR/flake.nix
|
||||
gum log --structured --level info "Opening flake.nix in $EDITOR..." file "$SCRIPT_DIR/flake.nix"
|
||||
$EDITOR "$SCRIPT_DIR/flake.nix"
|
||||
|
||||
gum log --structured --level info "Building configuration for $nixos_profile..." profile $nixos_profile
|
||||
sudo nixos-rebuild build --flake $SCRIPT_DIR#"${$nixos_profile}"
|
||||
gum log --structured --level info "Building configuration for $nixos_profile..." profile "$nixos_profile"
|
||||
sudo nixos-rebuild build --flake "$SCRIPT_DIR#$nixos_profile"
|
||||
|
||||
# Wallpapers
|
||||
if [ $download_wallpapers = true ]; then
|
||||
gum log --structured --level info "Downloading wallpapers..." profile $nixos_profile
|
||||
if [ "$download_wallpapers" = true ]; then
|
||||
gum log --structured --level info "Downloading wallpapers..." profile "$nixos_profile"
|
||||
nix-shell -p git --command "git clone https://git.foglar.tech/foglar/wallpapers.git ~/Pictures/wallpapers"
|
||||
fi
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user