dustinlyons / nixos-config

General purpose Nix configuration for macOS / NixOS with starter templates + step-by-step guides ✨
BSD 3-Clause "New" or "Revised" License
1.52k stars 95 forks source link

Warn user to not type full path of disk #99

Closed AlphaGX closed 3 months ago

AlphaGX commented 3 months ago

This is not so important, but as I ran into this problem myself I figured I should share this.

In the apply script (app/*/apply), it would be nice to warn the user not to type the full path of the disk (eg /dev/sda) otherwise it will mess up the sed command when replacing values.

- ... "${YELLOW}Please choose your boot disk (e.g., nvme0n1, sda): ${NC}" ... 
+ ... "${YELLOW}Please choose your boot disk (e.g., nvme0n1, sda) (do not type the full path "/dev/"): ${NC}" ... 
dustinlyons commented 3 months ago

Thanks, this is a good suggestion. I have improved the prompt in https://github.com/dustinlyons/nixos-config/commit/7d06bf749002418589ff97598d6b8fdb3404e37a.

For later reference, here is the command I ran on my Macbook at the root of the repository:

find . -type f -exec sh -c 'LC_ALL=C LANG=C sed -i "" -e "s/Please choose your boot disk (e.g., nvme0n1, sda):/Please enter the name of your boot disk (e.g., sda, nvme0n1). Do not include the full path (\"\\/dev\\/\\\"):/g" "$1"' _ {} \;