diff --git a/bin/init-dotfiles b/bin/init-dotfiles index 1166982..4ccd4bc 100755 --- a/bin/init-dotfiles +++ b/bin/init-dotfiles @@ -1,5 +1,8 @@ #!/usr/bin/env sh +head /etc/os-release -n 1 | grep 'NixOS$'; test $? -eq 1; is_nixos=$? +head /etc/os-release -n 1 | grep 'Arch Linux'; test $? -eq 1; is_arch_linux=$? + set -e # NOTE: run this from inside a Linux installation, not from the live USB/CD @@ -63,11 +66,28 @@ setup_dotfiles() { ./bin/setup-dotfiles } +distro_specific_root_setup() { + if test $is_nixos -eq 1 then + symlink_nixos "$root_home$dotfiles/env/nix/" + add_unstable_channel + nixos-rebuild switch + elif test $is_arch_linux -eq 1 + # TODO: install any necessary packages for remaining setup portion + fi +} + +distro_specific_user_setup() { + if test $is_nixos -eq 1 then + FUNC=$(declare -f symlink_nixos) + sudo sh -c "$FUNC; symlink_nixos \"$daniel_home$dotfiles/env/nix/\"" + elif test $is_arch_linux -eq 1 + # TODO: setup all the things + fi +} + init_for_root() { clone_dotfiles "$root_home$dotfiles" - symlink_nixos "$root_home$dotfiles/env/nix/" - add_unstable_channel - nixos-rebuild switch + distro_specific_setup chown daniel:users "$daniel_home" echo "Re-running as user daniel..." sudo --user daniel "$root_home$dotfiles/init.sh" @@ -76,8 +96,7 @@ init_for_root() { init_for_daniel() { clone_dotfiles "$daniel_home$dotfiles" generate_ssh_key - FUNC=$(declare -f symlink_nixos) - sudo sh -c "$FUNC; symlink_nixos \"$daniel_home$dotfiles/env/nix/\"" + distro_specific_user_setup setup_wallpaper # TODO: setup ssh/gpg keys # TODO: setup password store