danth / stylix

System-wide colorscheming and typography for NixOS
https://stylix.danth.me/
MIT License
1.16k stars 143 forks source link

nixvim.enable being ignored. #464

Closed jasper-clarke closed 3 months ago

jasper-clarke commented 3 months ago

I'm trying to rebuild my system but it keeps trying to symlink a init.lua to my neovim config directory. And so it fails because I already have a config there.

My config:

  stylix = {
    enable = true;
    image = ../wallpapers/cherry-blossom.jpg;
    polarity = "dark";
    cursor = {
      package = pkgs.bibata-cursors;
      name = "Bibata-Modern-Ice";
      size = 44;
    };
    fonts = {
      monospace = {
        name = "JetBrains Mono";
        package = pkgs.jetbrains-mono;
      };
      sansSerif = {
        name = "Inter";
        package = pkgs.inter;
      };
      sizes = {
        terminal = 15;
      };
    };
    opacity = {
      terminal = 0.9;
    };
    targets = {
      nixvim.enable = lib.mkForce false;
    };
    homeManagerIntegration.followSystem = true;
  };
trueNAHO commented 3 months ago

I'm trying to rebuild my system but it keeps trying to symlink a init.lua to my neovim config directory. And so it fails because I already have a config there.

What Stylix version are you encountering this on?

For reference, maybe something is wrong with the NixVim guard:

https://github.com/danth/stylix/blob/29148118cc33f08b71058e1cda7ca017f5300b51/modules/nixvim/nixvim.nix#L16-L17

Considering your stylix.targets.nixvim.enable = lib.mkForce false; declaration, the problem might come from somewhere else.

jasper-clarke commented 3 months ago

@trueNAHO

    "stylix": {
      "inputs": {
        "base16": "base16",
        "base16-fish": "base16-fish",
        "base16-foot": "base16-foot",
        "base16-helix": "base16-helix",
        "base16-kitty": "base16-kitty",
        "base16-tmux": "base16-tmux",
        "base16-vim": "base16-vim",
        "flake-compat": "flake-compat",
        "gnome-shell": "gnome-shell",
        "home-manager": "home-manager_2",
        "nixpkgs": "nixpkgs_2"
      },
      "locked": {
        "lastModified": 1719525570,
        "narHash": "sha256-xSO/H67GAHEW0siD2PHoO/e97MbROL3r3s5SpF6A6Dc=",
        "owner": "danth",
        "repo": "stylix",
        "rev": "1ff9d37d27377bfe8994c24a8d6c6c1734ffa116",
        "type": "github"
      },
      "original": {
        "owner": "danth",
        "repo": "stylix",
        "type": "github"
      }
    },
trueNAHO commented 3 months ago

I am unable to reproduce this issue in my standalone Home Manager setup when updating Stylix to 1ff9d37d27377bfe8994c24a8d6c6c1734ffa116 and disabling stylix.targets.nixvim.enable and my internal NixVim module.

However, additionally adding

    programs.neovim = {
      enable = true;
      defaultEditor = true;
    };

https://github.com/jasper-at-windswept/nix-config/blob/d6744b2d50b453a9daa2d6bc509c8492e722f62f/home/modules/terminal/default.nix#L190-L193

and running

rm ~/.config/nvim/init.lua
touch ~/.config/nvim/init.lua
home-manager switch --flake <FLAKE>

causes the following expected error:

Existing file '<HOME>/.config/nvim/init.lua' is in the way of '/nix/store/<HASH>-home-manager-files/.config/nvim/init.lua'
Please do one of the following:
- Move or remove the above files and try again.
- In standalone mode, use 'home-manager switch -b backup' to back up
  files automatically.
- When used as a NixOS or nix-darwin module, set
    'home-manager.backupFileExtension'
  to, for example, 'backup' and rebuild.

Consider inspecting https://github.com/NixOS/nixpkgs/blob/nixos-24.05/nixos/modules/programs/neovim.nix and removing your programs.neovim.enable = true; declaration. If your Neovim configuration is not installed by your NixOS configuration then you might want to add neovim to your systemPackages instead.

Alternatively, the VIM module might be the culprit:

https://github.com/danth/stylix/blob/29148118cc33f08b71058e1cda7ca017f5300b51/modules/vim/hm.nix#L56-L59

Does extending

      nixvim.enable = lib.mkForce false;

-- https://github.com/jasper-at-windswept/nix-config/blob/d6744b2d50b453a9daa2d6bc509c8492e722f62f/nix/configuration.nix#L47

with

      nixvim.enable = lib.mkForce false;
      vim.enable = lib.mkForce false;

resolve the issue?

jasper-clarke commented 3 months ago

@trueNAHO Yes that fixes the issue, thank you very much.