Refactor nixvim to move it as standalone package instead of nixos module

This commit is contained in:
ulic-youthlic 2025-07-13 06:04:55 +08:00
parent 92ec57e83f
commit c75945ddba
Signed by: youthlic
GPG key ID: 63E86C3C14A0D721
8 changed files with 24 additions and 68 deletions

View file

@ -11,6 +11,7 @@
system,
lib,
self',
inputs',
...
}: let
inherit (inputs) nixpkgs;
@ -20,6 +21,7 @@
config = {
allowUnfree = true;
};
overlays = [(_final: _prev: {inherit lib;})];
};
devShells.default = pkgs.mkShell {
name = "nixos-shell";
@ -36,6 +38,7 @@
inputsScope = lib.makeScope pkgs.newScope (self: {
inherit inputs rootPath;
srcs = self.callPackage (rootPath + "/_sources/generated.nix") {};
inherit (inputs'.nixvim.legacyPackages) makeNixvim makeNixvimWithModule;
});
in
lib.packagesFromDirectoryRecursive {

View file

@ -59,6 +59,7 @@
localsend
zulip
wechat
nixvim
];
environment.variables.EDITOR = "hx";

View file

@ -37,7 +37,6 @@
};
programs = {
bash.enable = true;
nixvim.enable = true;
guix.enable = true;
dae.enable = true;
openssh.enable = true;
@ -91,6 +90,7 @@
waypipe
wineWow64Packages.waylandFull
iperf3
nixvim
sbctl
];

View file

@ -1,25 +0,0 @@
{
lib,
config,
...
}: let
cfg = config.youthlic.programs.nixvim;
in {
imports = lib.youthlic.loadImports ./.;
options = {
youthlic.programs.nixvim = {
enable = lib.mkEnableOption "nixvim";
};
};
config = lib.mkIf cfg.enable {
programs.nixvim = {
enable = true;
enableMan = true;
colorschemes.gruvbox-material = {
enable = true;
autoLoad = true;
};
plugins.lualine.enable = true;
};
};
}

View file

@ -1,42 +0,0 @@
{
lib,
config,
...
}: let
cfg = config.youthlic.programs.nixvim;
in {
config = lib.mkIf cfg.enable {
programs.nixvim = {
opts = {
backspace = ["indent" "eol" "start"];
tabstop = 4;
shiftwidth = 4;
expandtab = true;
shiftround = true;
autoindent = true;
nu = true;
rnu = true;
wildmenu = true;
hlsearch = false;
ignorecase = true;
smartcase = true;
completeopt = ["menu" "noselect"];
cursorline = true;
termguicolors = true;
signcolumn = "yes";
autoread = true;
title = true;
swapfile = false;
backup = false;
updatetime = 50;
mouse = "a";
undofile = true;
exrc = true;
scrolloff = 5;
wrap = true;
splitright = true;
splitbelow = true;
};
};
};
}

View file

@ -9,6 +9,7 @@ in
./wallpapers.nix
./waydroid-script.nix
./rime-yuhaostar.nix
./nixvim.nix
./pkgsNoCuda.nix
]

View file

@ -0,0 +1,5 @@
{outputs, ...}: _final: prev: let
inherit (prev.stdenv.hostPlatform) system;
in {
inherit (outputs.packages.${system}) nixvim;
}

13
pkgs/nixvim/package.nix Normal file
View file

@ -0,0 +1,13 @@
{
makeNixvimWithModule,
pkgs,
lib,
}:
makeNixvimWithModule {
inherit pkgs;
module = {
imports = with lib; youthlic.loadImports' ./. (filter (name: !hasSuffix "/package.nix" (toString name)));
enableMan = true;
plugins.lualine.enable = true;
};
}