Skip to content
/ nix Public

My NixOS Configuration (and all my dotfiles)

Notifications You must be signed in to change notification settings

GavBog/nix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

115 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NixOS Logo

My NixOS Configuration

My personal NixOS setup, fully declarative and leveraging the power of Nix for custom packages and configurations.

NixOS


🔧 The Wrapper Pattern

All my packages use symlinkJoin + wrapProgram to inject configuration using only nix (no home-manager!):

# pkgs/ghostty/default.nix
pkgs.symlinkJoin {
  name = "ghostty-wrapped";
  paths = [ pkgs.ghostty ];
  nativeBuildInputs = [ pkgs.makeWrapper ];
  postBuild = ''
    wrapProgram $out/bin/ghostty \
      --add-flags "--config-file=${./config}"
  '';
}

🩹 Mergiraf Patch System

Applying multiple community patches to dwl usually causes conflicts. apply-patches.nix solves this:

# lib/apply-patches.nix (simplified)
pkgs.stdenvNoCC.mkDerivation {
  patchPhase = ''
    git init
    git config merge.mergiraf.driver "mergiraf merge --git %O %A %B ..."

    for p in "''${PATCHES[@]}"; do
      git am --3way "$p" || {
        # Apply fixups for manual conflict resolution
        for f in "''${FIXUPS[@]}"; do
          git apply "$f" || true
        done
        git am --continue
      }
    done
  '';
}

How it works:

  • Uses mergiraf for intelligent 3-way merging
  • Falls back to fixup patches when needed
  • Result: clean patch stacking that "just works"
# pkgs/dwl/default.nix
dwlSrc = applyPatches {
  src = pkgs.fetchgit { url = "https://codeberg.org/dwl/dwl.git"; /* ... */ };
  patches = [
    (pkgs.fetchurl { url = "...movestack.patch"; })
    (pkgs.fetchurl { url = "...bar.patch"; })
  ];
};

📝 Neovim with nixCats

A nixCats config running Neovim nightly:

# pkgs/nvim/default.nix (highlights)
lspsAndRuntimeDeps = {
  general = [
    lua-language-server
    nil  # Nix LSP
    stylua
    ripgrep fd
    customPkgs.tidal-language-server  # Haskell Music LSP packaged by me :)
  ];
};

startupPlugins = {
  general = [
    blink-cmp oil-nvim
    flash-nvim harpoon2
    nvim-treesitter.withAllGrammars
    # ... 40+ more
  ];
};

settings = {
  neovim-unwrapped = neovim-nightly-overlay.packages.${system}.neovim;
};

🚀 Quick Start

# Load my NixOS configuration
sudo nixos-rebuild switch --flake github:gavbog/nix#<hostname> # Options: mac

# Try individual packages
nix run github:gavbog/nix#nvim
nix run github:gavbog/nix#ghostty
nix build github:gavbog/nix#dwl

💻 Systems

Hostname Description
mac Apple Silicon (Asahi)

Each system has its own configuration defined under systems/:

systems/
└── mac/                 # Apple Silicon setup

📁 Structure

.
├── flake.nix
├── pkgs/
│   ├── dwl/           # Patched Wayland compositor
│   ├── nvim/          # nixCats Neovim config
│   ├── ghostty/       # Terminal wrapper
│   ├── zsh/           # Shell with Starship + Zinit
│   ├── librewolf/     # Browser
│   └── ...
├── lib/
│   └── apply-patches.nix  # Mergiraf patch utility
├── modules/           # NixOS modules (audio, bluetooth, etc.)
└── systems/           # Host-specific configurations

Built with ❄️ Nix

About

My NixOS Configuration (and all my dotfiles)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published