trying to add option to nvim module
This commit is contained in:
parent
b8f8f5ac11
commit
87f375dea4
25
flake.lock
25
flake.lock
@ -185,11 +185,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1740162094,
|
"lastModified": 1740170230,
|
||||||
"narHash": "sha256-QpD9XNR6tPPsYTavZw1o99Tcn3ILrp1SXr669Ru6vuY=",
|
"narHash": "sha256-Clnn2Y+bx4LI2caUqtCxaYKKRLC4ifXVSgVZKJIskFA=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "5525603a0c65072af1cd24cd2750fa33749e4943",
|
"rev": "f1c5d6d23fd57011b78cb2424f5c73e68c9e8879",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -214,11 +214,28 @@
|
|||||||
"type": "github"
|
"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": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"neovim": "neovim",
|
"neovim": "neovim",
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"plugin-dracula": "plugin-dracula"
|
"plugin-dracula": "plugin-dracula",
|
||||||
|
"plugin-gruvbox": "plugin-gruvbox"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"treefmt-nix": {
|
"treefmt-nix": {
|
||||||
|
|||||||
27
flake.nix
27
flake.nix
@ -13,30 +13,13 @@
|
|||||||
url = "github:Mofiqul/dracula.nvim";
|
url = "github:Mofiqul/dracula.nvim";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
|
plugin-gruvbox = {
|
||||||
|
url = "github:ellisonleao/gruvbox.nvim";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
outputs = { self, nixpkgs, neovim, ... }@inputs: {
|
outputs = { self, nixpkgs, neovim, ... }@inputs: {
|
||||||
nixosModules.neovim = { config, pkgs, ...}: {
|
neovim = import ./modules/nvim.nix;
|
||||||
# Installation de Neovim en tant que package système
|
|
||||||
environment.systemPackages = [ neovim.packages.${pkgs.system}.neovim ];
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# 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
32
modules/nvim/theme.nix
Normal 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
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user