Skip to content

Commit eba921f

Browse files
committed
Fix up support for ubuntu + arch
1 parent b53796a commit eba921f

File tree

12 files changed

+90
-57
lines changed

12 files changed

+90
-57
lines changed

.github/workflows/dotfiles-installation.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
runs-on: ${{ matrix.os }}
1111
strategy:
1212
matrix:
13-
os: [macos-13, macos-14, macos-15]
13+
os: [macos-14, macos-15, ubuntu-latest]
1414

1515
steps:
1616
- name: Clean up installed software

Makefile

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
DOTFILES_DIR := $(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
2-
OS := $(shell bin/is-supported bin/is-macos macos bin/is-ubuntu ubuntu bin/is-arch arch linux)
2+
OS := $(shell bin/is-supported bin/is-macos macos $(shell bin/is-supported bin/is-ubuntu ubuntu $(shell bin/is-supported bin/is-arch arch linux)))
33
HOMEBREW_PREFIX := $(shell bin/is-supported bin/is-arm64 /opt/homebrew /usr/local)
44
export N_PREFIX = $(HOME)/.n
55
PATH := $(HOMEBREW_PREFIX)/bin:$(DOTFILES_DIR)/bin:$(N_PREFIX)/bin:$(PATH)
@@ -14,27 +14,24 @@ export ACCEPT_EULA=Y
1414

1515
all: $(OS)
1616

17-
macos: sudo core-macos packages link duti bun
17+
macos: sudo core-macos packages-macos link duti bun
1818

19-
linux: ubuntu
19+
ubuntu: core-ubuntu link
2020

21-
ubuntu: core-ubuntu link bun
22-
23-
arch: core-arch link bun
21+
arch: core-arch packages-arch link
2422

2523
core-macos: brew bash git npm
2624

2725
core-ubuntu:
28-
sudo apt-get update
29-
sudo apt-get upgrade -y
30-
sudo apt-get dist-upgrade -f
26+
apt-get update
27+
apt-get upgrade -y
28+
apt-get dist-upgrade -f
3129

3230
stow-ubuntu: core-ubuntu
33-
is-executable stow || sudo apt-get -y install stow
31+
is-executable stow || apt-get -y install stow
3432

3533
core-arch:
36-
sudo pacman -Syu --noconfirm
37-
sudo pacman -S --noconfirm git base-devel
34+
pacman -Syu --noconfirm
3835

3936
stow-arch: core-arch
4037
is-executable stow || pacman -S --noconfirm stow
@@ -48,8 +45,6 @@ ifndef GITHUB_ACTION
4845
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
4946
endif
5047

51-
packages: brew-packages cask-apps node-packages rust-packages
52-
5348
link: stow-$(OS)
5449
for FILE in $$(\ls -A runcom); do if [ -f $(HOME)/$$FILE -a ! -h $(HOME)/$$FILE ]; then \
5550
mv -v $(HOME)/$$FILE{,.bak}; fi; done
@@ -66,7 +61,7 @@ unlink: stow-$(OS)
6661
mv -v $(HOME)/$$FILE.bak $(HOME)/$${FILE%%.bak}; fi; done
6762

6863
brew:
69-
is-executable brew || curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh | bash
64+
is-executable brew || curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh | bash
7065

7166
bash: brew
7267
ifdef GITHUB_ACTION
@@ -89,6 +84,13 @@ git: brew
8984
npm: brew-packages
9085
n install lts
9186

87+
packages-macos: brew-packages cask-apps node-packages rust-packages
88+
89+
packages-arch: pacman-packages
90+
91+
pacman-packages:
92+
pacman -S --noconfirm - < $(DOTFILES_DIR)/install/pacmanfile
93+
9294
brew-packages: brew
9395
brew bundle --file=$(DOTFILES_DIR)/install/Brewfile || true
9496

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
These are my dotfiles. Take anything you want, but at your own risk.
44

5-
It mainly targets macOS systems (should install on e.g. Ubuntu as well for many tools, config and aliases etc).
5+
Mainly targets macOS systems, but works on Ubuntu and Arch Linux as well.
66

77
## Highlights
88

@@ -22,7 +22,7 @@ It mainly targets macOS systems (should install on e.g. Ubuntu as well for many
2222
- [homebrew-cask](https://github.com/Homebrew/homebrew-cask) (packages: [Caskfile](./install/Caskfile))
2323
- [Node.js + npm LTS](https://nodejs.org/en/download/) (packages: [npmfile](./install/npmfile))
2424
- Latest Git, Bash, Python, GNU coreutils, curl, Ruby
25-
- `$EDITOR` is [GNU nano](https://www.nano-editor.org) (`$VISUAL` is `code` and Git `core.editor` is `code --wait`)
25+
- Editors: VS Code and nano (`EDITOR`, `VISUAL` and Git `core.editor`)
2626

2727
## Installation
2828

bin/git-editor

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
if command -v code >/dev/null 2>&1; then
3+
exec code --wait "$@"
4+
else
5+
exec "$EDITOR" "$@"
6+
fi

config/git/config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
[core]
99
excludesfile = ~/.config/git/ignore
10-
editor = code --wait
10+
editor = git-editor
1111
filemode = false
1212
trustctime = false
1313
autocrlf = input

install/pacmanfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
base-devel
2+
bash-completion
3+
fd
4+
fzf
5+
git
6+
git-delta
7+
nano
8+
zoxide

runcom/.bash_profile

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ if [[ -n $CURRENT_SCRIPT && -x readlink ]]; then
1010
DOTFILES_DIR="${PWD}/$(dirname $(dirname $SCRIPT_PATH))"
1111
elif [ -d "$HOME/.dotfiles" ]; then
1212
DOTFILES_DIR="$HOME/.dotfiles"
13+
elif [ -d "$HOME/dotfiles" ]; then
14+
DOTFILES_DIR="$HOME/dotfiles"
1315
else
1416
echo "Unable to find dotfiles, exiting."
1517
return
@@ -21,15 +23,16 @@ PATH="$DOTFILES_DIR/bin:$PATH"
2123

2224
# Source the dotfiles (order matters)
2325

26+
for DOTFILE in "$DOTFILES_DIR"/system/.{function,function_*,n,path,env,exports,alias,fzf,grep,prompt,completion,fix,pnpm,zoxide}; do
27+
. "$DOTFILE"
28+
done
29+
2430
if is-macos; then
25-
for DOTFILE in "$DOTFILES_DIR"/system/.{env,alias,function,path}.macos; do
31+
for DOTFILE in "$DOTFILES_DIR"/system/.{env,alias,function}.macos; do
2632
. "$DOTFILE"
2733
done
2834
fi
2935

30-
for DOTFILE in "$DOTFILES_DIR"/system/.{function,function_*,n,env,exports,alias,fzf,grep,prompt,completion,fix,pnpm,zoxide}; do
31-
. "$DOTFILE"
32-
done
3336

3437
# Set LSCOLORS
3538

@@ -38,4 +41,5 @@ eval "$(dircolors -b "$DOTFILES_DIR"/system/.dir_colors)"
3841
# Wrap up
3942

4043
unset CURRENT_SCRIPT SCRIPT_PATH DOTFILE
44+
4145
export DOTFILES_DIR

system/.completion

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
1-
BREW_PREFIX=$(brew --prefix)
1+
if [ -z "$HOMEBREW_PREFIX" ] && is-executable brew; then
2+
HOMEBREW_PREFIX=$(brew --prefix)
3+
fi
24

35
# Bash
46

5-
if is-executable brew; then
6-
. "$BREW_PREFIX/share/bash-completion/bash_completion"
7+
if [ -f "/usr/share/bash-completion/bash_completion" ]; then
8+
. "/usr/share/bash-completion/bash_completion"
9+
elif [ -n "$HOMEBREW_PREFIX" ] && [ -f "$HOMEBREW_PREFIX/share/bash-completion/bash_completion" ]; then
10+
. "$HOMEBREW_PREFIX/share/bash-completion/bash_completion"
711
fi
812

913
# dot
@@ -17,8 +21,12 @@ complete -o default -F _dotfiles_completions dot
1721

1822
# tmux
1923

20-
if is-executable brew; then
21-
. "$BREW_PREFIX/etc/bash_completion.d/tmux"
24+
if is-executable tmux; then
25+
if [ -f "/usr/share/bash-completion/completions/tmux" ]; then
26+
. "/usr/share/bash-completion/completions/tmux"
27+
elif [ -n "$HOMEBREW_PREFIX" ] && [ -f "$HOMEBREW_PREFIX/etc/bash_completion.d/tmux" ]; then
28+
. "$HOMEBREW_PREFIX/etc/bash_completion.d/tmux"
29+
fi
2230
fi
2331

2432
# npm (https://docs.npmjs.com/cli/completion)
@@ -30,7 +38,11 @@ fi
3038
# Git
3139

3240
if is-executable git; then
33-
. "$BREW_PREFIX/etc/bash_completion.d/git-completion.bash"
41+
if [ -f "/usr/share/git/completion/git-completion.bash" ]; then
42+
. "/usr/share/git/completion/git-completion.bash"
43+
elif [ -n "$HOMEBREW_PREFIX" ] && [ -f "$HOMEBREW_PREFIX/etc/bash_completion.d/git-completion.bash" ]; then
44+
. "$HOMEBREW_PREFIX/etc/bash_completion.d/git-completion.bash"
45+
fi
3446
fi
3547

3648
# pnpm (https://pnpm.io/completion)

system/.env

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
export EDITOR="code"
2-
export VISUAL="code"
1+
export EDITOR="nano"
2+
export VISUAL="nano"
33

44
# XDG Base Directory Specification (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
55

@@ -23,7 +23,7 @@ export CLICOLOR=1
2323
# Prefer US English and use UTF-8
2424

2525
export LC_ALL="en_US.UTF-8"
26-
export LANG="en_US"
26+
export LANG="en_US.UTF-8"
2727

2828
# Highlight section titles in man pages
2929

system/.env.macos

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
export EDITOR="code"
2+
export VISUAL="code"
13
export VISUAL_GIT="fork"
24

35
# Some app locations

0 commit comments

Comments
 (0)