wip
This commit is contained in:
parent
3cdce0f50e
commit
3f35ce600e
@ -1,4 +1,4 @@
|
|||||||
# Run the following command to begin
|
# Run the following command to begin
|
||||||
```
|
```
|
||||||
curl -s https://raw.githubusercontent.com/vleeuwenmenno/dotfiles/master/setup.sh | bash
|
curl -sSL https://raw.githubusercontent.com/vleeuwenmenno/dotfiles/master/setup.sh | bash -s -- "--install"
|
||||||
```
|
```
|
59
setup.sh
59
setup.sh
@ -4,8 +4,7 @@ DOTFILES_REPO="git@github.com:vleeuwenmenno/dotfiles.git"
|
|||||||
help() {
|
help() {
|
||||||
echo "Usage: $0 [option...]" >&2
|
echo "Usage: $0 [option...]" >&2
|
||||||
echo
|
echo
|
||||||
echo " -i, --init Initial installation"
|
echo " -i, --install Run installation process"
|
||||||
echo " -c, --continue Continue installation"
|
|
||||||
echo " -h, --help Display this help message"
|
echo " -h, --help Display this help message"
|
||||||
echo
|
echo
|
||||||
exit 1
|
exit 1
|
||||||
@ -25,6 +24,16 @@ install_nix() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
hush_login() {
|
hush_login() {
|
||||||
|
# Check if distro is Ubuntu
|
||||||
|
if [ -f /etc/os-release ]; then
|
||||||
|
. /etc/os-release
|
||||||
|
if [ "$ID" != "ubuntu" ]; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
# If .hushlogin does not exist, create it
|
# If .hushlogin does not exist, create it
|
||||||
if [ -f ~/.hushlogin ]; then
|
if [ -f ~/.hushlogin ]; then
|
||||||
echo 'Login message is already disabled.'
|
echo 'Login message is already disabled.'
|
||||||
@ -57,34 +66,48 @@ nix_config_import() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check if parameter is help, continue or initial
|
clone_dotfiles() {
|
||||||
if [ "$1" == "-c" ] || [ "$1" == "--continue" ]; then
|
|
||||||
rm ~/.setup-initial-done
|
|
||||||
|
|
||||||
# Add experimental-features to nix.conf
|
|
||||||
nix_experimental
|
|
||||||
|
|
||||||
# Clone dotfiles
|
|
||||||
if [ -d ~/.dotfiles ]; then
|
if [ -d ~/.dotfiles ]; then
|
||||||
echo "Dotfiles already cloned."
|
echo "Dotfiles already cloned."
|
||||||
else
|
else
|
||||||
echo "Cloning dotfiles..."
|
echo "Cloning dotfiles..."
|
||||||
git clone $DOTFILES_REPO ~/.dotfiles
|
git clone $DOTFILES_REPO ~/.dotfiles
|
||||||
fi
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Run initial home-manager setup
|
home_manager_setup() {
|
||||||
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
|
# Check if home-manager is installed
|
||||||
nix-channel --update
|
if command -v home-manager > /dev/null; then
|
||||||
nix-shell '<home-manager>' -A install
|
echo "Home-manager is already installed."
|
||||||
home-manager switch --flake ~/.dotfiles
|
else
|
||||||
elif [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
|
echo "Installing home-manager..."
|
||||||
help
|
nix-channel --add https://github.com/nix-community/home-manager/archive/master.tar.gz home-manager
|
||||||
else
|
nix-channel --update
|
||||||
|
nix-shell '<home-manager>' -A install
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check if parameter is help, continue or initial
|
||||||
|
if [ "$1" == "-i" ] || [ "$1" == "--install" ]; then
|
||||||
# Ubuntu specific, hide login message
|
# Ubuntu specific, hide login message
|
||||||
hush_login
|
hush_login
|
||||||
|
|
||||||
# Install nix
|
# Install nix
|
||||||
install_nix
|
install_nix
|
||||||
|
|
||||||
|
# Add experimental-features to nix.conf
|
||||||
|
nix_experimental
|
||||||
|
|
||||||
|
# Clone dotfiles
|
||||||
|
clone_dotfiles
|
||||||
|
|
||||||
|
# Run initial home-manager setup
|
||||||
|
home_manager_setup
|
||||||
|
|
||||||
|
# Run initial home-manager switch
|
||||||
|
home-manager switch --flake ~/.dotfiles
|
||||||
|
else
|
||||||
|
help
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user