fix: add stylix compatibility shims for missing program options

Stylix unconditionally imports all target modules, which expect certain
program options to exist even when those programs aren't enabled. This
causes evaluation errors.

Add stylix-compat.nix with stub options for:
- programs.neovim.initLua (maps to extraLuaConfig)
- programs.opencode.tui/themes

Also:
- Disable neovim/neovide stylix targets (we deploy theme lua via theme-loader)
- Set autoEnable = false to only enable explicitly listed targets
- Enable programs.neovim to satisfy stylix's neovim target
- Update stylix to latest version

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Bernardo Magri
2026-04-11 20:20:32 +01:00
parent b27fc5aee8
commit a9ee79a5ce
4 changed files with 45 additions and 4 deletions

6
flake.lock generated
View File

@@ -428,11 +428,11 @@
"tinted-zed": "tinted-zed" "tinted-zed": "tinted-zed"
}, },
"locked": { "locked": {
"lastModified": 1775429060, "lastModified": 1775927784,
"narHash": "sha256-wbFF5cRxQOCzL/wHOKYm21t5AHPH2Lfp0mVPCOAvEoc=", "narHash": "sha256-9Gm33hvgcy4hR7O9EjWrw2kipyVBIHgNUtAHyWgLDhg=",
"owner": "danth", "owner": "danth",
"repo": "stylix", "repo": "stylix",
"rev": "d27951a6539951d87f75cf0a7cda8a3a24016019", "rev": "8f6e6b3844b3b0b59470e276bd3fe9ab04600081",
"type": "github" "type": "github"
}, },
"original": { "original": {

View File

@@ -15,6 +15,7 @@ in
imports = [ imports = [
inputs.nix-colors.homeManagerModules.default inputs.nix-colors.homeManagerModules.default
inputs.walker.homeManagerModules.default inputs.walker.homeManagerModules.default
./stylix-compat.nix # Compatibility shims for stylix target modules
./options.nix ./options.nix
./state.nix ./state.nix
./overrides.nix ./overrides.nix
@@ -40,11 +41,13 @@ in
colorScheme = lib.mkDefault (nomarchyLib.getColorScheme config.nomarchy.theme); colorScheme = lib.mkDefault (nomarchyLib.getColorScheme config.nomarchy.theme);
# Enable neovim program module (required for stylix integration)
programs.neovim.enable = lib.mkDefault true;
home.packages = lib.mkDefault (with pkgs; [ home.packages = lib.mkDefault (with pkgs; [
# Core applications # Core applications
firefox firefox
xfce.thunar xfce.thunar
neovim
# Media # Media
imv # Image viewer imv # Image viewer

View File

@@ -0,0 +1,35 @@
{ config, lib, ... }:
# Compatibility shims for stylix target modules
# Stylix unconditionally imports all target modules, which expect certain
# program options to exist. This module defines stub options for programs
# we don't use to prevent evaluation errors.
{
options = {
# Neovim: stylix uses initLua but home-manager uses extraLuaConfig
programs.neovim.initLua = lib.mkOption {
type = lib.types.lines;
default = "";
description = "Lua code to run at init (compatibility shim for stylix)";
};
# OpenCode: stylix expects programs.opencode options
programs.opencode = {
tui = lib.mkOption {
type = lib.types.attrsOf lib.types.anything;
default = {};
description = "OpenCode TUI settings (stylix compatibility shim)";
};
themes = lib.mkOption {
type = lib.types.attrsOf lib.types.anything;
default = {};
description = "OpenCode themes (stylix compatibility shim)";
};
};
};
config = lib.mkIf (config.programs.neovim.initLua != "") {
programs.neovim.extraLuaConfig = config.programs.neovim.initLua;
};
}

View File

@@ -39,6 +39,7 @@ in
stylix = { stylix = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
enableReleaseChecks = lib.mkDefault false; enableReleaseChecks = lib.mkDefault false;
autoEnable = lib.mkDefault false; # Disable auto-detection, explicitly enable targets
image = lib.mkDefault activeWallpaper; image = lib.mkDefault activeWallpaper;
base16Scheme = lib.mkDefault currentPalette; base16Scheme = lib.mkDefault currentPalette;
@@ -80,6 +81,8 @@ in
targets = lib.mkDefault { targets = lib.mkDefault {
hyprland.enable = false; # We keep our custom hyprland config for borders/rules hyprland.enable = false; # We keep our custom hyprland config for borders/rules
waybar.enable = false; # We keep our custom waybar CSS waybar.enable = false; # We keep our custom waybar CSS
neovim.enable = false; # We deploy theme lua files via theme-loader instead
neovide.enable = false; # Neovide depends on neovim program module
alacritty.enable = true; alacritty.enable = true;
kitty.enable = true; kitty.enable = true;
gtk.enable = true; gtk.enable = true;