From 68ff85c43f66c54903a5156ff3f282f531a1fe93 Mon Sep 17 00:00:00 2001 From: Tine Date: Fri, 26 Apr 2024 22:34:29 +0200 Subject: [PATCH] feat: more macos support --- README.md | 7 +++++++ common.sh | 6 +----- install.sh | 7 ++++++- nix/core.nix | 3 --- nix/home.nix | 2 ++ nix/personal-macos.nix | 6 ++++++ switch.sh | 2 +- 7 files changed, 23 insertions(+), 10 deletions(-) create mode 100644 nix/personal-macos.nix diff --git a/README.md b/README.md index e5d30cc..a058748 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,8 @@ Expected configuration: ```bash # Install GUI tools with personal specialization ./install --gui --env personal +# A variation for macos +./install --gui --env personal-macos # Skip GUI tools and only apply work specialization ./install --env work ``` @@ -21,3 +23,8 @@ to match the correct preferences. To make this work, [night theme switcher](https://extensions.gnome.org/extension/2236/night-theme-switcher/) extension is needed and configured to use `scripts/sunrise.sh` and `scripts/sunset.sh` as "run commands". + +### MacOS support. + +Best effort. Known issues are: + - neovim has dbus dependencies (for theme switching). diff --git a/common.sh b/common.sh index b31db98..d6b382c 100644 --- a/common.sh +++ b/common.sh @@ -22,10 +22,6 @@ while [[ $# -gt 0 ]]; do case $1 in --env) ENVIRONMENT=$2 - if [ "$ENVIRONMENT" != "personal" ] && [ "$ENVIRONMENT" != "work" ]; then - echo "Unknown environment $ENVIRONMENT" - exit 1 - fi shift # past argument shift # past value ;; @@ -42,4 +38,4 @@ while [[ $# -gt 0 ]]; do exit 1 ;; esac -done \ No newline at end of file +done diff --git a/install.sh b/install.sh index 9ca7420..ee7d75a 100755 --- a/install.sh +++ b/install.sh @@ -4,10 +4,12 @@ set -euo pipefail source common.sh echo_header "== DotFiles with GUI: $GUI and ENV: $ENVIRONMENT" +LINUX="true" if [[ "$OSTYPE" == "linux-gnu"* ]]; then echo_header "== Detected linux" ./install-linux.sh elif [[ "$OSTYPE" == "darwin"* ]]; then + LINUX="false" echo_header "== Detected macos" ./install-macos.sh else @@ -38,7 +40,10 @@ workspace_link nix/work.nix .config/home-manager/work.nix NIXPKGS_ALLOW_UNFREE=1 ENVIRONMENT=$ENVIRONMENT home-manager switch echo_header "== Use zsh as default shell" -sudo chsh $USER --shell=/bin/zsh +if [ "${LINUX}" == "true" ] +then + sudo chsh $USER --shell=/bin/zsh +fi echo_header "== Plug for neovim" sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \ diff --git a/nix/core.nix b/nix/core.nix index bcf5e70..c14971b 100644 --- a/nix/core.nix +++ b/nix/core.nix @@ -72,9 +72,6 @@ # Kubernetes k9s kubectl - - # Gnome - gnomeExtensions.pop-shell ]; # Home Manager is pretty good at managing dotfiles. The primary way to manage diff --git a/nix/home.nix b/nix/home.nix index 03f42d8..186356d 100644 --- a/nix/home.nix +++ b/nix/home.nix @@ -7,5 +7,7 @@ in imports = if environment == "work" then [ ./core.nix ./work.nix ] + else if environment == "personal-macos" + then [ ./core.nix ./personal-macos.nix ] else [ ./core.nix ./personal.nix ]; } diff --git a/nix/personal-macos.nix b/nix/personal-macos.nix new file mode 100644 index 0000000..8c250e0 --- /dev/null +++ b/nix/personal-macos.nix @@ -0,0 +1,6 @@ +{ config, pkgs, ... }: + +{ + home.username = "tine"; + home.homeDirectory = "/Users/tine"; +} diff --git a/switch.sh b/switch.sh index 83f5bdd..32d60a7 100755 --- a/switch.sh +++ b/switch.sh @@ -1,4 +1,4 @@ -#!/bin/env bash +#!/usr/bin/env bash source common.sh echo_header "== DotFiles with ENV: $ENVIRONMENT"