From a9ee79a5ce812d8bb9deecf67fc0d2034ed56b73 Mon Sep 17 00:00:00 2001 From: Bernardo Magri Date: Sat, 11 Apr 2026 20:20:32 +0100 Subject: [PATCH] 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 --- flake.lock | 6 +++--- modules/home/default.nix | 5 ++++- modules/home/stylix-compat.nix | 35 ++++++++++++++++++++++++++++++++++ modules/home/stylix.nix | 3 +++ 4 files changed, 45 insertions(+), 4 deletions(-) create mode 100644 modules/home/stylix-compat.nix diff --git a/flake.lock b/flake.lock index f62ddf2..3fd89e6 100644 --- a/flake.lock +++ b/flake.lock @@ -428,11 +428,11 @@ "tinted-zed": "tinted-zed" }, "locked": { - "lastModified": 1775429060, - "narHash": "sha256-wbFF5cRxQOCzL/wHOKYm21t5AHPH2Lfp0mVPCOAvEoc=", + "lastModified": 1775927784, + "narHash": "sha256-9Gm33hvgcy4hR7O9EjWrw2kipyVBIHgNUtAHyWgLDhg=", "owner": "danth", "repo": "stylix", - "rev": "d27951a6539951d87f75cf0a7cda8a3a24016019", + "rev": "8f6e6b3844b3b0b59470e276bd3fe9ab04600081", "type": "github" }, "original": { diff --git a/modules/home/default.nix b/modules/home/default.nix index 2b47eb7..0d7c219 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -15,6 +15,7 @@ in imports = [ inputs.nix-colors.homeManagerModules.default inputs.walker.homeManagerModules.default + ./stylix-compat.nix # Compatibility shims for stylix target modules ./options.nix ./state.nix ./overrides.nix @@ -40,11 +41,13 @@ in 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; [ # Core applications firefox xfce.thunar - neovim # Media imv # Image viewer diff --git a/modules/home/stylix-compat.nix b/modules/home/stylix-compat.nix new file mode 100644 index 0000000..ad0d9e6 --- /dev/null +++ b/modules/home/stylix-compat.nix @@ -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; + }; +} diff --git a/modules/home/stylix.nix b/modules/home/stylix.nix index d6a11f9..344302c 100644 --- a/modules/home/stylix.nix +++ b/modules/home/stylix.nix @@ -39,6 +39,7 @@ in stylix = { enable = lib.mkDefault true; enableReleaseChecks = lib.mkDefault false; + autoEnable = lib.mkDefault false; # Disable auto-detection, explicitly enable targets image = lib.mkDefault activeWallpaper; base16Scheme = lib.mkDefault currentPalette; @@ -80,6 +81,8 @@ in targets = lib.mkDefault { hyprland.enable = false; # We keep our custom hyprland config for borders/rules 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; kitty.enable = true; gtk.enable = true;