refactor(treewide): clean-up, flatten, rework module system

This commit is contained in:
ooks-io 2024-06-05 22:56:07 +12:00
parent 4ddf9d2b35
commit 5590c8a951
58 changed files with 397 additions and 635 deletions

View file

@ -1,18 +1,21 @@
{ inputs, config, pkgs, lib, ... }:
let
cfg = config.ooknet.console.editor.helix;
inherit (config) colorscheme;
in
{
let
inherit (config) colorscheme;
inherit (lib) mkIf;
cfg = config.ooknet.editor.helix;
console = config.ooknet.console;
in
{
imports = [
./languages.nix
];
config = lib.mkIf cfg.enable {
config = mkIf (cfg.enable || console.editor == "helix") {
programs.helix = {
enable = true;
defaultEditor = lib.mkIf cfg.default true;
defaultEditor = mkIf (console.editor == "helix") true;
package = inputs.helix.packages.${pkgs.system}.default.overrideAttrs (old: {
makeWrapperArgs = with pkgs;
old.makeWrapperArgs

View file

@ -1,11 +1,13 @@
{ pkgs, lib, config, ... }:
let
cfg = config.ooknet.console.editor.helix;
inherit (lib) mkIf getExe;
cfg = config.ooknet.editor.helix;
console = config.ooknet.console;
in
{
config = lib.mkIf cfg.enable {
config = mkIf (cfg.enable || console.editor == "helix") {
programs.helix.languages = {
language = let
deno = lang: {
@ -89,12 +91,12 @@ in
};
nil = {
command = lib.getExe pkgs.nil;
config.nil.formatting.command = ["${lib.getExe pkgs.alejandra}" "-q"];
command = getExe pkgs.nil;
config.nil.formatting.command = ["${getExe pkgs.alejandra}" "-q"];
};
dprint = {
command = lib.getExe pkgs.dprint;
command = getExe pkgs.dprint;
args = ["lsp"];
};

View file

@ -2,7 +2,9 @@
let
inherit (config.colorscheme) palette;
cfg = config.ooknet.console.editor.nvim;
inherit (lib) mkIf;
cfg = config.ooknet.editor.nvim;
console = config.ooknet.console;
in
{
@ -13,7 +15,7 @@ in
./plugins
];
config = lib.mkIf cfg.enable {
config = mkIf (cfg.enable || console.editor == "nvim") {
programs.neovim = {
viAlias = true;
vimAlias = true;

View file

@ -1,11 +1,13 @@
{ config, lib, ... }:
let
cfg = config.ooknet.console.editor.nvim;
inherit (lib) mkIf mapAttrsToList;
cfg = config.ooknet.editor.nvim;
console = config.ooknet.console;
in
{
config = lib.mkIf cfg.enable {
config = mkIf (cfg.enable || console.editor == "nvim") {
programs.nixvim = {
globals = {
mapleader = " ";
@ -14,7 +16,7 @@ in
keymaps = let
normal =
lib.mapAttrsToList
mapAttrsToList
(key: action: {
mode = "n";
inherit action key;
@ -25,7 +27,7 @@ in
"Y" = "$y";
};
visual =
lib.mapAttrsToList
mapAttrsToList
(key: action: {
mode = "v";
inherit action key;

View file

@ -1,28 +1,7 @@
{ lib, ... }:
{
imports = [
./indent.nix
./telescope.nix
./lualine.nix
];
options.ooknet.console.editor.nvim.plugins = {
indentBlankline = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable indent-blankline nvim plugin module";
};
lualine = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable lualine nvim plugin module";
};
telescope = lib.mkOption {
type = lib.types.bool;
default = false;
description = "Enable telescope nvim plugin module";
};
};
}

View file

@ -1,11 +1,13 @@
{ config, lib, ... }:
let
cfg = config.ooknet.console.editor.nvim.plugins;
inherit (lib) mkIf;
cfg = config.ooknet.editor.nvim;
console = config.ooknet.console;
in
{
config = lib.mkIf cfg.indentBlankline {
config = mkIf (cfg.enable || console.editor == "nvim") {
programs.nixvim.plugins.indent-blankline = {
enable = true;
};

View file

@ -1,11 +1,13 @@
{ config, lib, ... }:
let
cfg = config.ooknet.console.editor.nvim.plugins;
inherit (lib) mkIf;
cfg = config.ooknet.editor.nvim;
console = config.ooknet.console;
in
{
config = lib.mkIf cfg.lualine {
config = mkIf (cfg.enable || console.editor == "nvim") {
programs.nixvim.plugins.lualine = {
enable = true;
theme = "base16";

View file

@ -1,11 +1,13 @@
{ config, lib, ... }:
let
cfg = config.ooknet.console.editor.nvim.plugins;
inherit (lib) mkIf;
cfg = config.ooknet.editor.nvim;
console = config.ooknet.console;
in
{
config = lib.mkIf cfg.telescope {
config = mkIf (cfg.enable || console.editor == "nvim") {
programs.nixvim = {
plugins.telescope = {
enable = true;

View file

@ -2,11 +2,13 @@
let
inherit (config.colorscheme) palette;
cfg = config.ooknet.console.editor.nvim;
inherit (lib) mkIf;
cfg = config.ooknet.editor.nvim;
console = config.ooknet.console;
in
{
config = lib.mkIf cfg.enable {
config = mkIf (cfg.enable || console.editor == "nvim") {
programs.nixvim = {
options = {
relativenumber = true;