However, we want to make our dotfiles portable, ideally we should have a shared set of Alacritty settings that can be imported into each role for which we want to use Alacritty, each role file should also be able to override some shared settings where necessary. you only operate one distinct desktop configuration, defining program settings in your role file might work. If your setup can be defined using only one role, ie. Here, the settings will overwrite the default alacritty settings. # ~/.config/nixpkgs/role/darwin-laptop/index.nix A simple version of our role configuration, only setting Alacritty settings might look something like this. Home Manager has built in support for Alacritty, this means you can define your ~/.config/alacritty/alacritty.yml using a nix expression. Here, I'm creating the role configuration ~/.config/nixpkgs/role/darwin-laptop/index.nix. I use Alacritty as my terminal, because it's a GUI app I want to place it's configuration in the role configuration. The role configuration contains config that is specific to the GUI/DE of the system. There isn't much required in terms of machine level configuration, so this file will be left more or less empty. I have actually symlinked ~/.config/nixpkgs to ~/nix-home just to make it easier to cd into the repo from a new shell. # Let Home Manager install and manage itself. Let's start with an entry point, ~/.config/nixpkgs/home.nix, this is the file that home-manager uses by default as it's entry point. There's good documentation of all the options you can use within Home Manager. gitconfig using a nix expression like this. This tool allows you to define settings for supported programs and services using nix expressions in a way comparable to NixOS configuration files.įor example, you can install some user packages and configure your. When searching for dotfile management using nix, the number one tool that appears is Rycee's Home Manager. Packages and settings should be installed/set depending on the selected, machine, role and user.Įach of these three components, machine, role and user, can select the packages they require and override shared settings.Īfter cloning the nixpkgs repository, a single file should be edited to compose the hardware, role and user. Multiple users with specific package requirements.Multiple "desktop" environments, Darwin (MacOS), bspwm, kde, etc.Multiple independent hardware devices. We must cater to an installation characterized as such. Ideally we want a single repository that enables sharing configuration and installed programs across any *nix operating system that supports nix. Now, I wanted to do the same for my dotfiles. Using this ability I was able to successfully create a portable system configuration, that could be deployed using shared elements such as the Desktop Environment, to multiple computers running NixOS. NixOS allows you to define your system configuration, system users, desktop environments, bootloader, etc, using the declarative Nix language and enables atomic updates that can be reliably rolled back. It's safe to say that managing dotfiles is a tough problem and I wasn't happy with my git bare repo solution.Īfter recently getting started with and learning to love Nix/NixOS, installing NixOS on my desktop and Nix on my Darwin machine, I had a renewed interest in improving my dotfile management. This made it particularly hard to keep common configs like my Neovim config in sync across Darwin and Linux. The big issue was that I had to keep my Darwin and Arch/NixOS configuration separate because many configs needed to be tailored to the individual system. This solution served me well for a while, I could use a single repo per machine to store my dotfiles which enabled all the benefits of version control. The files used to configure tools like your shell, fish in my case, and your editor, neovim, are commonly referred to as 'dotfiles' and usually live within ~/.config/Įveryone tends to have their own unique solution to the problem throughout most of 2018 and the start of 2019 I used the git bare repo approach described in this Atlassian Doc. This post now serves as an account of how I previously managed my dotfiles with Nix.Īnyone who spends a significant amount of time in the terminal or developing applications on more than one device has come across the challenge of portable user configuration management. You can find the Elemental repo at gh:hugoreeves/elemental. Updated 2: I have now moved to a new system I'm calling Elemental.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |