{ description = "A nixvim configuration"; inputs = { nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; nixvim.url = "github:nix-community/nixvim"; flake-parts.url = "github:hercules-ci/flake-parts"; rust-overlay.url = "github:oxalica/rust-overlay"; }; outputs = { nixvim, flake-parts, rust-overlay, ... } @ inputs: flake-parts.lib.mkFlake {inherit inputs;} { systems = [ "x86_64-linux" "aarch64-linux" "x86_64-darwin" "aarch64-darwin" ]; perSystem = { self, system, ... }: let specialArgs = { inherit inputs self; }; overlays = [(import rust-overlay)]; nixvimLib = nixvim.lib.${system}; nixvim' = nixvim.legacyPackages.${system}; pkgs = import inputs.nixpkgs { # Moved pkgs definition up for clarity and scope inherit system overlays; config.allowUnfree = true; }; # --- NEW: Define a comprehensive "fullNixvimModule" --- fullNixvimModule = { inherit pkgs; module = {pkgs, ...}: { imports = [ ./config ./config/rust ./config/csharp ./config/golang ./config/python ./config/javascript ./config/iac ]; extraPackages = with pkgs; [ sops lazygit nerd-fonts.jetbrains-mono rust-bin.stable.latest.default # From rust-overlay ansible-lint # Add any other packages needed across all configs here ]; }; extraSpecialArgs = specialArgs; # Keep specialArgs for self-reference }; # --- END NEW --- # You can keep these individual modules for specific language dev shells if you still want them # They are not used by the default package anymore, but useful for testing/isolated environments baseNixvimModule = { inherit pkgs; module = {pkgs, ...}: { imports = [./config]; extraPackages = with pkgs; [sops lazygit nerd-fonts.jetbrains-mono]; }; extraSpecialArgs = specialArgs; }; rustNixvimModule = { inherit pkgs; module = {pkgs, ...}: { imports = [ ./config ./config/rust ]; extraPackages = with pkgs; [ sops rust-bin.stable.latest.default ]; }; extraSpecialArgs = {}; }; csharpNixvimModule = { inherit pkgs; module = {pkgs, ...}: { imports = [ ./config ./config/csharp ]; extraPackages = with pkgs; [sops]; }; extraSpecialArgs = {}; }; goNixvimModule = { inherit pkgs; module = {pkgs, ...}: { imports = [ ./config ./config/golang ]; extraPackages = with pkgs; [sops]; }; extraSpecialArgs = {}; }; pythonNixvimModule = { inherit pkgs; module = {pkgs, ...}: { imports = [ ./config ./config/python ]; extraPackages = with pkgs; [sops]; }; extraSpecialArgs = {}; }; javascriptNixvimModule = { inherit pkgs; module = {pkgs, ...}: { imports = [ ./config ./config/javascript ]; extraPackages = with pkgs; [sops]; }; extraSpecialArgs = {}; }; iacNixvimModule = { inherit pkgs; module = {pkgs, ...}: { imports = [ ./config ./config/iac ]; extraPackages = with pkgs; [sops ansible-lint]; }; extraSpecialArgs = {}; }; # Define the actual Neovim instances # --- MODIFIED: defaultNvim now uses fullNixvimModule --- defaultNvim = nixvim'.makeNixvimWithModule fullNixvimModule; # --- END MODIFIED --- rustNvim = nixvim'.makeNixvimWithModule rustNixvimModule; csharpNvim = nixvim'.makeNixvimWithModule csharpNixvimModule; goNvim = nixvim'.makeNixvimWithModule goNixvimModule; pythonNvim = nixvim'.makeNixvimWithModule pythonNixvimModule; javascriptNvim = nixvim'.makeNixvimWithModule javascriptNixvimModule; iacNvim = nixvim'.makeNixvimWithModule iacNixvimModule; in { checks = { # It's good practice to check the full module if it's your primary config default = nixvimLib.check.mkTestDerivationFromNixvimModule fullNixvimModule; }; packages = { # Lets you run `nix run .` to start nixvim with all configurations default = defaultNvim; # Existing language-specific packages remain rust = rustNvim; csharp = csharpNvim; golang = goNvim; python = pythonNvim; javascript = javascriptNixvimModule; # This should be javascriptNvim not javascriptNixvimModule iac = iacNvim; }; }; }; }