The configuration for my development environment on Linux and macOS. Uses Home Manager and nix-darwin. I don't expect anyone else to use this, but I figured I'd leave the repository public as a resource for people who want to manage their systems similarly.
Table of Contents
To use any configuration, except for when you are running the home config from a standalone executable, you will need Nix, a package manager. This section will show you how to install Nix and configure it to use this repository's binary cache to speed up builds.
I recommend using the Determinate Systems installer over the official installer for a few reasons:
- It has an uninstaller
- It's easier to use, as it only requires running a single command
- Sensible default settings
You can find more differences between the two in the "Installation Differences" section of the Determinate Systems Installer README.
When using the installer I suggest adding an extra option, trusted-users
, which will add the current user to the list
of trusted users. This is helpful since some actions in Nix require that the user be trusted, such as using a
binary cache (explained below). Below is the installation command with the
extra option:
curl --proto '=https' --tlsv1.2 -sSf -L https://install.determinate.systems/nix \ | sh -s -- install --extra-conf "trusted-users = $(whoami)"
NOTE: Please confirm that everything in the command provided above, besides the extra option, is up-to-date with what is currently listed on the Installer Website.
To avoid having to build everything on your machine, you can configure Nix to use this repository's binary cache using the steps below:
-
Check to see if you are a trusted user. If you aren't, then add yourself to trusted-users.
-
After running one of the
nix
commands from the "Applying the Configuration" section or "Running the Home Configuration" section below, reply yes to the prompts to add the cache.
-
Start a shell with the home config. It comes with
direnv
, which we'll need in future steps. Check the "Running the Home Configuration" section for instructions. This shell will also be helpful for debugging any problems you encounter while applying the config since you'll have access to all the tools/shortcuts included in the home config. -
Clone the repository and go into its directory by running
git clone https://github.com/bigolu/dotfiles.git ~/.dotfiles && cd ~/.dotfiles
-
Run
direnv allow
to set up the development environment.
The next steps depend on the operating system you're using:
- Apply the Home Manager configuration by running
just init-home-manager <host_name>
where<host_name>
is one of the hosts defined in the Home Manager flake module.
-
Disable System Integrity Protection for
yabai
. Instructions can be found on the yabai wiki. -
I install some Homebrew packages through nix-darwin, but nix-darwin doesn't provide brew so you'll have to install it yourself. Check the site for instructions: brew.sh.
-
Apply the nix-darwin configuration by running
just init-nix-darwin <host_name>
where<host_name>
is one of the hosts defined in the nix-darwin flake module. -
Some settings applied by nix-darwin only take effect after a restart so do a restart now.
-
Additional Setup
-
Keyboard:
-
Set the keyboard input source to 'Others → (No Accent Keys)'.
-
Disable the built-in keyboard shortcut for switching input sources,
ctrl+space
. -
Disable the built-in keyboard shortcuts for switching workspaces,
ctrl+left
andctrl+right
.
-
-
Setup Hammerspoon using the instructions in the Hammerspoon Getting Started Guide.
-
Open Finicky to set it as the default browser.
-
Open MonitorControl, UnnaturalScrollWheels, Nightfall, and "Mac Mouse Fix" to configure them.
-
You can also run a shell or terminal with the home configuration already loaded in it. This is helpful when you only need to use the configuration temporarily and not apply it, like when using SSH.
- Run the shell with
nix run github:bigolu/dotfiles#shell
- Run the terminal with
nix run --impure github:bigolu/dotfiles#terminal
(--impure
is needed for nixGL, but only on Linux)
My home config is also available as an executable with no dependencies. The executable is a self-extracting archive (SEA) that contains all the command-line programs I use, as well as my config files for them. Running it will start a shell/terminal that will have access to these programs and configs.
- Run the shell with
curl -fsSL https://raw.githubusercontent.com/bigolu/dotfiles/master/.github/run.sh | sh -s -- shell
- Run the terminal with
curl -fsSL https://raw.githubusercontent.com/bigolu/dotfiles/master/.github/run.sh | sh -s -- terminal
NOTE: While the SEA doesn't depend on any programs on your computer, it does require that you have a
/tmp
directory. You can read this GitHub issue comment regarding a "rootless Nix" to see why this is needed, as well as learn more about how this works.
-
Cache is being ignored: First, check to see if you are a trusted user. If you aren't, then add yourself to trusted-users. Since I do not know of a way to have nix re-prompt you to add the cache you will have to do it manually. You can do this by adding the lines below to your config in
~/.config/nix/nix.conf
(If you have a multi-user Nix installation, you'll need to restart the Nix daemon afterward to apply the changes.):``` conf extra-substituters = https://bigolu.cachix.org extra-trusted-substituters = https://bigolu.cachix.org extra-trusted-public-keys = bigolu.cachix.org-1:AJELdgYsv4CX7rJkuGu5HuVaOHcqlOgR07ZJfihVTIw= ```
-
apfs.util isn't working: Make sure that the
/etc/synthetic.conf
has the permission0644
.
-
Restart the Nix daemon:
-
Linux: Run
systemctl restart nix-daemon.service
-
macOS: Run
sudo launchctl stop org.nixos.nix-daemon && sudo launchctl start org.nixos.nix-daemon
-
-
Check if you are a trusted user:
-
single-user Nix installation: The user that installed Nix is always trusted in a single user installation.
-
multi-user Nix installation: Run
nix show-config
and look for your$USER
in thetrusted-users
key.
-
-
Add yourself to trusted-users:
- Run
echo "extra-trusted-users = $USER" | sudo tee -a /etc/nix/nix.conf
to add yourself as a trusted user in the Nix system configuration. Then restart the Nix daemon to apply the changes.
- Run