LGUG2Z / JeezyVim

A fast, reliable NeoVim configuration as a Nix Flake for people who want to use NeoVim as an editor and not as an IDE
30 stars 7 forks source link

error: attribute 'jeezyvim' missing #4

Closed bashfulrobot closed 5 months ago

bashfulrobot commented 5 months ago

Hi there,

(Are You sick of me yet? :smile: )

After making the changes as discussed in issue 3, updating my flake.lock, and running a rebuild, I am now running into:

 error: attribute 'jeezyvim' missing

       at /nix/store/iwyq5kqzffwpcv91vrd0ilz4cxg0qim4-source/modules/cli/nvim/default.nix:30:10:

           29|       home.packages = [
           30|         (pkgs.jeezyvim.nixvimExtend {
             |          ^

I am sure I had changed things correctly, but for reference:

{ pkgs, config, lib, ... }:
let
  cfg = config.cli.nvim;
  username = if builtins.getEnv "SUDO_USER" != "" then
    builtins.getEnv "SUDO_USER"
  else
    builtins.getEnv "USER";
in {

  options = {
    cli.nvim.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Enable jeezyvim editor.";
    };
  };

  config = lib.mkIf cfg.enable {

    home-manager.users."${username}" = {

      # home.packages = with pkgs;
      #   [
      #     jeezyvim # opinionated neovim
      #   ];

      home.sessionVariables = { EDITOR = "nvim"; };

      home.packages = [
        (pkgs.jeezyvim.nixvimExtend {
          # you can put anything under the "Options" section of the NixVim docs here
          # https://nix-community.github.io/nixvim/

          # some examples...

          # all your regular vim options here
          options = { textwidth = 120; };

          config = {
            keymaps = [

              # toggle comments
              {
                mode = "n";
                action = ":CommentToggle<CR>";
                key = "<Space>/";
              }
              # toggle copilot-chat
              {
                mode = "n";
                action = ":CopilotChatToggle<CR>";
                key = "<Space>c";
              }
              # explain the active selection
              {
                mode = "n";
                action = ":CopilotChatExplain<CR>";
                key = "<Leader>e";
              }
              # review the selected code
              {
                mode = "n";
                action = ":CopilotChatReview<CR>";
                key = "<Leader>r";
              }
              # fix the selected code
              {
                mode = "n";
                action = ":CopilotChatFix<CR>";
                key = "<Leader>f";
              }
              # optimize the selected code
              {
                mode = "n";
                action = ":CopilotChatOptimize<CR>";
                key = "<Leader>o";
              }
              # add documentation for the selection
              {
                mode = "n";
                action = ":CopilotChatDocs<CR>";
                key = "<Leader>d";
              }
              # generate tests for the code
              {
                mode = "n";
                action = ":CopilotChatTests<CR>";
                key = "<Leader>t";
              }
              # {
              #   mode = "n";
              #   action = ":vsplit<CR>";
              #   key = "|";
              # }

              # {
              #   mode = "n";
              #   action = ":split<CR>";
              #   key = "-";
              # }

            ];
            plugins = {
              lsp.servers = {

                # full list of language servers you can enable on the left bar here:
                # https://nix-community.github.io/nixvim/plugins/lsp/servers/ansiblels/index.html
                bashls.enable = pkgs.lib.mkForce true;
                docker-compose-language-service.enable = true;
                dockerls.enable = pkgs.lib.mkForce false;
                gopls.enable = pkgs.lib.mkForce false;
                graphql.enable = pkgs.lib.mkForce false;
                helm-ls.enable = pkgs.lib.mkForce false;
                html.enable = pkgs.lib.mkForce false;
                htmx.enable = pkgs.lib.mkForce false;
                jsonls.enable = pkgs.lib.mkForce false;
                marksman.enable = pkgs.lib.mkForce false;
                nginx-language-server.enable = pkgs.lib.mkForce false;
                nixd.enable = pkgs.lib.mkForce false;
                pylsp.enable = pkgs.lib.mkForce false;
                rust-analyzer.enable = pkgs.lib.mkForce false;
                svelte.enable = pkgs.lib.mkForce false;
                tailwindcss.enable = pkgs.lib.mkForce false;
                terraformls.enable = pkgs.lib.mkForce false;
                yamlls.enable = pkgs.lib.mkForce false;

              };

              # full list of plugins on the left bar here:
              # https://nix-community.github.io/nixvim/plugins/airline/index.html

              # readme - for config: https://github.com/m4xshen/autoclose.nvim?tab=readme-ov-file#-configuration
              autoclose.enable = pkgs.lib.mkForce false;
              clipboard-image.enable = pkgs.lib.mkForce false;
              markdown-preview.enable = pkgs.lib.mkForce false;
              # copilot-chat.enable = true; #plugin isn't in nixvim yet?
              copilot-cmp.enable = pkgs.lib.mkForce false;
              diffview.enable = pkgs.lib.mkForce false;
              helm.enable = pkgs.lib.mkForce false;
              lazygit.enable = pkgs.lib.mkForce true;
              multicursors.enable = pkgs.lib.mkForce false;
              nix.enable = pkgs.lib.mkForce false;
              nix-develop.enable = pkgs.lib.mkForce false;
              nvim-colorizer.enable = pkgs.lib.mkForce false;
              obsidian.enable = pkgs.lib.mkForce false;
              todo-comments.enable = pkgs.lib.mkForce false;

            };
          };
        })
      ];
    };
  };
}

and nothing changed in my flake:

{
  description = "NixOS configuration for Dustin Krysak";

  inputs = {

    avalanche = {
      url = "github:snowfallorg/avalanche";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";

    nixos-hardware.url = "github:NixOS/nixos-hardware/master";

    envycontrol.url = "github:bayasdev/envycontrol";

    nix-flatpak.url = "github:gmodena/nix-flatpak";

    jeezyvim.url = "github:LGUG2Z/JeezyVim";

    home-manager = {
      url = "github:nix-community/home-manager";
      inputs.nixpkgs.follows = "nixpkgs";
    };

    # Hyprswitch (for windows switching in Hyprland)
    hyprswitch = { url = "github:h3rmt/hyprswitch/release"; };

    # currently used for FF extensions
    nur.url = "github:nix-community/NUR";

    kolide-launcher = {
      url = "github:/kolide/nix-agent/main";
      inputs.nixpkgs.follows = "nixpkgs";
    };

  };

  outputs = inputs@{ self, nixpkgs, home-manager, nixos-hardware, envycontrol
    , nix-flatpak, nur, kolide-launcher, hyprswitch, avalanche, jeezyvim, ... }:
    with inputs;
    let
      nixpkgsConfig = { overlays = [ ]; };
      secrets =
        builtins.fromJSON (builtins.readFile "${self}/secrets/secrets.json");
      username = if builtins.getEnv "SUDO_USER" != "" then
        builtins.getEnv "SUDO_USER"
      else
        builtins.getEnv "USER";
    in {

      nixosConfigurations = {

        # evo = new work laptop hostname
        evo = nixpkgs.lib.nixosSystem {
          # format different due to kolide-launcher
          # nixpkgs.config.allowUnfree = true; only applies to non-flakes.
          specialArgs = {
            inherit inputs secrets;
            pkgs = import nixpkgs {
              system = "x86_64-linux";
              config.allowUnfree = true;
            };
          };
          system = "x86_64-linux";
          modules = [
            ./systems/evo
            nur.nixosModules.nur
            # nixos-hardware.nixosModules.lenovo-thinkpad-x13-yoga
            home-manager.nixosModules.home-manager
            nix-flatpak.nixosModules.nix-flatpak
            kolide-launcher.nixosModules.kolide-launcher
            avalanche.nixosModules."avalanche/desktop"

            {
              home-manager.extraSpecialArgs = { inherit secrets; };
              home-manager.useGlobalPkgs = true;
              home-manager.useUserPackages = true;

              # Overlays
              nixpkgs.overlays = [
                nur.overlay
                avalanche.overlays.default
                jeezyvim.overlays.default
              ];

              # Allow unfree packages
              nixpkgs.config.allowUnfree = true;
            }
          ];
        };

        # rembot = desktop hostname
        rembot = nixpkgs.lib.nixosSystem {
          specialArgs = { inherit inputs secrets; };
          system = "x86_64-linux";
          modules = [
            ./systems/rembot
            nur.nixosModules.nur
            nix-flatpak.nixosModules.nix-flatpak
            home-manager.nixosModules.home-manager
            {
              home-manager.extraSpecialArgs = { inherit secrets; };
              home-manager.useGlobalPkgs = true;
              home-manager.useUserPackages = true;

              # Overlays
              nixpkgs.overlays = [
                nur.overlay
                jeezyvim.overlays.default
                 ];

              # Allow unfree packages
              nixpkgs.config.allowUnfree = true;
            }
          ];
        };

        # nixdo = server hostname
        nixdo = nixpkgs.lib.nixosSystem {
          specialArgs = { inherit inputs secrets; };
          system = "x86_64-linux";
          modules = [
            ./systems/nixdo

          ];

        };

      };

    };
}

I also went to a stripped down config with:

{ pkgs, config, lib, ... }:
let
  cfg = config.cli.nvim;
  username = if builtins.getEnv "SUDO_USER" != "" then
    builtins.getEnv "SUDO_USER"
  else
    builtins.getEnv "USER";
in {

  options = {
    cli.nvim.enable = lib.mkOption {
      type = lib.types.bool;
      default = false;
      description = "Enable jeezyvim editor.";
    };
  };

  config = lib.mkIf cfg.enable {

    home-manager.users."${username}" = {

      home.packages = with pkgs;
        [
          jeezyvim # opinionated neovim
        ];

      home.sessionVariables = { EDITOR = "nvim"; };

    };
  };
}

I still got the same error.

Thank you.

LGUG2Z commented 5 months ago

I think you have put the overlays in the wrong place, they should be set where you set the pkgs variable and set allowUnfree:

            pkgs = import nixpkgs {
              system = "x86_64-linux";
              config.allowUnfree = true;
              overlays = [
                jeezyvim.overlays.default
                # ... other overlays here
              ];
            };
bashfulrobot commented 5 months ago

OK, I think this may be a garbage collection issue. It does not work on my laptop, but it does on my desktop. I think it is a "me" problem.

bashfulrobot commented 5 months ago

I think you have put the overlays in the wrong place, they should be set where you set the pkgs variable and set allowUnfree:

            pkgs = import nixpkgs {
              system = "x86_64-linux";
              config.allowUnfree = true;
              overlays = [
                jeezyvim.overlays.default
                # ... other overlays here
              ];
            };

I totally missed this message. I am still fighting this issue, but it has to be a "me" problem.

It is odd, as my overlays set under modules work for all other overlays. And is working where it is on one system but not the other.

I just went looking at a bunch of other flake.nix files using github code search, and I see many bringing it in within the modules section.

evo = nixpkgs.lib.nixosSystem {
          # format different due to kolide-launcher
          # nixpkgs.config.allowUnfree = true; only applies to non-flakes.
          specialArgs = {
            inherit inputs secrets;
            pkgs = import nixpkgs {
              system = "x86_64-linux";
              config.allowUnfree = true;
            };
          };
          system = "x86_64-linux";
          modules = [
            ./systems/evo
            nur.nixosModules.nur
            # nixos-hardware.nixosModules.lenovo-thinkpad-x13-yoga
            home-manager.nixosModules.home-manager
            nix-flatpak.nixosModules.nix-flatpak
            kolide-launcher.nixosModules.kolide-launcher
            avalanche.nixosModules."avalanche/desktop"

            {
              home-manager.extraSpecialArgs = { inherit secrets; };
              home-manager.useGlobalPkgs = true;
              home-manager.useUserPackages = true;

              # Overlays - specified in "workstationOverlays"
              nixpkgs.overlays = workstationOverlays;

              # Allow unfree packages
              nixpkgs.config.allowUnfree = true;
            }
          ];
        };

I assume your overlays are needed at the home manger level. Maybe I misunderstood?

bashfulrobot commented 5 months ago

Solved it.

 # evo = new work laptop hostname
        evo = nixpkgs.lib.nixosSystem {
          # format different due to kolide-launcher
          # nixpkgs.config.allowUnfree = true; only applies to non-flakes.
          specialArgs = {
            inherit inputs secrets;
            pkgs = import nixpkgs {
              system = "x86_64-linux";
              config.allowUnfree = true;
            };
          };

it was the:

pkgs = import nixpkgs {
              system = "x86_64-linux";
              config.allowUnfree = true;
            };

I removed that, and it started working. It was in there from when I was trying to configure Kolide. I had missed that the definitions were slightly different. I thought they were identical.