1 pointby xGoivo7 hours ago1 comment
  • xGoivo7 hours ago
    I've been rewriting my NixOS config (for the fourth time ;) ) and wanted to share the result as a reference for other people thinking about diving into the dendritic pattern.

    The dendritic pattern organizes your NixOS config as a collection of self-contained top-level modules: each module declares its own flake inputs, packages, and configuration option; and can be accessed from anywhere in the config (avoiding ../../../ imports).

    Here's an example of a simple module that set's up my kitty config:

    ```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````

    { flake.nixosModules.tmux = {pkgs, ...}: {

        programs.tmux = {
          enable = true;
          terminal = "tmux-256color";
          baseIndex = 1;
        };
    
        hjem.users.eduardo = {
          files = {
            ".config/tmux/tmux.conf".source = ./tmux.conf;
            ".config/tmux/altux.conf".source = ./altux.conf;
          };
        };
    
      };
    }

    ```````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````````

    From the module, I enable tmux with some custom options, and the configuration files with hjem to be available at ~/.config/tmux/. Using hjem instead of home manager can be great, especially if you don't need to use all home manager features (that come with their complexities), and if you want to keep using the native configuration language for your packages. This module can be used from any of my machines or servers that use Nix or Nixos, and would setup tmux the same way in any of them!

    The two resources that helped me most were doc-steve's guide on the dendritic pattern and filip-ruman's practical tips, both linked in the README.

    Happy to answer questions about the setup, especially around flake-file and hjem which are less documented than the usual home-manager approach.