refactor: complete rewrite

This commit is contained in:
ooks-io 2024-10-23 23:46:25 +13:00
parent 19a4bbda3c
commit 8e81943cf9
399 changed files with 3396 additions and 8042 deletions

10
outputs/apps.nix Normal file
View file

@ -0,0 +1,10 @@
{lib, ...}: let
inherit (lib) getExe;
in {
perSystem = {config, ...}: {
apps = {
ooks-vim.program = getExe config.packages.ook-vim;
default = config.apps.ook-vim;
};
};
}

View file

@ -1,9 +1,9 @@
{
imports = [
./nixos.nix
./sshKeys.nix
./formatter.nix
./apps.nix
./lib
./hosts
./keys.nix
./pkgs
];
}

View file

@ -1,5 +0,0 @@
_: {
perSystem = {pkgs, ...}: {
formatter = pkgs.alejandra;
};
}

View file

@ -0,0 +1,5 @@
{
imports = [
./workstations.nix
];
}

View file

@ -0,0 +1,22 @@
{
withSystem,
ook,
...
}: let
inherit (ook.lib.builders) mkWorkstation;
in {
flake.nixosConfigurations = {
ookst480s = mkWorkstation {
inherit withSystem;
system = "x86_64-linux";
hostname = "ookst480s";
type = "laptop";
};
ooksdesk = mkWorkstation {
inherit withSystem;
system = "x86_64-linux";
hostname = "ooksdesk";
type = "desktop";
};
};
}

6
outputs/keys.nix Normal file
View file

@ -0,0 +1,6 @@
let
keys = import ../secrets/keys.nix;
in {
perSystem._module.args.keys = keys;
flake.keys = keys;
}

View file

@ -4,15 +4,24 @@
self,
...
}: let
inherit (inputs) nixpkgs;
inherit (lib) singleton recursiveUpdate mkDefault;
inherit (builtins) concatLists;
inherit (self) keys;
hm = inputs.home-manager.nixosModules.home-manager;
agenix = inputs.agenix.nixosModules.default;
nixosModules = "${self}/nixos";
mkNixos = inputs.nixpkgs.lib.nixosSystem;
nixosModules = "${self}/modules/nixos";
baseModules = nixosModules + "/base";
hardwareModules = nixosModules + "/hardware";
appearanceModules = nixosModules + "/appearance";
consoleModules = nixosModules + "/console";
workstationModules = nixosModules + "/workstation";
serverModules = nixosModules + "/server";
core = [baseModules hardwareModules consoleModules appearanceModules hm agenix];
hostModules = "${self}/hosts";
mkNixos = nixpkgs.lib.nixosSystem;
mkBaseSystem = {
withSystem,
hostname,
@ -36,7 +45,10 @@
modules = concatLists [
(singleton {
networking.hostName = hostname;
nixpkgs.hostPlatform = mkDefault system;
nixpkgs = {
flake.source = nixpkgs.outPath;
hostPlatform = mkDefault system;
};
ooknet.host = {
name = hostname;
inherit role type;
@ -59,7 +71,8 @@
inherit withSystem hostname system type specialArgs;
role = "workstation";
additionalModules = concatLists [
[hm agenix nixosModules]
core
[workstationModules]
additionalModules
];
};
@ -83,6 +96,8 @@
inherit platform services;
};
})
core
[serverModules]
additionalModules
];
};

View file

@ -2,11 +2,15 @@
lib,
self,
inputs,
pkgs,
...
}: let
builders = import ./builders.nix {inherit self lib inputs;};
in {
_module.args.ooknet.lib = {
inherit builders;
# My person functions
ook-lib = {
builders = import ./builders.nix {inherit self lib inputs;};
mkNeovim = import ./mkNeovim.nix {inherit inputs;};
};
in {
_module.args.ook.lib = ook-lib;
flake.ook.lib = ook-lib;
}

12
outputs/lib/mkNeovim.nix Normal file
View file

@ -0,0 +1,12 @@
{inputs, ...}: let
inherit (inputs.nvf.lib) neovimConfiguration;
mkNeovim = pkgs: modules:
(neovimConfiguration {
inherit pkgs;
extraSpecialArgs = {inherit inputs;};
inherit modules;
})
.neovim;
in
mkNeovim

View file

@ -1,48 +0,0 @@
{
self,
withSystem,
ooknet,
...
}: let
inherit (ooknet.lib.builders) mkServer mkWorkstation;
in {
flake.nixosConfigurations = {
ooksdesk = mkWorkstation {
inherit withSystem;
hostname = "ooksdesk";
system = "x86_64-linux";
type = "desktop";
};
ookst480s = mkWorkstation {
inherit withSystem;
system = "x86_64-linux";
hostname = "ookst480s";
type = "laptop";
};
ooksmedia = mkWorkstation {
inherit withSystem;
system = "x86_64-linux";
hostname = "ooksmedia";
type = "desktop";
};
ooksmicro = mkWorkstation {
inherit withSystem;
system = "x86_64-linux";
hostname = "ooksmicro";
};
ooksx1 = mkWorkstation {
inherit withSystem;
system = "x86_64-linux";
hostname = "ooksx1";
};
ooknode = mkServer {
inherit withSystem;
system = "x86_64-linux";
hostname = "ooknode";
};
};
}

View file

@ -1,29 +0,0 @@
{inputs, ...}: {
# For every flake input, aliases 'pkgs.inputs.${flake}' to
# 'inputs.${flake}.packages.${pkgs.system}' or
# 'inputs.${flake}.legacyPackages.${pkgs.system}'
flake-inputs = final: _: {
inputs =
builtins.mapAttrs
(
_: flake: let
legacyPackages = (flake.legacyPackages or {}).${final.system} or {};
packages = (flake.packages or {}).${final.system} or {};
in
if legacyPackages != {}
then legacyPackages
else packages
)
inputs;
};
zjstatus = _final: prev: {
zjstatus = inputs.zjstatus.packages.${prev.system}.default;
};
# waybar = final: prev: {
# waybar = inputs.nixpkgs-wayland.packages.${prev.system}.waybar;
# };
additions = final: _prev: import ../pkgs {pkgs = final;};
}

View file

@ -1,8 +1,12 @@
{
perSystem = {pkgs, ...}: {
{ook, ...}: {
perSystem = {pkgs, ...}: let
inherit (ook.lib) mkNeovim;
ook-vim-config = import ./ook-vim;
in {
packages = {
live-buds-cli = pkgs.callPackage ./live-buds-cli {};
repopack = pkgs.callPackage ./repopack {};
live-buds-cli = pkgs.callPackage ./live-buds-cli {};
ook-vim = mkNeovim pkgs [ook-vim-config];
};
};
}

View file

@ -18,14 +18,14 @@ rustPlatform.buildRustPackage rec {
sha256 = "A4XQiJrk4ehb6+935L2JFOeAhUJ7bdukV5mL0Jxn0sQ=";
};
cargoSha256 = "w/dt7Q9TACw5N/+QNAKMUEngf8sAhWyGslnw3B16crQ=";
cargoHash = "sha256-w/dt7Q9TACw5N/+QNAKMUEngf8sAhWyGslnw3B16crQ";
nativeBuildInputs = [pkg-config];
buildInputs = [libpulseaudio bluez dbus];
meta = with lib; {
meta = {
description = "A free cli tool to control your Galaxy buds live, Galaxy Buds+, Galaxy Buds Pro, Galaxy Buds 2 and Galaxy Buds 2 Pro";
license = licenses.gpl3;
platforms = platforms.unix;
license = lib.licenses.gpl3;
platforms = lib.platforms.unix;
};
}

View file

@ -0,0 +1,9 @@
{
imports = [
./settings.nix
./theme.nix
./keymaps.nix
./plugins
./modules
];
}

View file

@ -0,0 +1,5 @@
{
config.vim = {
globals.mapleader = " ";
};
}

View file

@ -0,0 +1,5 @@
{
imports = [
./plugins
];
}

View file

@ -0,0 +1,6 @@
{
imports = [
./gruvbox-material
./telescope
];
}

View file

@ -0,0 +1,80 @@
{
config,
lib,
inputs,
pkgs,
...
}: let
inherit (lib) mkOption mkIf boolToString;
inherit (lib.types) bool enum lines;
inherit (inputs.nvf.lib.nvim.dag) entryAfter;
cfg = config.vim.gruvbox-material;
in {
options.vim.gruvbox-material = {
enable = mkOption {
type = bool;
description = "Enable gruvbox-material-theme";
default = false;
};
contrast = mkOption {
type = enum ["dark" "medium" "soft"];
description = "Set contrast, can be any of 'hard', 'medium', 'soft'";
default = "dark";
};
italics = mkOption {
type = bool;
description = "Enable italic comments";
default = true;
};
transparent = mkOption {
type = bool;
description = "Set background to transparent";
default = false;
};
floatForceBackground = mkOption {
type = bool;
description = "Force backgrounds on floats even when transparent = true";
default = false;
};
signsHighlight = mkOption {
type = bool;
description = "Enable sign highlighting";
default = true;
};
extraConfig = mkOption {
type = lines;
description = "Additional lua configuration after";
};
};
config = mkIf cfg.enable {
vim = {
startPlugins = [pkgs.vimPlugins.gruvbox-material-nvim];
luaConfigRC.theme =
entryAfter ["basic"]
/*
lua
*/
''
require('gruvbox-material').setup{
contrast = "${cfg.contrast}",
comments = {
italics = ${boolToString cfg.italics},
},
background = {
transparent = ${boolToString cfg.transparent},
},
float = {
force_background = ${boolToString cfg.floatForceBackground},
background_color = nil,
},
signs = {
highlight = ${boolToString cfg.signsHighlight},
},
}
${cfg.extraConfig}
'';
};
};
}

View file

@ -0,0 +1,5 @@
{
imports = [
./config.nix
];
}

View file

@ -0,0 +1,55 @@
{
config,
lib,
inputs,
...
}: let
inherit (lib) mkIf mkOption;
inherit (lib.types) bool;
inherit (inputs.nvf.lib.nvim.dag) entryAfter;
cfg = config.vim.telescope;
in {
options.vim.telescope = {
autostart = mkOption {
type = bool;
default = false;
description = "Auto start telescope when opening neovim unless opening a file";
};
};
config = mkIf cfg.autostart {
vim.luaConfigRC.telescope-autostart =
entryAfter ["pluginConfigs"]
#lua
''
local find_files_hijack_netrw = vim.api.nvim_create_augroup("find_files_hijack_netrw", { clear = true })
-- clear FileExplorer appropriately to prevent netrw from launching on folders
-- netrw may or may not be loaded before telescope-find-files
-- conceptual credits to nvim-tree and telescope-file-browser
vim.api.nvim_create_autocmd("VimEnter", {
pattern = "*",
once = true,
callback = function()
pcall(vim.api.nvim_clear_autocmds, { group = "FileExplorer" })
end,
})
vim.api.nvim_create_autocmd("BufEnter", {
group = find_files_hijack_netrw,
pattern = "*",
callback = function()
vim.schedule(function()
-- Early return if netrw or not a directory
if vim.bo[0].filetype == "netrw" or vim.fn.isdirectory(vim.fn.expand("%:p")) == 0 then
return
end
vim.api.nvim_buf_set_option(0, "bufhidden", "wipe")
require("telescope.builtin").find_files({
cwd = vim.fn.expand("%:p:h"),
})
end)
end,
})
'';
};
}

View file

@ -0,0 +1,5 @@
{
imports = [
./config.nix
];
}

View file

@ -0,0 +1,5 @@
{
vim.autocomplete.nvim-cmp = {
enable = true;
};
}

View file

@ -0,0 +1,5 @@
{
vim.comments = {
comment-nvim.enable = true;
};
}

View file

@ -0,0 +1,15 @@
{
imports = [
./telescope.nix
./filetree.nix
./cmp.nix
./terminal.nix
./git.nix
./projects.nix
./utility.nix
./ui.nix
./languages
./statusline.nix
./snippets.nix
];
}

View file

@ -0,0 +1,17 @@
{
vim.filetree = {
neo-tree = {
enable = true;
setupOpts = {
filesystem = {
hijack_netrw_behavior = "open_current";
follow_current_file.enabled = true;
};
};
};
};
vim.maps.normal."<C-e>" = {
desc = "Toggle Tree";
action = "<cmd>Neotree toggle reveal<cr>";
};
}

View file

@ -0,0 +1,9 @@
{
vim.git = {
enable = true;
gitsigns = {
enable = true;
codeActions.enable = false;
};
};
}

View file

@ -0,0 +1,5 @@
{
vim.languages.bash = {
enable = true;
};
}

View file

@ -0,0 +1,6 @@
{
vim.languages.css = {
enable = true;
format.enable = true;
};
}

View file

@ -0,0 +1,19 @@
{
imports = [
./nix.nix
./lsp.nix
./bash.nix
./treesitter.nix
./html.nix
./ts.nix
];
vim.languages = {
enableLSP = true;
enableTreesitter = true;
enableFormat = true;
enableExtraDiagnostics = true;
typst.enable = true;
};
}

View file

@ -0,0 +1,5 @@
{
vim.languages.html = {
enable = true;
};
}

View file

@ -0,0 +1,8 @@
{
vim.lsp = {
formatOnSave = true;
lspkind.enable = true;
lspSignature.enable = true;
trouble = {enable = true;};
};
}

View file

@ -0,0 +1,11 @@
{
vim = {
languages.markdown = {
enable = true;
format = true;
};
utility = {
preview.markdownPreview = {enable = true;};
};
};
}

View file

@ -0,0 +1,5 @@
{
vim.languages.nix = {
enable = true;
};
}

View file

@ -0,0 +1,11 @@
{pkgs, ...}: {
vim.treesitter = {
enable = true;
fold = true;
grammars = with pkgs.vimPlugins.nvim-treesitter.builtGrammars; [
kdl
regex
fish
];
};
}

View file

@ -0,0 +1,5 @@
{
vim.languages.ts = {
enable = true;
};
}

View file

@ -0,0 +1,16 @@
{
vim.projects = {
project-nvim = {
enable = true;
setupOpts = {
manualMode = false;
detectionMethods = ["lsp" "pattern"];
patterns = [
".git"
"index.*"
"flake.nix"
];
};
};
};
}

View file

@ -0,0 +1,5 @@
{
vim.snippets.luasnip = {
enable = true;
};
}

View file

@ -0,0 +1,52 @@
{
vim.statusline.lualine = {
enable = true;
activeSection = {
a = [
#lua
''
{
"mode",
icons_enabled = true,
seperator = {left = "", right = " ", }
}
''
#lua
''
{
draw_empty = true,
seperator = { left = " ", right = " " }
}
''
];
b = [
#lua
''
{
"",
draw_empty = true,
}
''
];
c = ["filename"];
x = [
# lua
''
{
"diagnostics",
sources = {'nvim_lsp', 'nvim_diagnostic', 'nvim_diagnostic', 'vim_lsp'},
symbols = {error = '󰅙 ', warn = ' ', info = ' ', hint = '󰌵 '},
colored = true,
update_in_insert = false,
always_visible = false,
diagnostics_color = {
color_error = { fg = 'red' },
color_warn = { fg = 'yellow' },
color_info = { fg = 'cyan' },
}
}
''
];
};
};
}

View file

@ -0,0 +1,16 @@
{
vim.telescope = {
enable = true;
mappings = {
findFiles = "<leader>ff";
liveGrep = "<leader>/";
open = null;
gitCommits = null;
gitBufferCommits = null;
gitBranches = null;
gitStatus = null;
gitStash = null;
};
};
}

View file

@ -0,0 +1,11 @@
{
vim.terminal = {
toggleterm = {
enable = true;
lazygit = {
enable = true;
direction = "float";
};
};
};
}

View file

@ -0,0 +1,35 @@
{
vim = {
ui = {
borders = {
enable = true;
globalStyle = "single";
};
# better cmd line
noice.enable = true;
colorizer.enable = true;
illuminate.enable = true;
};
# < https://github.com/NotAShelf/nvf/tree/main/modules/plugins/visuals >
visuals = {
enable = true;
# icons that other plugins depend on.
nvimWebDevicons.enable = true;
fidget-nvim.enable = true;
# indent lines
indentBlankline = {
enable = true;
setupOpts = {
scope = {
enabled = false;
injected_languages = false;
};
};
};
};
};
}

View file

@ -0,0 +1,5 @@
{
vim.binds.whichKey = {
enable = true;
};
}

View file

@ -0,0 +1,23 @@
{pkgs, ...}: {
vim = {
package = pkgs.neovim-unwrapped;
leaderKey = " ";
tabWidth = 2;
autoIndent = true;
searchCase = "smart";
enableLuaLoader = true;
enableEditorconfig = true;
useSystemClipboard = true;
autopairs.nvim-autopairs.enable = true;
hideSearchHighlight = true;
theme = {
enable = false;
};
};
# Additional sets can be added here
# vim.luaConfigRC.basic =
# entryAfter ["entryAfter"] #lua
# ''
#
# '';
}

View file

@ -0,0 +1,20 @@
{
vim.gruvbox-material = {
enable = true;
contrast = "medium";
italics = false;
transparent = false;
extraConfig =
# lua
''
local g_colors = require("gruvbox-material.colors")
local colors = g_colors.get(vim.o.background, "soft")
-- Noice
vim.api.nvim_set_hl(0, "NoiceCmdlinePopupBorderHelp", { fg = colors.yellow })
vim.api.nvim_set_hl(0, "NoiceCmdlinePopupBorder", { fg = colors.grey1 })
vim.api.nvim_set_hl(0, "NoiceCmdlineIcon", { fg = colors.green })
vim.api.nvim_set_hl(0, "NoiceCmdLinePopupTitle", { fg = colors.grey1 })
'';
};
}

View file

@ -1,6 +0,0 @@
let
sshKeys = import ../secrets/keys.nix;
in {
perSystem = _: {_module.args.keys = sshKeys;};
flake.keys = sshKeys;
}