trying to add option to nvim module

This commit is contained in:
Arthur Wambst 2025-02-21 22:01:12 +01:00
parent b8f8f5ac11
commit 87f375dea4
3 changed files with 58 additions and 26 deletions

View File

@ -185,11 +185,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1740162094,
"narHash": "sha256-QpD9XNR6tPPsYTavZw1o99Tcn3ILrp1SXr669Ru6vuY=",
"lastModified": 1740170230,
"narHash": "sha256-Clnn2Y+bx4LI2caUqtCxaYKKRLC4ifXVSgVZKJIskFA=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5525603a0c65072af1cd24cd2750fa33749e4943",
"rev": "f1c5d6d23fd57011b78cb2424f5c73e68c9e8879",
"type": "github"
},
"original": {
@ -214,11 +214,28 @@
"type": "github"
}
},
"plugin-gruvbox": {
"flake": false,
"locked": {
"lastModified": 1738710709,
"narHash": "sha256-BBMDCIhwTvZQyeWug8zzUwV8uuqQIkpXtEpoErvAKFc=",
"owner": "ellisonleao",
"repo": "gruvbox.nvim",
"rev": "089b60e92aa0a1c6fa76ff527837cd35b6f5ac81",
"type": "github"
},
"original": {
"owner": "ellisonleao",
"repo": "gruvbox.nvim",
"type": "github"
}
},
"root": {
"inputs": {
"neovim": "neovim",
"nixpkgs": "nixpkgs",
"plugin-dracula": "plugin-dracula"
"plugin-dracula": "plugin-dracula",
"plugin-gruvbox": "plugin-gruvbox"
}
},
"treefmt-nix": {

View File

@ -13,30 +13,13 @@
url = "github:Mofiqul/dracula.nvim";
flake = false;
};
plugin-gruvbox = {
url = "github:ellisonleao/gruvbox.nvim";
flake = false;
};
};
outputs = { self, nixpkgs, neovim, ... }@inputs: {
nixosModules.neovim = { config, pkgs, ...}: {
# Installation de Neovim en tant que package système
environment.systemPackages = [ neovim.packages.${pkgs.system}.neovim ];
neovim = import ./modules/nvim.nix;
# Activer nvim
programs.neovim = {
enable = true;
# Native way to configure Neovim
configure = {
customRC = ''
" Add Dracula to runtimepath
set runtimepath+=${inputs.plugin-dracula}
" Enable Dracula colorscheme
colorscheme dracula
'';
};
};
};
};
}

32
modules/nvim/theme.nix Normal file
View File

@ -0,0 +1,32 @@
{ config, pkgs, lib, inputs, ... }:
with lib; {
options.programs.neovim.theme = mkOption {
type = types.enum [ "dracula" "gruvbox" "tokyonight" ];
default = "dracula";
description = "Choose the Neovim theme.";
};
config = let
themePackage = {
"dracula" = inputs.plugin-dracula;
"gruvbox" = inputs.plugin-gruvbox;
"tokyonight" = null; # No flake input, assumes user manages it manually
}.${config.programs.neovim.theme} or null;
in {
environment.systemPackages = [ inputs.neovim.packages.${pkgs.system}.neovim ];
programs.neovim = {
enable = true;
configure = {
customRC = ''
" Add Dracula to runtimepath
set runtimepath+=${config.programs.neovim.theme}
" Enable Dracula colorscheme
colorscheme dracula
'';
};
};
};
}