From 564d209402d0682a26b99d92cd2cb35dfd50bd79 Mon Sep 17 00:00:00 2001 From: m3tm3re
Date: Sat, 28 Mar 2026 10:08:36 +0100 Subject: [PATCH] fix: some nix eval warnings --- modules/home-manager/coding/editors.nix | 132 ++++++++++++------------ overlays/default.nix | 12 +-- shells/opencode.nix | 2 +- 3 files changed, 71 insertions(+), 75 deletions(-) diff --git a/modules/home-manager/coding/editors.nix b/modules/home-manager/coding/editors.nix index ba78d5a..37d9091 100644 --- a/modules/home-manager/coding/editors.nix +++ b/modules/home-manager/coding/editors.nix @@ -1,80 +1,86 @@ { config, lib, + options, pkgs, ... }: with lib; let cfg = config.coding.editors; + # home-manager 26.05+ renamed extraLuaConfig → initLua. + # On stable 25.11 initLua does not exist; fall back to extraLuaConfig. + hasInitLua = options.programs.neovim ? initLua; + lazyVimConfig = '' + -- Bootstrap lazy.nvim + local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" + if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ + "git", + "clone", + "--filter=blob:none", + "https://github.com/folke/lazy.nvim.git", + "--branch=stable", + lazypath, + }) + end + vim.opt.rtp:prepend(lazypath) + -- Bootstrap LazyVim via lazy.nvim + -- Docs: https://github.com/folke/lazy.nvim and https://www.lazyvim.org/ + require("lazy").setup({ + spec = { + { "LazyVim/LazyVim", import = "lazyvim.plugins" }, + { import = "lazyvim.plugins.extras.lang.typescript" }, + { import = "lazyvim.plugins.extras.lang.python" }, + { import = "lazyvim.plugins.extras.lang.go" }, + { import = "lazyvim.plugins.extras.lang.nix" }, + { import = "lazyvim.plugins.extras.lang.rust" }, + { import = "lazyvim.plugins.extras.lang.nushell" }, + { "Mofiqul/dracula.nvim" }, + }, + defaults = { lazy = false, version = false }, + install = { colorscheme = { "dracula", "tokyonight", "habamax" } }, + checker = { enabled = false }, + performance = { + rtp = { + disabled_plugins = { + "gzip", "tarPlugin", "tohtml", "tutor", "zipPlugin", + }, + }, + }, + }) + vim.o.termguicolors = true + vim.cmd.colorscheme("dracula") + ''; in { options.coding.editors = { neovim = { enable = mkEnableOption "neovim with LazyVim configuration"; }; - zed = { enable = mkEnableOption "zed editor with custom configuration"; }; }; - config = mkMerge [ # Neovim configuration - (mkIf cfg.neovim.enable { - programs.neovim = { - enable = true; - defaultEditor = true; - viAlias = true; - vimAlias = true; - vimdiffAlias = true; - withNodeJs = true; - withPython3 = true; - - # This is your init.lua content (extraLuaConfig for compatibility with older home-manager) - extraLuaConfig = '' - -- Bootstrap lazy.nvim - local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" - if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ - "git", - "clone", - "--filter=blob:none", - "https://github.com/folke/lazy.nvim.git", - "--branch=stable", - lazypath, - }) - end - vim.opt.rtp:prepend(lazypath) - - -- Bootstrap LazyVim via lazy.nvim - -- Docs: https://github.com/folke/lazy.nvim and https://www.lazyvim.org/ - require("lazy").setup({ - spec = { - { "LazyVim/LazyVim", import = "lazyvim.plugins" }, - { import = "lazyvim.plugins.extras.lang.typescript" }, - { import = "lazyvim.plugins.extras.lang.python" }, - { import = "lazyvim.plugins.extras.lang.go" }, - { import = "lazyvim.plugins.extras.lang.nix" }, - { import = "lazyvim.plugins.extras.lang.rust" }, - { import = "lazyvim.plugins.extras.lang.nushell" }, - { "Mofiqul/dracula.nvim" }, - }, - defaults = { lazy = false, version = false }, - install = { colorscheme = { "dracula", "tokyonight", "habamax" } }, - checker = { enabled = false }, - performance = { - rtp = { - disabled_plugins = { - "gzip", "tarPlugin", "tohtml", "tutor", "zipPlugin", - }, - }, - }, - }) - vim.o.termguicolors = true - vim.cmd.colorscheme("dracula") - ''; - }; - }) - + (mkIf cfg.neovim.enable (mkMerge [ + { + programs.neovim = { + enable = true; + defaultEditor = true; + viAlias = true; + vimAlias = true; + vimdiffAlias = true; + withNodeJs = true; + withPython3 = true; + }; + } + # Use initLua on HM 26.05+ (unstable), extraLuaConfig on HM ≤ 25.11 (stable) + ( + if hasInitLua + then {programs.neovim.initLua = lazyVimConfig;} + else {programs.neovim.extraLuaConfig = lazyVimConfig;} + ) + ])) # Zed editor configuration (mkIf cfg.zed.enable { programs.zed-editor = { @@ -85,13 +91,11 @@ in { ui_font_size = 16; buffer_font_size = 16; buffer_font_family = "FiraCode Nerd Font"; - # Editor Behavior vim_mode = true; auto_update = false; format_on_save = "on"; load_direnv = "shell_hook"; - # AI Features features = { edit_prediction_provider = "zed"; @@ -100,14 +104,12 @@ in { mode = "subtle"; }; show_edit_predictions = true; - agent = { default_model = { provider = "zed.dev"; model = "claude-sonnet-4"; }; }; - assistant = { version = "2"; default_model = { @@ -115,7 +117,6 @@ in { model = "claude-4"; }; }; - # Language Models language_models = { anthropic = { @@ -128,7 +129,6 @@ in { api_url = "http://localhost:11434"; }; }; - # Languages Configuration languages = { Nix = { @@ -153,7 +153,6 @@ in { }; }; }; - # LSP Configuration lsp = { rust-analyzer = { @@ -169,7 +168,6 @@ in { }; }; }; - # Context Servers context_servers = { some-context-server = { @@ -182,7 +180,6 @@ in { env = {}; }; }; - # Privacy telemetry = { metrics = false; @@ -190,7 +187,6 @@ in { }; }; }) - # Common packages (always installed if either editor is enabled) (mkIf (cfg.neovim.enable || cfg.zed.enable) { home.packages = with pkgs; [zig]; diff --git a/overlays/default.nix b/overlays/default.nix index 5cf35d2..82181ba 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -3,7 +3,7 @@ additions = final: prev: (import ../pkgs {pkgs = final;}) # // (inputs.hyprpanel.overlay final prev) - // {rose-pine-hyprcursor = inputs.rose-pine-hyprcursor.packages.${prev.system}.default;}; + // {rose-pine-hyprcursor = inputs.rose-pine-hyprcursor.packages.${prev.stdenv.hostPlatform.system}.default;}; # This one contains whatever you want to overlay # You can change versions, add patches, set compilation flags, anything really. @@ -35,35 +35,35 @@ temp-packages = final: _prev: { temp = import inputs.nixpkgs-9e9486b { - system = final.system; + system = final.stdenv.hostPlatform.system; config.allowUnfree = true; }; }; stable-packages = final: _prev: { stable = import inputs.nixpkgs-stable { - system = final.system; + system = final.stdenv.hostPlatform.system; config.allowUnfree = true; }; }; pinned-packages = final: _prev: { pinned = import inputs.nixpkgs-9472de4 { - system = final.system; + system = final.stdenv.hostPlatform.system; config.allowUnfree = true; }; }; locked-packages = final: _prev: { locked = import inputs.nixpkgs-locked { - system = final.system; + system = final.stdenv.hostPlatform.system; config.allowUnfree = true; }; }; master-packages = final: _prev: { master = import inputs.nixpkgs-master { - system = final.system; + system = final.stdenv.hostPlatform.system; config.allowUnfree = true; }; }; diff --git a/shells/opencode.nix b/shells/opencode.nix index 0b9b769..9938a4e 100644 --- a/shells/opencode.nix +++ b/shells/opencode.nix @@ -53,7 +53,7 @@ in # OpenCode AI coding agent (if inputs are available) ] ++ lib.optionals (inputs != null) - [inputs.opencode.packages.${pkgs.system}.opencode] + [inputs.opencode.packages.${pkgs.stdenv.hostPlatform.system}.opencode] ++ [ # Task management for AI coding sessions customPackages.td