Skip to content

Personal dotfiles using nix, nix-darwin and home-manager

Notifications You must be signed in to change notification settings

lockejan/nix-dotfiles

Repository files navigation

nix-dotfiles

These are my personal nix-dotfiles to setup my macOS machines. Use at your own risk.

It's still very much work in progress.

Code Status

CI

Install

  1. Install nix on your machine.

  2. The first build which will also setup nix-darwin needs to be made manually:

nix --extra-experimental-features nix-command \
    --extra-experimental-features flakes \
    run nix-darwin -- switch --flake "$HOME/dotfiles?submodules=1#m1"

Consecutive runs can be done via

darwin-rebuild switch --flake "$HOME/dotfiles?submodules=1#m1"

Machine specific extras

Neovim configuration is currently pulled in via git submodule.

Additional sensitive information are encrypted with git-crypt.

These live under the folder machines and get included inside flake.nix. To create your own you can use this example code as a start for a personal.nix:

{ config, pkgs, ... }: {

  # enable git and add email and gpg-key to the rest of the config
  programs.git = {
    enable = true;
    userEmail = "[email protected]";
    signing.key = "your-key-id";
  };

  # install a list of additional packages
  home.packages = with pkgs; [
    foo-package
  ];

  # add multiline information to hosts file
  home.file.".ssh/hosts".text = ''
    Host example-host
      Hostname 127.0.0.1
      User foo
  '';

}

Further Resources and inspiration

TODO

  • handling secrets → git-crypt
  • machine specific configuration
  • properly registering gui apps → homebrew until nix takes over
  • setup nix-darwin to add more darwin specific configuration
  • setup flakes

Questions?

Feel free to open issues if you’re interested in something.

License

Consider dotfiles unlicensed (https://unlicense.org/), do what you want with anything you want. Feel free to link back if you want, it could help others in the future but I don’t mind otherwise.