Coder Social home page Coder Social logo

Nixos Module Broken about nixvim HOT 14 CLOSED

pta2002 avatar pta2002 commented on August 29, 2024
Nixos Module Broken

from nixvim.

Comments (14)

jhilker98 avatar jhilker98 commented on August 29, 2024 1

alright, my bad.

from nixvim.

pta2002 avatar pta2002 commented on August 29, 2024

from nixvim.

OrdoFlammae avatar OrdoFlammae commented on August 29, 2024

I think this is actually a symptom of a much broader issue, and I'm still trying to pin it down exactly. It works fine with the setup in home-manager (which is what I think you use, looking at your dotfiles), and package can be left as default. However, with the setup in nixos, it breaks a number of things, of which this is just one. With the exact same config as with home-manager (changing package = pkgs.neovim-unwrapped), it will install neovim, but it will not apply any configuration or plugins.

from nixvim.

OrdoFlammae avatar OrdoFlammae commented on August 29, 2024

Additional note: home-manager uses neovim-unwrapped by default as the base package, so that is why it isn't crashing and burning when you don't set it in that mode. The nixos module does no such thing.

from nixvim.

OrdoFlammae avatar OrdoFlammae commented on August 29, 2024

Status: I've figured out why the config is not being copied across, you have to add customRC = configure.customRC in the neovimConfig definition. Still working on why plugins are being ignored.

from nixvim.

pta2002 avatar pta2002 commented on August 29, 2024

Hey, finally have time to work on this, can you show me what your config looks like? Because I've not had this issue myself.

from nixvim.

OrdoFlammae avatar OrdoFlammae commented on August 29, 2024

nixvim.nix:

{ pkgs, ... }: {
  enable = true;

  colorscheme = "one";
  colorschemes.one.enable = true;

  plugins.airline.enable = true;

  plugins.lsp.enable = true;
  plugins.lsp.servers.rnix-lsp.enable = true;

  options = {
    shiftwidth = 2;
    tabstop = 2;
    expandtab = true;

    modeline = false;
  };

  extraConfigLua = ''
    vim.opt.formatoptions:remove('t')
    vim.opt.linebreak = true

    vim.api.nvim_command('filetype indent plugin on')
    vim.api.nvim_command('syntax on')
  '';

  extraPlugins = with pkgs.vimPlugins; [
    vim-nix
  ];
}

flake.nix:

{
  description = "My NixOS config";

  inputs = {
    nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
    nixvim.url = "github:pta2002/nixvim";
    home-manager.url = "github:nix-community/home-manager";
  };

  outputs = { self, nixpkgs, nixvim, home-manager, ... } @ inputs:
  let
    system = "x86_64-linux";

    pkgs = import nixpkgs {
      inherit system;

      config = {
        allowUnfree = true;
      };
    };
  in {
    nixosConfigurations = {
      ordoflammae-virtual = nixpkgs.lib.nixosSystem {
        inherit system;

        specialArgs = inputs;

        modules = [
          {
            boot = {
              loader.grub = {
                enable = true;
                version = 2;
                device = "/dev/sda";
              };

              initrd = {
                availableKernelModules = [ "ata_piix" "ohci_pci" "ahci" "sd_mod" "sr_mod" ];
                kernelModules = [ ];
              };

              kernelModules = [ ];
              extraModulePackages = [ ];
            };

            fileSystems = {
              "/" = {
                device = "/dev/disk/by-label/nixos";
                fsType = "ext4";
              };

              "/nixos" = {
                fsType = "vboxsf";
                device = "nixos";
                options = [ "rw" "nofail" ];
              };
            };

            swapDevices = [
              { device = "/dev/disk/by-label/swap"; }
            ];

            hardware.cpu.intel.updateMicrocode = false;
            virtualisation.virtualbox.guest.enable = true;

            nix = {
              package = pkgs.nixFlakes;
              extraOptions = ''
                experimental-features = nix-command flakes
              '';
            };

            networking = {
              hostName = "ordoflammae-virtual";
              useDHCP = false;
              interfaces.enp0s3.useDHCP = true;
            };

            users.users.ordoflammae = {
              isNormalUser = true;
              extraGroups = [ "wheel" "sudo" "vboxsf" ];
            };

            environment.systemPackages = with pkgs; [
              curl
              git
            ];

            imports = [ nixvim.nixosModules.nixvim ];

            programs.nixvim = import ./nixvim.nix { inherit pkgs; };

            system.stateVersion = "21.11";
          }
        ];
      };
    };
  };
}

My guess is that the reason you haven't seen this is that this is only an issue with nixosModules, and there are no issues when using the home-manager setup.

from nixvim.

pta2002 avatar pta2002 commented on August 29, 2024

Seems like it! As part of my work with #16, this should get fixed soon, since I am effectively redoing the whole non-HM setup from scratch.

from nixvim.

jhilker98 avatar jhilker98 commented on August 29, 2024

I've noticed the same issue as well.

from nixvim.

pta2002 avatar pta2002 commented on August 29, 2024

For now, I'd recomend using the standalone branch, and not using the NixOS module, instead using the build function and putting it on environment.systemPackages:

{
  environment.systemPackages = [
    # ...
    (nixvim.build "x86_64-linux" {
      colorschemes.gruvbox.enable = true;
      # etc...
    })
  ];
}

This branch will get merged soon, I just need to get the NixOS and home-manager modules working, but the standalone build function is working perfectly fine!

Let me know if you need any help

from nixvim.

jhilker98 avatar jhilker98 commented on August 29, 2024

i've been using it in home-manager and an alias to use my config. As a side question, is it possible to use nix-colors to create a colorscheme in nixvim?

from nixvim.

OrdoFlammae avatar OrdoFlammae commented on August 29, 2024

i've been using it in home-manager and an alias to use my config. As a side question, is it possible to use nix-colors to create a colorscheme in nixvim?

Please make a new issue for this, I know it's difficult on everyone (maintainer and future readers) when issues are not kept on-topic.

from nixvim.

pta2002 avatar pta2002 commented on August 29, 2024

As a side question, is it possible to use nix-colors to create a colorscheme in nixvim?

There isn't any nix-colors module right now, but I can add one. If you have any extra requests regarding it though, or some idea for how it should work, please do create an issue though!

from nixvim.

dit7ya avatar dit7ya commented on August 29, 2024

I tried to use this package today using the homeManager module but it failed with something like programs.neovim.extraConfig is no longer a valid option. Any help?

from nixvim.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.