My personal NixOS setup, fully declarative and leveraging the power of Nix for custom packages and configurations.
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}"
'';
}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"; })
];
};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;
};# 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| Hostname | Description |
|---|---|
mac |
Apple Silicon (Asahi) |
Each system has its own configuration defined under systems/:
systems/
└── mac/ # Apple Silicon setup
.
├── 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