Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

declare & apply via Nix #105

Closed
wants to merge 114 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
a4798e7
Add `nix-darwin` setup
nathanshelly Jul 8, 2020
909075a
Remove unneeded initialization
nathanshelly Jul 8, 2020
b329e83
Guard `hm...` & `dr...` aliases
nathanshelly Jul 26, 2020
23cb7b4
Update setup
nathanshelly Jul 26, 2020
505d5f6
Remove `home-manager` initialization
nathanshelly Jul 26, 2020
e9c1149
Put user profile first on path
nathanshelly Jul 26, 2020
d248a8b
Remove packages from home-manager config
nathanshelly Jul 26, 2020
95082b0
nix: get `fzf` config file location via `fzf-share`
nathanshelly Aug 15, 2020
f1638eb
Fix `home.nix` symlinking
nathanshelly Aug 15, 2020
72ce636
Update default shell setting
nathanshelly Aug 22, 2020
4d404dc
Clean up `setup_zsh`
nathanshelly Aug 22, 2020
0ef357a
Fix redirection
nathanshelly Aug 29, 2020
f3d52b9
refactor
nathanshelly Oct 3, 2020
3699c24
add first draft of `nix/README.md`
nathanshelly Oct 3, 2020
3fb482d
add os-specific apply script
nathanshelly Oct 3, 2020
95665af
reword: development -> user
nathanshelly Oct 8, 2020
1044ceb
tweak
nathanshelly Oct 8, 2020
6e7865b
wip
nathanshelly Oct 8, 2020
c40b56f
refactor `misc` folder
nathanshelly Oct 9, 2020
7a7f402
rewrite
nathanshelly Oct 9, 2020
220a535
remove now-declared `fzf` config
nathanshelly Oct 9, 2020
3735560
remove unnecessary global tool-versions
nathanshelly Oct 9, 2020
08dc95d
move git{config,ignore} -> `git.nix`
nathanshelly Oct 9, 2020
794f862
add additional specific nix config blobs
nathanshelly Oct 9, 2020
a764512
remove now-declared config
nathanshelly Oct 9, 2020
2fb4499
misc
nathanshelly Oct 9, 2020
25224c2
move xvimrc -> `gui.nix`
nathanshelly Oct 9, 2020
7cd2f0c
refactor
nathanshelly Oct 9, 2020
56e6884
remove asdf
nathanshelly Oct 9, 2020
092121e
remove references to `bin/symlink`
nathanshelly Oct 9, 2020
1bdfbc9
clean up
nathanshelly Oct 9, 2020
25ab0c5
revert management of path
nathanshelly Oct 9, 2020
4b322bc
conditionally load nathan-specific config
nathanshelly Oct 9, 2020
e1d27a7
clean up zsh management
nathanshelly Oct 9, 2020
da2d945
first attempts at managing neovim
nathanshelly Oct 9, 2020
f127e4f
use matchBlocks
nathanshelly Oct 9, 2020
7c3aa0f
use `xdg.configHome`
nathanshelly Oct 17, 2020
feb24ba
refactor gui & conditionally apply
nathanshelly Oct 17, 2020
dce845b
clean up
nathanshelly Oct 17, 2020
290d9e9
add in-progress thoughts on README
nathanshelly Oct 17, 2020
c16058a
nvim: clean up plugins
nathanshelly Oct 17, 2020
b14a743
add coc.nvim TODO
nathanshelly Oct 18, 2020
45a80b5
grab bag
nathanshelly Oct 18, 2020
635e12d
interactive `nix-darwin` installer
nathanshelly Oct 18, 2020
6999afc
fix up
nathanshelly Oct 18, 2020
3629178
symlink `home.nix` manually
nathanshelly Oct 18, 2020
597aafe
factor our link_file script
nathanshelly Oct 18, 2020
67d033c
setup script improvements
nathanshelly Oct 18, 2020
1667826
clean up nix-darwin file backup
nathanshelly Oct 18, 2020
cdcd9d6
remove python dependencies in `setup_neovim`
nathanshelly Oct 18, 2020
2446e3a
small refactor
nathanshelly Oct 18, 2020
08d5aef
clean up & comment out backup
nathanshelly Oct 19, 2020
394a733
git: language-specific diff headers
nathanshelly Oct 24, 2020
674218a
git: comment character from `#` -> `;`
nathanshelly Oct 24, 2020
73733cd
ignore nix build artifacts
nathanshelly Nov 9, 2020
1c8fdeb
grab bag
nathanshelly Nov 9, 2020
014737b
add first flake draft
nathanshelly Nov 9, 2020
e93860e
fix up installation script issues
nathanshelly Nov 8, 2020
fe0758a
use `zsh` to enable `compaudit`
nathanshelly Nov 8, 2020
37edc81
install `vim-plug` outside nix
nathanshelly Nov 8, 2020
8430030
add back nix path extension
nathanshelly Nov 8, 2020
d8fd8f1
add flake install to setup
nathanshelly Nov 8, 2020
57f048a
use $USER instead of "nathan"
nathanshelly Nov 8, 2020
a4604c7
learnings from test runs on wiped laptop
nathanshelly Nov 8, 2020
819c6cd
use home-manager from flake, not global
nathanshelly Nov 8, 2020
98021f5
use flake in initial setup
nathanshelly Nov 8, 2020
b7c0b87
switch back to bash
nathanshelly Nov 8, 2020
82aa88f
fix homebrew completions permissions issue
nathanshelly Nov 8, 2020
ba3fba2
fix homebrew completions permissions issue try ii
nathanshelly Nov 9, 2020
c84eec0
silence compaudit
nathanshelly Nov 9, 2020
4cefc4b
edit nix path earlier
nathanshelly Nov 9, 2020
72eae6e
remove inaccurate sudo message
nathanshelly Nov 9, 2020
23caea2
tweaks from test runs
nathanshelly Nov 9, 2020
09bb694
refactor
nathanshelly Nov 9, 2020
8ad5a81
use non-flake `darwin-rebuild switch` to enable flakes
nathanshelly Nov 9, 2020
07ec635
add back import for first generation
nathanshelly Nov 9, 2020
c311111
fix `vim-plug` installation
nathanshelly Nov 9, 2020
b9d922a
attempt to source nix setup script
nathanshelly Nov 9, 2020
3d9b117
add default darwin config
nathanshelly Nov 9, 2020
773d300
whoops fixups
nathanshelly Nov 9, 2020
7dc2f22
add TODO
nathanshelly Nov 9, 2020
f508896
fix lint
nathanshelly Nov 9, 2020
c7c8efc
try a few setup script tweaks
nathanshelly Nov 10, 2020
2956535
source file suggested by installer
nathanshelly Nov 12, 2020
2429fc1
remove alfred shortcut change
nathanshelly Nov 14, 2020
02e3fd8
add todo
nathanshelly Nov 14, 2020
31479c8
remove vscode settings changes
nathanshelly Nov 14, 2020
bbfb131
miscellaneous cleanup
nathanshelly Nov 14, 2020
8250502
actually undo alfred shortcut change
nathanshelly Nov 14, 2020
0f4ac41
fix flake inputs
nathanshelly Nov 15, 2020
515b2b6
use `nix-index` over `command-not-found`
nathanshelly Nov 15, 2020
fd59c2e
temporarily add back home-manager import
nathanshelly Nov 16, 2020
4349054
add work config
nathanshelly Nov 16, 2020
276806b
add back initial non-flake rebuild
nathanshelly Nov 16, 2020
c5bad68
enable flake support for `nix-direnv`
nathanshelly Nov 15, 2020
fea1cb3
update to 20.09
nathanshelly Nov 28, 2020
88d114e
remove impure nixpkgs import
nathanshelly Nov 29, 2020
6d7254b
configure delta via home-manager
nathanshelly Nov 29, 2020
761fb29
clean up git.nix
nathanshelly Nov 29, 2020
b230b56
misc cleanup
nathanshelly Nov 29, 2020
5995d59
remove no longer needed symlink setup
nathanshelly Dec 1, 2020
d54a513
respect headless mode in `link_file`
nathanshelly Dec 1, 2020
52bc2e7
add back asdf sourcing
nathanshelly Dec 2, 2020
2289a79
use flake w/ home-manager on od mac
nathanshelly Dec 2, 2020
7fb4e0f
misc: remove and ignore Nix `result` artifact
nathanshelly Dec 6, 2020
5214608
zsh: define `$PAGER` & use it in `smat`
nathanshelly Dec 6, 2020
030928f
zsh: add `fzf-tab` plugin
nathanshelly Dec 11, 2020
33597bd
misc: add TODOs & aliases
nathanshelly Dec 11, 2020
16e4c77
Clean up `setup_zsh`
nathanshelly Aug 22, 2020
da6498d
setup script improvements
nathanshelly Oct 18, 2020
c52212d
remove unneeded path manipulations
nathanshelly Dec 11, 2020
6317180
tweaks
nathanshelly Dec 11, 2020
e367231
add back node version
nathanshelly Dec 11, 2020
fa8acfd
remove unneeded asdf
nathanshelly Dec 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .files-settings
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"asdf": false,
"editor": "nvim",
"fzf": true,
"git-aliases": true,
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
# scratch files
temp.*

# tokens, credentials, etc.
secrets.*

# any built targets (e.g. rust analyzer language server)
target

# `brew bundle` "lock" file - not actually for reproducible installs, mostly a
# debugging tool
# ref - https://github.com/Homebrew/homebrew-bundle/pull/552
Brewfile.lock.json

# local overrides
zsh/local.zsh

# ignore unused Alfred settings
**/Alfred.alfredpreferences/remote

# build artifacts from nix
result
17 changes: 6 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# - http://www.cs.colby.edu/maxwell/courses/tutorials/maketutor/

# targets without immediate file dependencies
.PHONY: all check fix format gui help lint nix setup headless-setup symlink
.PHONY: all check fix format gui help lint nix headless-setup setup
.DEFAULT_GOAL := help

lint:
Expand All @@ -28,30 +28,25 @@ setup:
nix:
./infra/setup/bin/setup_nix

symlink:
./infra/setup/bin/symlink

gui:
./gui/setup/setup_gui

# config specific to my use cases
nathan:
./infra/setup/bin/symlink --nathan
./infra/setup/bin/setup_macos_settings

all:
./infra/setup/setup_dotfiles
./gui/setup/setup_gui

apply:
./nix/apply

help:
@echo 'make help'
@echo ' show this help message'
@echo 'make setup'
@echo ' set up dotfiles'
@echo 'make apply'
@echo ' apply latest config'
@echo 'make nix'
@echo ' set up nix'
@echo 'make symlink'
@echo ' symlink config files (like .zshrc) to their appropriate locations'
@echo 'make gui'
@echo ' set up gui parts of config'
@echo 'make all'
Expand Down
71 changes: 71 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 31 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
description = ".files";

inputs = {
# TODO: switch to unstable once macOS Big Sur support has landed
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-20.09-darwin";

home-manager.url = "github:nix-community/home-manager/master";
# set home-manager's nipxkgs input to the nixpkgs specified in this flake
home-manager.inputs.nixpkgs.follows = "nixpkgs";

nix-darwin.url = "github:lnl7/nix-darwin/master";
# set nix-darwin's nipxkgs input to the nixpkgs specified in this flake
nix-darwin.inputs.nixpkgs.follows = "nixpkgs";
};

outputs = { self, nix-darwin, nixpkgs, home-manager }: {
darwinConfigurations."smino" = nix-darwin.lib.darwinSystem {
modules = [ home-manager.darwinModules.home-manager ./nix/darwin.nix ];
};
darwinConfigurations."nathan-shelly-od-mac" = nix-darwin.lib.darwinSystem {
modules = [ home-manager.darwinModules.home-manager ./nix/darwin.nix ];
};
# technically `nix-darwin` looks for a config specified by hostname
# (not sure when, if ever, that's different from $HOST)
# TODO: figure out how to actually make generic/universal config
darwinConfigurations."${builtins.getEnv "HOST"}" = nix-darwin.lib.darwinSystem {
modules = [ home-manager.darwinModules.home-manager ./nix/darwin.nix ];
};
};
}
8 changes: 4 additions & 4 deletions functions/smat
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
# render given args with best available command
render_args() {
# use `mdcat` when passed a single markdown file
# TODO: use `mdcat` w/ multiple files all are `*.md`
[[ -z $2 ]] && [[ $1 =~ \.md$ ]] && command -v mdcat > /dev/null && {
# display markdown file using `mdcat` w/ a pager
# TODO: use `--paginate` flag once released
# ref - https://github.com/lunaryorn/mdcat/issues/152
mdcat "$1" | less --no-init --quit-if-one-screen --raw-control-chars
# `--paginate` applies the pager defined in $PAGER (or $MDCAT_PAGER w/ a
# default of `less --raw-control-characters`)
mdcat --paginate "$1"
return
}

Expand Down
1 change: 0 additions & 1 deletion gui/apps/karabiner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ brew install "yqrashawn/goku/goku"
Finally run the following command from anywhere to apply the config:

```console
~/.files on goku
❯ GOKU_EDN_CONFIG_FILE="$DOTFILES/gui/apps/karabiner/karabiner.edn" goku
Done!
```
Expand Down
5 changes: 1 addition & 4 deletions gui/apps/vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,5 @@
"trailing-spaces.highlightCurrentLine": false,
// <<<<<< vs icons >>>>>>
"vsicons.dontShowNewVersionMessage": true,
"python.defaultInterpreterPath": "/Users/nathan/.nix-profile/bin/python",
// ######### rust-analyzer ##########
"rust-analyzer.updates.channel": "nightly",
"rust-analyzer.serverPath": "rust-analyzer"
"python.defaultInterpreterPath": "/Users/nathan/.nix-profile/bin/python"
}
25 changes: 18 additions & 7 deletions gui/setup/setup_brew
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ source "${BASH_SOURCE%/*}/../../infra/setup/check_dotfiles_variable.sh"
source "$DOTFILES/infra/scripts/prompts.sh"

"$DOTFILES/infra/scripts/is_macos.sh" || {
info "these dotfiles don't use \`brew\` in Linux environments"
info 'skipping install'
info "these dotfiles don't use \`brew\` in Linux environments - skipping"
return
}

Expand All @@ -25,11 +24,23 @@ info '`brew` not installed, installing now...'
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

# fix permissions issues for `compinit` caused by Homebrew messing with things
#
# ref - https://stackoverflow.com/a/43544733
#
# TODO: run conditionally
compaudit | xargs chown -R "$(whoami)"
compaudit | xargs chmod go-w
fix_permissions_issue() {
local fix_permissions_commands

# fix permissions on `/user/local/share/*` folder that Homebrew's installer
# messes with
#
# refs
# - https://docs.brew.sh/Shell-Completion#configuring-completions-in-zsh
# - https://stackoverflow.com/a/43544733
fix_permissions_commands="chmod -R go-w \"$(brew --prefix)/share\";"

info "Fixing completions permission issue"
# `--no-rcs` to avoid running `compinit` and triggering warnings that we're
# about to fix
zsh --no-rcs -c "$fix_permissions_commands" > /dev/null
}
fix_permissions_issue

brew analytics off # disable analytics
6 changes: 3 additions & 3 deletions gui/setup/setup_desktop_apps
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,13 @@ you have previously installed them. (y/any other key)"

# Xcode - https://apps.apple.com/us/app/xcode/id497799835
mas install 497799835
# accept license so that installed components are usable
sudo xcodebuild -license accept

# Super Easy Timer (paid, $5) - https://apps.apple.com/us/app/super-easy-timer/id1353137878
mas install 1353137878
# Time Out (in-app purchases) - https://apps.apple.com/us/app/time-out-break-reminders/id402592703
mas install 402592703

# TODO: verify fixes Xcode installation issue
sudo xcodebuild -license accept
}

# handle any arguments/flags
Expand Down
33 changes: 0 additions & 33 deletions gui/xvimrc

This file was deleted.

1 change: 1 addition & 0 deletions infra/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@ Various configuration and tooling supporting these dotfiles.

- [`actions`](./actions) - CI checks using GitHub actions
- [`docs`](./docs) - documentation for these dotfiles
- [`docker`](./docker) - play with these dotfiles in a docker sandbox
- [`scripts`](./scripts) - various scripts used throughout these dotfiles
- [`setup`](./setup) - code to set up and configure these dotfiles
File renamed without changes.
File renamed without changes.
1 change: 0 additions & 1 deletion infra/docs/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Currently these options are primarily booleans enabling or disabling a specific

```jsonc
{
"asdf": boolean, // enable/disable versions via `asdf`
// value of $EDITOR - "nvim", "emacs", "code", etc.
"editor": "<valid-editor-program>",
"fzf": boolean, // enable/disable `fzf` including keybindings & completions
Expand Down
10 changes: 7 additions & 3 deletions infra/scripts/component_enabled.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#! /usr/bin/env bash

command -v jq > /dev/null || exit 1
main() {
local enabled
enabled="$("$DOTFILES/infra/scripts/get_local_setting.sh" "$1")"

ENABLED="$("$DOTFILES/infra/scripts/get_local_setting.sh" "$1")"
[[ $ENABLED == true ]]
[[ $enabled == true ]]
}

main "$@"
2 changes: 1 addition & 1 deletion infra/setup/bin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
Various setup scripts

- [`setup_git_config`](./setup_git_config) - fill in [`gitconfig.template`](../../../utilities/git/gitconfig.template) template
- [`setup_asdf`](./setup_asdf) - add [`asdf`](https://github.com/asdf-vm/asdf) [plugins](https://github.com/asdf-vm/asdf-plugins) then run `asdf install` to install global versions of packages
- [`setup_bits_and_pieces`](./setup_bits_and_pieces) - set up various bits and pieces
- [`setup_macos_settings`](./setup_macos_settings) - set macOS configuration (currently unimplemented)
- [`setup_neovim`](./setup_neovim) - set up [`neovim`](https://neovim.io/) text editor
- [`setup_nix`](./setup_nix) - set up [Nix](https://nixos.org/)
- [`setup_work`](./setup_work) - add work-specific configuration (currently just a work-specific gitconfig (name & email))
- [`symlink`](./symlink) - symlink all necessary config files to their respective locations (e.g. `$DOTFILES/neovim/init.vim` -> "\$HOME/.config/nvim/init.vim")
- [`setup_zsh`](./setup_zsh) - adds [`zsh`](http://zsh.sourceforge.net/) to `/etc/shells`, sets it to the default shell, and loads `zsh` to install plugins & finish installation
24 changes: 24 additions & 0 deletions infra/setup/bin/backup_file
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#! /usr/bin/env bash

# check that DOTFILES variable is defined
# shellcheck disable=SC1090
source "${BASH_SOURCE%/*}/../check_dotfiles_variable.sh"

source "$DOTFILES/infra/scripts/prompts.sh"

# backup single file
#
# Args:
# - {string} target - file to backup
# - {string} [extension = bak] - extension of created file, default of bak
backup_file() {
# parameters
local src="$1" ext="${2:-bak}"

[ -f "$src" ] && {
# TODO: conditionally use sudo here
sudo mv "$src" "$src.$ext"
}
}

backup_file "$@"
Loading