#+title: dotfiles.nix
#+options: author:nil date:nil toc:nil

My dotfiles using Nix. System configuration done using [[https://github.com/LnL7/nix-darwin][nix-darwin]] and
[[https://nixos.org/][NixOS]]. User configuration using [[https://github.com/nix-community/home-manager][home-manager]]. This repo is put
together as a flake using [[https://github.com/hercules-ci/flake-parts][flake-parts]]. On NixOS home-manager is used
as a NixOS module, on Darwin it is used separately from nix-darwin.

dotfiles.nix is inspired by [[https://github.com/terlar/nix-config/tree/main][terlar/nix-config]], [[https://sr.ht/~rycee/configurations/][~rycee/configurations]]
and [[https://github.com/hlissner/dotfiles][hlissner/dotfiles]].

All Nix code in this repo is formatted using [[https://github.com/kamadorueda/alejandra][alejandra]].

* Usage

Show what this flake provides:

#+begin_src shell
nix flake show
#+end_src

Switch both system (NixOS) and home:

#+begin_src shell
nixos-rebuild switch --flake .
#+end_src

Switch system (nix-darwin):

#+begin_src shell
darwin-rebuild switch --flake .
#+end_src

Switch home only (on Darwin):

#+begin_src shell
nix run .#home
#+end_src

Build home without switching:

#+begin_src shell
nix build .#home
#+end_src

Update all inputs:

#+begin_src shell
nix flake update --commit-lock-file
#+end_src

Update a single input:

#+begin_src shell
nix flake lock --update-input nixpkgs --commit-lock-file
#+end_src

Format all nix files:

#+begin_src shell
nix fmt
#+end_src

Enter the dev shell (if not using [[https://github.com/nix-community/nix-direnv][nix-direnv]]):

#+begin_src
nix develop
#+end_src

* Tasks

** TODO Break out emacs config

Emacs configuration should be in it's own repository.
Lisp code should be extracted into separate files or an org-babel setup.

** TODO Services as modules

Services should be converted to modules.
These should ideally support both linux and darwin hosts (launchd and systemd).
