install script update
This commit is contained in:
parent
10a3bb165d
commit
6e5778b4d5
21
README.md
21
README.md
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
## Build and deploy
|
## Build and deploy
|
||||||
|
|
||||||
### Automatic installation
|
### Automatic installation **Recommended**
|
||||||
|
|
||||||
- Use this one command on system with NixOS installed
|
- Use this one command on system with NixOS installed
|
||||||
- This will download script with installation commands
|
- This will download script with installation commands
|
||||||
@ -32,28 +32,25 @@
|
|||||||
nix-shell -p git --command "nix run --experimental-features 'nix-command flakes' git+https://git.foglar.tech/foglar/dotfiles"
|
nix-shell -p git --command "nix run --experimental-features 'nix-command flakes' git+https://git.foglar.tech/foglar/dotfiles"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
> [!IMPORTANT]
|
||||||
|
> Ultimately, I can’t gaurantee this will work for anyone other than myself, so use this at your own discretion.
|
||||||
|
|
||||||
### Manual installation
|
### Manual installation
|
||||||
|
|
||||||
- Build and install with ssmple command:
|
- Simple build command using kogami profile
|
||||||
|
|
||||||
```bash
|
|
||||||
nix run git+https://git.foglar.tech/foglar/dotfiles.git
|
|
||||||
```
|
|
||||||
|
|
||||||
- simple build command for system using kogami profile
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
git clone https://git.foglar.tech/foglar/dotfiles.git $HOME/.dotfiles
|
git clone https://git.foglar.tech/foglar/dotfiles.git $HOME/.dotfiles
|
||||||
sudo nixos-rebuild switch --flake ~/.dotfiles#kogami --update # To update flake.lock file
|
sudo nixos-rebuild switch --flake ~/.dotfiles#kogami --update # To update flake.lock file
|
||||||
```
|
```
|
||||||
|
|
||||||
- generate a vm of the flake with this command
|
- Generate a vm of the flake with this command
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
nix run github:nix-community/nixos-generators -- -c ./flake.nix --flake '#ginoza' -f vm --disk-size 20480
|
nix run github:nix-community/nixos-generators -- -c ./flake.nix --flake '#ginoza' -f vm --disk-size 20480
|
||||||
```
|
```
|
||||||
|
|
||||||
- deploy configuration on the new system
|
- Deploy configuration on the new system
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Copy my repository
|
# Copy my repository
|
||||||
@ -126,7 +123,7 @@ nix-shell nixpkgs#age -c age-keygen -o ~/.config/sops/age/keys.txt
|
|||||||
```
|
```
|
||||||
|
|
||||||
- Secrets are managed in yaml file [secrets.yaml](./nixos/system/packages/sops/secrets/secrets.yaml)
|
- Secrets are managed in yaml file [secrets.yaml](./nixos/system/packages/sops/secrets/secrets.yaml)
|
||||||
- Things that are actually managed in sops configuration:
|
- Things that are managed in sops configuration:
|
||||||
- SSH keys
|
- SSH keys
|
||||||
- Passwords
|
- Passwords
|
||||||
- Yubikey ID
|
- Yubikey ID
|
||||||
@ -186,7 +183,7 @@ nvim /nixos/system/packages/ssh-client.nix
|
|||||||
|
|
||||||
- [EmergentMind's Nix-Config](https://github.com/EmergentMind/nix-config) - explanation of Yubikey setup and declarative configuration of SSH keys
|
- [EmergentMind's Nix-Config](https://github.com/EmergentMind/nix-config) - explanation of Yubikey setup and declarative configuration of SSH keys
|
||||||
- [YT video](https://www.youtube.com/watch?v=3CeXbONjIgE)
|
- [YT video](https://www.youtube.com/watch?v=3CeXbONjIgE)
|
||||||
- [LibrePhoenix's Nix-Config](https://github.com/librephoenix/nixos-config) - if else options and modular control center
|
- [LibrePhoenix's Nix-Config](https://github.com/librephoenix/nixos-config) - if else options, modular control center, one line installation
|
||||||
- [YT video about modular control center](https://www.youtube.com/watch?v=H_Qct7TVB6o)
|
- [YT video about modular control center](https://www.youtube.com/watch?v=H_Qct7TVB6o)
|
||||||
- [YT video about if else options](https://www.youtube.com/watch?v=Qull6TMQm4Q)
|
- [YT video about if else options](https://www.youtube.com/watch?v=Qull6TMQm4Q)
|
||||||
- [YT video about install with one command](https://www.youtube.com/watch?v=20BN4gqHwaQ&t=2025s)
|
- [YT video about install with one command](https://www.youtube.com/watch?v=20BN4gqHwaQ&t=2025s)
|
||||||
|
|||||||
32
install.sh
32
install.sh
@ -1,26 +1,46 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo "Running script"
|
|
||||||
|
|
||||||
if [ $# -gt 0 ]; then
|
if [ $# -gt 0 ]; then
|
||||||
SCRIPT_DIR=$1
|
SCRIPT_DIR=$1
|
||||||
else
|
else
|
||||||
SCRIPT_DIR=~/.dotfiles
|
SCRIPT_DIR=~/.dotfiles
|
||||||
fi
|
fi
|
||||||
|
|
||||||
nix-shell -p git --command "git clone https://git.foglar.tech/foglar/dotfiles.git $SCRIPT_DIR"
|
if [ -d $SCRIPT_DIR ]; then
|
||||||
|
gum confirm "The directory $SCRIPT_DIR already exists. Do you want to delete it?" && yes | rm -rv $SCRIPT_DIR
|
||||||
|
fi
|
||||||
|
|
||||||
|
nixos_profile=$(gum choose kogami ginoza tsunemori)
|
||||||
|
download_wallpapers=$(gum confirm "Do you want to download wallpapers (it may take longer)?" && echo true || echo false)
|
||||||
|
|
||||||
|
if [ -d $SCRIPT_DIR ]; then
|
||||||
|
gum warn "The directory $SCRIPT_DIR already exists. Downloading updates..."
|
||||||
|
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
|
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
|
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
|
||||||
|
|
||||||
|
# Username
|
||||||
sed -i "0,/shinya/s//$(whoami)/" $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//$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
|
||||||
|
|
||||||
|
# Editor
|
||||||
if [ -z $EDITOR ]; then
|
if [ -z $EDITOR ]; then
|
||||||
EDITOR=nano
|
EDITOR=nano
|
||||||
fi
|
fi
|
||||||
|
gum log --structured --level info "Opening flake.nix in $EDITOR..." file $SCRIPT_DIR/flake.nix
|
||||||
$EDITOR $SCRIPT_DIR/flake.nix
|
$EDITOR $SCRIPT_DIR/flake.nix
|
||||||
|
|
||||||
profile=$(gum choose kogami ginoza)
|
gum log --structured --level info "Building configuration for $profile..." profile $profile
|
||||||
sudo nixos-rebuild build --flake $SCRIPT_DIR#"${profile}"
|
sudo nixos-rebuild build --flake $SCRIPT_DIR#"${profile}"
|
||||||
|
|
||||||
gum confirm "Do you want to switch to the new configuration?" && sudo nixos-rebuild switch --flake $SCRIPT_DIR#"${profile}"
|
gum confirm "Do you want to reboot now?" && systemctl reboot || gum log "Please reboot later, to switch to the new configuration"
|
||||||
gum confirm "Do you want to reboot now?" && systemctl reboot || echo "Please reboot later, to switch to the new configuration"
|
|
||||||
|
|||||||
@ -12,10 +12,8 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
sh.zsh = {
|
sh.zsh = {
|
||||||
enable =
|
enable = true;
|
||||||
true;
|
oh-my-posh.enable = true;
|
||||||
oh-my-posh.enable =
|
|
||||||
true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
sh.oh-my-posh.enable = true;
|
sh.oh-my-posh.enable = true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user