1

Compare commits

...

4 Commits

67 changed files with 470 additions and 334 deletions

View File

@ -3,10 +3,5 @@
pkgs,
...
}: {
# I am currently not using any custom derivations.
# Old derivations are still kept in this folder, for reference.
# modules-options-doc = pkgs.callPackage ./modules-options-doc {mylib = mylib;};
# xdg-desktop-portal-termfilechooser = pkgs.callPackage ./xdg-desktop-portal-termfilechooser {};
# decker = pkgs.callPackage ./decker {};
# Obsolete derivations are kept in "1_deprecated" for reference.
}

View File

@ -46,6 +46,9 @@
inherit system;
config.allowUnfree = true;
# Alternative to setting config.allowUnfree.
# I read somewhere that this is more suitable when running HM standalone.
config.allowUnfreePredicate = pkg: true;
# Overlays define changes in the nixpkgs package set.

View File

@ -5,5 +5,5 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "TEMPLATE";
enable = mkEnableOption "TEMPLATE";
}

View File

@ -5,5 +5,5 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Enable Alacritty";
enable = mkEnableOption "Enable Alacritty";
}

View File

@ -0,0 +1,48 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOption "Audio module";
# TODO: Group these in categories (like instruments/VSTs or sth)
# TODO: Make it easier to add many yes/no options, similar to the flatpak stuff
# Hosts/Editing
carla.enable = mkEnableOption "Carla (VST host)";
bitwig.enable = mkEnableOption "Bitwig (Digital audio workstation)";
tenacity.enable = mkEnableOption "Tenacity (Audacity fork)";
# Instruments/Plugins
# vcvrack.enable = mkEnableOption "VCV-Rack (Eurorack simulator)"; # Replaced by cardinal
cardinal.enable = mkEnableOption "Open Source VCV-Rack plugin wrapper";
# vital.enable = mkEnableOption "Vital (Wavetable synthesizer)"; # Replaced by distrho
distrho.enable = mkEnableOption "Distrho (Linux VST ports)";
# Misc
faust.enable = mkEnableOption "Faust (functional DSP language)";
bottles.enable = mkEnableOption "Bottles (flatpak)";
# TODO: Automatically add the needed paths, depends on the bottle though
# /home/christoph/.var/app/com.usebottles.bottles/data/bottles/bottles/Audio/drive_c/Program Files/Common Files/VST3
# /home/christoph/.var/app/com.usebottles.bottles/data/bottles/bottles/Audio/drive_c/Program Files/VstPlugins
yabridge = {
enable = mkEnableOption "Yabridge (Windows VST plugin manager)";
autoSync = mkBoolOption false "Sync yabridge plugins on nixos-rebuild";
};
noisesuppression = {
noisetorch = {
enable = mkEnableOption "Noisetorch";
autostart = mkBoolOption false "Autoload Noisetorch suppression";
};
# TODO: Store easyeffects presets/config (dconf com/github/wwmm/easyeffects ?)
easyeffects = {
enable = mkEnableOption "EasyEffects";
autostart = mkBoolOption false "Autoload EasyEffects suppression profile";
};
};
}

View File

@ -0,0 +1,20 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOption "Emacs module";
# TODO: Use an enum for this not individual options
nixpkgs = mkBoolOption false "Use Emacs from the official repositories";
nativeComp = mkBoolOption false "Use Emacs 28.x branch with native comp support";
pgtkNativeComp = mkBoolOption false "Use Emacs 29.x branch with native comp and pure gtk support";
doom = {
enable = mkEnableOption "Doom Emacs framework";
autoSync = mkBoolOption false "Sync Doom Emacs on nixos-rebuild";
autoUpgrade = mkBoolOption false "Upgrade Doom Emacs on nixos-rebuild";
};
}

View File

@ -0,0 +1,16 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOption "Email";
autosync = mkEnableOption "Automatically call \"notmuch new\" via systemd timer";
imapnotify = mkEnableOption "Use imapnotify to sync and index mail automatically";
kmail = {
enable = mkEnableOption "Kmail";
autostart = mkEnableOption "Autostart Kmail";
};
}

View File

@ -5,22 +5,22 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Flatpak module";
fontFix = mkBoolOpt true "Link fonts to ~/.local/share/fonts so flatpak apps can find them";
iconFix = mkBoolOpt true "Link icons to ~/.local/share/icons so flatpak apps can find them";
autoUpdate = mkBoolOpt false "Update flatpak apps on nixos-rebuild";
autoPrune = mkBoolOpt false "Remove unused packages on nixos-rebuild";
enable = mkEnableOption "Flatpak module";
fontFix = mkBoolOption true "Link fonts to ~/.local/share/fonts so flatpak apps can find them";
iconFix = mkBoolOption true "Link icons to ~/.local/share/icons so flatpak apps can find them";
autoUpdate = mkBoolOption false "Update flatpak apps on nixos-rebuild";
autoPrune = mkBoolOption false "Remove unused packages on nixos-rebuild";
# TODO: Add library function to make this easier
# TODO: The flatpak name should be included and a list of all enabled apps should be available
# TODO: Do this for strings + packages
discord.enable = mkEnableOpt "Discord";
spotify.enable = mkEnableOpt "Spotify";
flatseal.enable = mkEnableOpt "Flatseal";
bottles.enable = mkEnableOpt "Bottles";
obsidian.enable = mkEnableOpt "Obsidian";
jabref.enable = mkEnableOpt "Jabref";
# xwaylandvideobridge = mkEnableOpt "XWayland Video Bridge"; # TODO
discord.enable = mkEnableOption "Discord";
spotify.enable = mkEnableOption "Spotify";
flatseal.enable = mkEnableOption "Flatseal";
bottles.enable = mkEnableOption "Bottles";
obsidian.enable = mkEnableOption "Obsidian";
jabref.enable = mkEnableOption "Jabref";
# xwaylandvideobridge = mkEnableOption "XWayland Video Bridge"; # TODO
# TODO: Can I use extraInstall = { "com.valve.Steam" = true/false; } and pass the module option as value?
# This is mainly used by other modules to allow them to use flatpak packages

View File

@ -0,0 +1,23 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOption "Gaming module";
# discordElectron.enable = mkEnableOption "Discord (Electron) (nixpkgs)";
# discordChromium.enable = mkEnableOption "Discord (Chromium)";
prism.enable = mkEnableOption "PrismLauncher for Minecraft (flatpak)";
bottles.enable = mkEnableOption "Bottles (flatpak)";
# dwarffortress.enable = mkEnableOption "Dwarf Fortress";
cemu.enable = mkEnableOption "Cemu (nixpkgs)";
steam = {
enable = mkEnableOption "Steam (flatpak)";
gamescope = mkBoolOption false "Enable the gamescope micro compositor (flatpak)";
adwaita = mkBoolOption false "Enable the adwaita-for-steam skin";
protonup = mkBoolOption false "Enable ProtonUP-QT";
};
}

View File

@ -5,5 +5,5 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Helix Editor";
enable = mkEnableOption "Helix Editor";
}

View File

@ -0,0 +1,19 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOption "Misc module";
keepass = {
enable = mkEnableOption "KeePassXC";
autostart = mkBoolOption false "Autostart KeePassXC";
};
protonmail = {
enable = mkEnableOption "ProtonMail";
autostart = mkBoolOption false "Autostart ProtonMail Bridge";
};
}

View File

@ -0,0 +1,10 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOption "Nextcloud Client";
autostart = mkBoolOption false "Autostart the Nextcloud client (systemd)";
}

View File

@ -0,0 +1,10 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOption "Ranger";
preview = mkBoolOption false "Enable Ranger image preview";
}

View File

@ -5,5 +5,5 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Visual Studio Code";
enable = mkEnableOption "Visual Studio Code";
}

View File

@ -1,48 +0,0 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Audio module";
# TODO: Group these in categories (like instruments/VSTs or sth)
# TODO: Make it easier to add many yes/no options, similar to the flatpak stuff
# Hosts/Editing
carla.enable = mkEnableOpt "Carla (VST host)";
bitwig.enable = mkEnableOpt "Bitwig (Digital audio workstation)";
tenacity.enable = mkEnableOpt "Tenacity (Audacity fork)";
# Instruments/Plugins
# vcvrack.enable = mkEnableOpt "VCV-Rack (Eurorack simulator)"; # Replaced by cardinal
cardinal.enable = mkEnableOpt "Open Source VCV-Rack plugin wrapper";
# vital.enable = mkEnableOpt "Vital (Wavetable synthesizer)"; # Replaced by distrho
distrho.enable = mkEnableOpt "Distrho (Linux VST ports)";
# Misc
faust.enable = mkEnableOpt "Faust (functional DSP language)";
bottles.enable = mkEnableOpt "Bottles (flatpak)";
# TODO: Automatically add the needed paths, depends on the bottle though
# /home/christoph/.var/app/com.usebottles.bottles/data/bottles/bottles/Audio/drive_c/Program Files/Common Files/VST3
# /home/christoph/.var/app/com.usebottles.bottles/data/bottles/bottles/Audio/drive_c/Program Files/VstPlugins
yabridge = {
enable = mkEnableOpt "Yabridge (Windows VST plugin manager)";
autoSync = mkBoolOpt false "Sync yabridge plugins on nixos-rebuild";
};
noisesuppression = {
noisetorch = {
enable = mkEnableOpt "Noisetorch";
autostart = mkBoolOpt false "Autoload Noisetorch suppression";
};
# TODO: Store easyeffects presets/config (dconf com/github/wwmm/easyeffects ?)
easyeffects = {
enable = mkEnableOpt "EasyEffects";
autostart = mkBoolOpt false "Autoload EasyEffects suppression profile";
};
};
}

View File

@ -5,6 +5,6 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Chromium";
google = mkEnableOpt "Google Chrome";
enable = mkEnableOption "Chromium";
google = mkEnableOption "Google Chrome";
}

View File

@ -1,17 +1,6 @@
{inputs, ...}: {
imports = [
# Obsolete modules are kept in this folder for reference.
# ./alacritty
# ./audio
# ./emacs
# ./email
# ./flatpak
# ./helix
# ./gaming
# ./misc
# ./nextcloud
# ./ranger
# ./vscode
# Obsolete modules are kept in "1_deprecated" for reference.
# My own HM modules
./chromium

View File

@ -1,20 +0,0 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Emacs module";
# TODO: Use an enum for this not individual options
nixpkgs = mkBoolOpt false "Use Emacs from the official repositories";
nativeComp = mkBoolOpt false "Use Emacs 28.x branch with native comp support";
pgtkNativeComp = mkBoolOpt false "Use Emacs 29.x branch with native comp and pure gtk support";
doom = {
enable = mkEnableOpt "Doom Emacs framework";
autoSync = mkBoolOpt false "Sync Doom Emacs on nixos-rebuild";
autoUpgrade = mkBoolOpt false "Upgrade Doom Emacs on nixos-rebuild";
};
}

View File

@ -1,16 +0,0 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Email";
autosync = mkEnableOpt "Automatically call \"notmuch new\" via systemd timer";
imapnotify = mkEnableOpt "Use imapnotify to sync and index mail automatically";
kmail = {
enable = mkEnableOpt "Kmail";
autostart = mkEnableOpt "Autostart Kmail";
};
}

View File

@ -5,10 +5,10 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Firefox";
wayland = mkBoolOpt false "Enable firefox wayland support";
vaapi = mkBoolOpt false "Enable firefox vaapi support";
disableTabBar = mkBoolOpt false "Disable the firefox tab bar (for TST)";
defaultBookmarks = mkBoolOpt false "Preset standard bookmarks and folders";
gnomeTheme = mkBoolOpt false "Use Firefox gnome theme (rafaelmardojai)";
enable = mkEnableOption "Firefox";
wayland = mkBoolOption false "Enable firefox wayland support";
vaapi = mkBoolOption false "Enable firefox vaapi support";
disableTabBar = mkBoolOption false "Disable the firefox tab bar (for TST)";
defaultBookmarks = mkBoolOption false "Preset standard bookmarks and folders";
gnomeTheme = mkBoolOption false "Use Firefox gnome theme (rafaelmardojai)";
}

View File

@ -5,5 +5,5 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Fish";
enable = mkEnableOption "Fish";
}

View File

@ -1,23 +0,0 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Gaming module";
# discordElectron.enable = mkEnableOpt "Discord (Electron) (nixpkgs)";
# discordChromium.enable = mkEnableOpt "Discord (Chromium)";
prism.enable = mkEnableOpt "PrismLauncher for Minecraft (flatpak)";
bottles.enable = mkEnableOpt "Bottles (flatpak)";
# dwarffortress.enable = mkEnableOpt "Dwarf Fortress";
cemu.enable = mkEnableOpt "Cemu (nixpkgs)";
steam = {
enable = mkEnableOpt "Steam (flatpak)";
gamescope = mkBoolOpt false "Enable the gamescope micro compositor (flatpak)";
adwaita = mkBoolOpt false "Enable the adwaita-for-steam skin";
protonup = mkBoolOpt false "Enable ProtonUP-QT";
};
}

View File

@ -1,5 +1,6 @@
# TODO: Use the home-manager module instead of generating my own scuffed config files
#
# TODO: The keys to reset the workspaces need to depend on actual workspace config
# TODO: Many of the text file generations can be made simpler with pipe and concatLines functions...
# TODO: The border color does not fit the current theme
{
config,
@ -39,7 +40,6 @@ in {
};
services = {
# TODO: Make a module out of this
# Notification service
dunst = {
enable = true;
@ -78,14 +78,11 @@ in {
};
home = {
# TODO: catppuccin-cursors
pointerCursor = {
gtk.enable = true;
x11.enable = true;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
# package = pkgs.catppuccin-cursors.latteMauve;
# name = "Catppuccin-Latte-Mauve-Cursors";
size = 16;
};
@ -118,13 +115,22 @@ in {
#
file = {
# Polkit
# Link the main Hyprland configuration file.
# This file imports all the other generated files.
# TODO: Generate this, so only existing files are imported.
".config/hypr/hyprland.conf".source = ../../../config/hyprland/hyprland.conf;
# Provide a polkit authentication UI.
# This is used for example when running systemd commands without root.
".config/hypr/polkit.conf".text = ''
exec-once = ${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1
exec-once = ${pkgs.kdePackages.polkit-kde-agent-1}/libexec/polkit-kde-authentication-agent-1
'';
# Monitors for different systems
# Configure different monitors.
".config/hypr/monitors.conf".text = let
# This function is mapped to the "cfg.monitors" attrSet.
# For each key-value entry in "cfg.monitors",
# the key will be assigned to "name" and the value to "conf".
mkMonitor = name: conf: "monitor = ${name}, ${toString conf.width}x${toString conf.height}@${toString conf.rate}, ${toString conf.x}x${toString conf.y}, ${toString conf.scale}";
in
lib.pipe cfg.monitors [
@ -133,7 +139,7 @@ in {
(builtins.concatStringsSep "\n")
];
# Bind workspaces to monitors
# Configure how workspaces are mapped to monitors.
".config/hypr/workspaces.conf".text = let
mkWorkspace = monitor: workspace: "workspace = ${toString workspace}, monitor:${toString monitor}";
mkWorkspaces = monitor: workspace-list: map (mkWorkspace monitor) workspace-list;
@ -259,14 +265,6 @@ in {
}
'';
};
activation = {
# TODO: Don't symlink at all, why not just tell Hyprland where the config is? Much easier
# NOTE: Keep the hyprland config symlinked, to allow easy changes with hotreload
linkHyprlandConfig =
lib.hm.dag.entryAfter ["writeBoundary"]
(mylib.modules.mkLink "~/NixFlake/config/hyprland/hyprland.conf" "~/.config/hypr/hyprland.conf");
};
};
};
}

View File

@ -5,7 +5,7 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Hyprland Window Manager + Compositor";
enable = mkEnableOption "Hyprland Window Manager + Compositor";
kb-layout = mkOption {
type = types.str;

View File

@ -5,5 +5,5 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Kitty";
enable = mkEnableOption "Kitty";
}

View File

@ -5,5 +5,5 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Enable LaTeX";
enable = mkEnableOption "Enable LaTeX";
}

View File

@ -1,19 +0,0 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Misc module";
keepass = {
enable = mkEnableOpt "KeePassXC";
autostart = mkBoolOpt false "Autostart KeePassXC";
};
protonmail = {
enable = mkEnableOpt "ProtonMail";
autostart = mkBoolOpt false "Autostart ProtonMail Bridge";
};
}

View File

@ -94,7 +94,7 @@ in {
performance.byteCompileLua = {
enable = true;
configs = true;
initLua = true;
initLua = false; # When debugging init.lua turn this off
nvimRuntime = true;
plugins = true;
};
@ -133,11 +133,13 @@ in {
end
'';
}
{
desc = "Highlight yanked regions";
event = ["TextYankPost"];
callback.__raw = "function() vim.highlight.on_yank() end";
}
{
desc = "Resize splits when Neovim is resized by the WM";
event = ["VimResized"];
@ -149,12 +151,14 @@ in {
end
'';
}
{
desc = "Disable conceal in JSON files";
event = ["FileType"];
pattern = ["json" "jsonc" "json5"]; # Disable conceal for these filetypes
callback.__raw = "function() vim.opt_local.conceallevel = 0 end";
}
{
desc = "Attach JDTLS to Java files";
event = ["FileType"];
@ -176,12 +180,16 @@ in {
end
'';
}
{
# TODO: This breaks if the preview buffer does not refer to a file,
# e.g. when showing previous notifications
desc = "Enable line wrapping in telescope preview";
event = ["User"];
pattern = ["TelescopePreviewerLoaded"];
callback.__raw = ''
function(args)
print(vim.inspect(args))
if args.data.bufname:match("*.csv") then
vim.wo.wrap = false
else
@ -235,6 +243,30 @@ in {
};
};
catppuccin = {
name = "catppuccin";
pkg = pkgs.vimPlugins.catppuccin-nvim;
lazy = false;
priority = 1000;
config = ''
function(_, opts)
require("catppuccin").setup(opts)
vim.cmd([[
let $BAT_THEME = "catppuccin"
colorscheme catppuccin
]])
end
'';
opts = {
flavour = "mocha"; # latte, frappe, macchiato, mocha
background = {
light = "latte";
dark = "mocha";
};
};
};
# NOTE: In LazyVim require("clang_extensions").setup(opts) is called where opts is the server definition from lspconfig...
clangd-extensions = rec {
name = "clangd_extensions";
@ -1014,10 +1046,40 @@ in {
})
end
'';
opts = {
opts = let
bubbles = ''
(function()
-- Wrap this in an immediately invoked function and require catppuccin
-- because we need "colors" in the scope.
-- For this, the catppuccin plugin must be installed,
-- just setting the neovim colorscheme isn't enough.
local colors = require("catppuccin.palettes").get_palette("mocha")
-- Use :lua print(vim.inspect(require("catppuccin.palettes").get_palette("mocha"))) to list colors
return {
normal = {
a = { fg = colors.base, bg = colors.lavender },
b = { fg = colors.text, bg = colors.crust },
c = { fg = colors.text },
},
insert = { a = { fg = colors.base, bg = colors.blue } },
visual = { a = { fg = colors.base, bg = colors.teal } },
replace = { a = { fg = colors.base, bg = colors.red } },
inactive = {
a = { fg = colors.text, bg = colors.base },
b = { fg = colors.text, bg = colors.base },
c = { fg = colors.text },
},
}
end)()
'';
in {
extensions = ["fzf" "neo-tree" "toggleterm" "trouble"];
options = {
theme.__raw = bubbles;
always_divide_middle = true;
globalstatus = true;
ignore_focus = ["neo-tree"];
@ -1025,7 +1087,6 @@ in {
left = "";
right = "";
};
component_separators = {
left = "";
right = "";
@ -1033,18 +1094,33 @@ in {
};
sections = {
lualine_a = ["mode"];
lualine_b = ["branch" "diff" "diagnostics"];
lualine_c.__raw = "{{ 'filename', path = 1, }}";
# lualine_a = ["mode"];
# lualine_a.__raw = ''{ { "mode", separator = { left = "" }, right_padding = 2, } }'';
lualine_a.__raw = ''{ { "mode", separator = {}, } }'';
lualine_b.__raw = ''{ "branch", "diff", "diagnostics", { "filename", path = 1, } }'';
lualine_c.__raw = ''{}''; # Use __raw: Nixvim does nothing with "[]", so the default config would be used
lualine_x = ["filetype" "encoding" "fileformat"];
lualine_y = ["progress" "searchcount" "selectioncount"];
lualine_x.__raw = ''{}'';
lualine_y = ["filetype" "encoding" "fileformat"];
# lualine_z = ["location"];
# lualine_z.__raw = ''{ { "location", separator = { right = "" }, left_padding = 2, } }'';
lualine_z.__raw = ''{ { "location", separator = {}, } }'';
};
inactive_sections = {
lualine_a = [];
lualine_b = ["filename"];
lualine_c = [];
lualine_x = [];
lualine_y = [];
lualine_z = ["location"];
};
# Using tabby for this
# tabline = {
# lualine_a = ["buffers"];
# lualine_z = ["tabs"];
# lualine_a = ["hostname"];
# lualine_b = ["tabs"]; # buffers
# lualine_x = ["windows"];
# };
};
};
@ -1325,6 +1401,12 @@ in {
};
};
quickfix-reflector = {
name = "quickfix-reflector";
pkg = pkgs.vimPlugins.quickfix-reflector-vim;
lazy = false;
};
rainbow-delimiters = {
name = "rainbow-delimiters";
pkg = pkgs.vimPlugins.rainbow-delimiters-nvim;
@ -1338,7 +1420,6 @@ in {
# Don't call setup!
# TODO: Configure this in depth
init = ''
function()
vim.g.rustaceanvim = {
@ -1383,12 +1464,72 @@ in {
'';
};
scope = rec {
name = "scope";
pkg = pkgs.vimPlugins.scope-nvim;
lazy = false;
config = mkDefaultConfig name;
};
sleuth = {
name = "sleuth";
pkg = pkgs.vimPlugins.vim-sleuth;
lazy = false;
};
tabby = rec {
name = "tabby";
pkg = pkgs.vimPlugins.tabby-nvim;
lazy = true;
event = ["BufReadPost" "BufNewFile"];
dependencies = [web-devicons];
config = mkDefaultConfig name;
opts = {
line.__raw = ''
function(line)
local colors = require("catppuccin.palettes").get_palette("mocha")
local base = { fg = colors.base, bg = colors.base }
local crust = { fg = colors.crust, bg = colors.crust }
local text = { fg = colors.text, bg = colors.crust }
local lavender = { fg = colors.lavender, bg = colors.lavender }
local numtabs = vim.call("tabpagenr", "$")
return {
-- Head
{
{ " NEOVIM ", hl = { fg = colors.base, bg = colors.lavender } },
-- The separator gets a foreground and background fill (each have fg + bg).
-- line.sep("", lavender, lavender),
},
-- Tabs
line.tabs().foreach(function(tab)
-- Switch out the start separator instead of the ending one because the last separator is different
local hl = tab.is_current() and { fg = colors.lavender, bg = colors.crust, style = "bold" } or text
local sep_start = tab.number() == 1 and "" or ""
local sep_end = tab.number() == numtabs and "" or ""
return {
line.sep(sep_start, lavender, crust),
tab.number(),
tab.name(),
line.sep(sep_end, crust, base),
hl = hl,
margin = " ",
}
end),
-- Background
hl = base,
}
end
'';
};
};
_plenary = {
name = "plenary"; # For telescope
pkg = pkgs.vimPlugins.plenary-nvim;
@ -1401,6 +1542,20 @@ in {
lazy = true;
};
_telescope-tabs = {
name = "telescope-tabs";
pkg = pkgs.vimUtils.buildVimPlugin {
name = "telescope-tabs";
src = pkgs.fetchFromGitHub {
owner = "LukasPietzschmann";
repo = "telescope-tabs";
rev = "0a678eefcb71ebe5cb0876aa71dd2e2583d27fd3";
sha256 = "sha256-IvxZVHPtApnzUXIQzklT2C2kAxgtAkBUq3GNxwgPdPY=";
};
};
lazy = true;
};
_telescope-undo = {
name = "telescope-undo";
pkg = pkgs.vimPlugins.telescope-undo-nvim;
@ -1421,6 +1576,7 @@ in {
dependencies = [
_plenary
_telescope-fzf-native
_telescope-tabs
_telescope-undo
_telescope-ui-select
];
@ -1429,7 +1585,7 @@ in {
"undo"
"ui-select"
"fzf"
# "lazygit"
"telescope-tabs"
];
in ''
function(_, opts)
@ -1449,10 +1605,20 @@ in {
};
mappings = {
i = {
# TODO: This mappings throws an error.
# Doesn't matter if defined as function or like "<C-h"> = "which_key";.
"<C-h>" = {__raw = ''function(...) return require("telescope.actions").which_key(...) end'';};
"<Esc>" = {__raw = ''function(...) return require("telescope.actions").close(...) end'';};
};
};
};
pickers = {
buffers = {
# See :h telescope.builtin.buffers() for opts
ignore_current_buffer = true;
sort_mru = true;
};
};
};
};
@ -1760,6 +1926,7 @@ in {
autopairs # Automatic closing brackets/parens
bbye # Delete buffer without closing the window or split
better-escape # Escape to normal mode using "jk"
catppuccin # Colortheme (also add this here to access palettes)
clangd-extensions
# blink-cmp # Auto completion popups # TODO: Try this instead of cmp
@ -1793,7 +1960,7 @@ in {
luasnip # Snippets
ltex-extra # Additional ltex lsp support, e.g. for add-to-dictionary action
markview # Markdown support # TODO: Disable in help buffers + confiure a bit more
markview # Markdown support # TODO: Disable in help buffers (?) + confiure a bit more
# narrow-region # Open a buffer restricted to the selection
navbuddy # Structural file view
@ -1801,9 +1968,12 @@ in {
noice # Modern UI overhaul, e.g. floating cmdline
obsidian # Integration with Obsidian.md
oil # File manager
quickfix-reflector # Make the quickfix list editable and saveable to apply changes
rainbow-delimiters # Bracket/Paren colorization
rustaceanvim # Rust integration
scope # Buffers scoped to tabpages
sleuth # Heuristically set indent depth
tabby # Nicer tabline (only showing tabpages)
telescope # Option picker frontend
todo-comments # Highlight TODOs
toggleterm # Integrated terminal

View File

@ -197,13 +197,13 @@
mode = "i";
key = "<C-BS>";
action = "<C-w>";
options.desc = "Delete Previous Word"; # TODO: Breaks backspace <C-v><S-i> multiline cursor?
options.desc = "Delete Previous Word"; # TODO: Breaks backspace in <C-v><S-i> although i binding?
}
{
mode = "i";
key = "<M-BS>";
action = "<C-w>";
options.desc = "Delete Previous Word"; # TODO: Breaks backspace <C-v><S-i> multiline cursor?
options.desc = "Delete Previous Word"; # TODO: Breaks backspace in <C-v><S-i> although i binding?
}
# Clipboard
@ -257,6 +257,12 @@
action = "<cmd>Telescope current_buffer_fuzzy_find<cr>";
options.desc = "Grep Buffer";
}
{
mode = "v";
key = "?";
action = "<cmd>Telescope grep_string<cr>";
options.desc = "Find Selection";
}
{
mode = "n";
key = ";";
@ -269,12 +275,6 @@
action = "<Esc>";
options.desc = "Exit Visual Mode";
}
{
mode = "v";
key = "?";
action = "<cmd>Telescope grep_string<cr>";
options.desc = "Find Selection";
}
];
leader = [
@ -362,6 +362,12 @@
action = "<cmd>ObsidianSearch<cr>";
options.desc = "Obsidian Note";
}
{
mode = "n";
key = "<leader>Q";
action = "<cmd>cexpr []<cr>";
options.desc = "Clear Quickfix List";
}
];
leader-help = [
@ -449,18 +455,23 @@
action = "+buffers";
}
{
# See :h telescope.builtin.buffers() for sorting opts
mode = "n";
key = "<leader>bb";
action = "<cmd>Telescope buffers ignore_current_buffer=false sort_mru=true<cr>";
action = "<cmd>Telescope buffers<cr>";
options.desc = "List Buffers";
}
{
mode = "n";
key = "<leader><Space>";
action = "<cmd>Telescope buffers ignore_current_buffer=false sort_mru=true<cr>";
action = "<cmd>Telescope buffers<cr>";
options.desc = "List Buffers";
}
{
mode = "n";
key = "<leader><C-Space>";
action = "<cmd>Telescope telescope-tabs list_tabs<cr>";
options.desc = "List Tabpages";
}
{
mode = "n";
key = "<leader>R";
@ -586,6 +597,12 @@
{
mode = "n";
key = "<leader>td";
action = "<cmd>ToggleInlineDiagnostics<cr>";
options.desc = "Inline Diagnostics";
}
{
mode = "n";
key = "<leader>tD";
action = "<cmd>Trouble diagnostics toggle focus=false win.position=bottom<cr>";
options.desc = "Trouble Diagnostics";
}
@ -608,33 +625,18 @@
action = "<cmd>ToggleAutoformat<cr>";
options.desc = "Format on Save";
}
{
mode = "n";
key = "<leader>tl";
action = "<cmd>ToggleAutoLint<cr>";
options.desc = "Lint on Save";
}
{
mode = "n";
key = "<leader>tD";
action = "<cmd>ToggleInlineDiagnostics<cr>";
options.desc = "Inline Diagnostics";
}
{
mode = "n";
key = "<leader>tw";
action = "<cmd>:set wrap!<cr>";
options.desc = "Word Wrapping";
}
# {
# mode = "n";
# key = "<leader>tv";
# action = "<cmd>VimtexTocToggle<cr>";
# options.desc = "VimTex ToC";
# }
];
leader-git = [

View File

@ -5,7 +5,7 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "NeoVim";
alias = mkBoolOpt false "Link nvim to vim/vi";
neovide = mkEnableOpt "NeoVide";
enable = mkEnableOption "NeoVim";
alias = mkBoolOption false "Link nvim to vim/vi";
neovide = mkEnableOption "NeoVide";
}

View File

@ -1,8 +1,4 @@
{
lib,
mylib,
...
}: {
_: {
showmode = false; # Status line already shows this
backspace = ["indent" "eol" "start"];
termguicolors = true; # Required by multiple plugins
@ -14,8 +10,8 @@
formatexpr = "v:lua.require('conform').formatexpr()";
laststatus = 3; # Global statusline
winblend = 30; # Floating popup transparency
sessionoptions = ["buffers" "curdir" "tabpages" "winsize" "help" "globals" "skiprtp" "folds"];
showtabline = 0; # Disable tabline
sessionoptions = ["buffers" "curdir" "folds" "globals" "help" "skiprtp" "tabpages" "winsize"]; # What should be saved when creating a session
showtabline = 2; # Disable tabline with 0, show for > 1 with 1, always show with 2
conceallevel = 2;
# Cursor

View File

@ -1,10 +0,0 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Nextcloud Client";
autostart = mkBoolOpt false "Autostart the Nextcloud client (systemd)";
}

View File

@ -5,5 +5,5 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "NNN File Manager";
enable = mkEnableOption "NNN File Manager";
}

View File

@ -1,10 +0,0 @@
{
lib,
mylib,
...
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Ranger";
preview = mkBoolOpt false "Enable Ranger image preview";
}

View File

@ -2,7 +2,6 @@
# VPN and Container modules should use this rofi module to enable their menus then
{
config,
nixosConfig,
lib,
mylib,
pkgs,
@ -34,14 +33,9 @@ in {
};
};
home.activation = {
# NOTE: Keep the rofi config symlinked, to allow easy changes with hotreload
linkRofiConfig =
lib.hm.dag.entryAfter ["writeBoundary"]
(mylib.modules.mkLink "~/NixFlake/config/rofi/rofi.rasi" "~/.config/rofi/config.rasi");
linkRofiColors =
lib.hm.dag.entryAfter ["writeBoundary"]
(mylib.modules.mkLink "~/NixFlake/config/rofi/colors/${cfg.theme}.rasi" "~/.config/rofi/colors.rasi");
home.file = {
".config/rofi/config.rasi".source = ../../../config/rofi/rofi.rasi;
".config/rofi/colors.rasi".source = ../../../config/rofi/colors/${cfg.theme}.rasi;
};
};
}

View File

@ -5,7 +5,7 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Rofi";
enable = mkEnableOption "Rofi";
theme = mkOption {
type = types.str;

View File

@ -5,7 +5,7 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Waybar";
enable = mkEnableOption "Waybar";
monitor = mkOption {
type = types.str;

View File

@ -5,5 +5,5 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Enable Zathura";
enable = mkEnableOption "Enable Zathura";
}

View File

@ -4,6 +4,9 @@
lib,
...
}: {
# Import my own library functions.
# Those are defined as functions returning sets of library functions,
# so those functions have to be called when importing.
nixos = import ./nixos.nix {inherit inputs pkgs lib;};
modules = import ./modules.nix {inherit inputs pkgs lib;};
networking = import ./networking.nix {inherit inputs pkgs lib;};

View File

@ -1,63 +1,44 @@
# TODO: Easier mkLink/mkUnlink (include more hm.dag stuff into the function)
{
inputs,
pkgs,
lib,
...
}: rec {
# Conveniance wrapper for mkOption with boolean type
mkBoolOpt = def: desc:
# Convenience wrapper for "mkOption" with boolean type.
mkBoolOption = def: desc:
lib.mkOption {
type = lib.types.bool;
default = def;
description = desc;
};
# Alias for consistency
mkEnableOpt = lib.mkEnableOption;
# Like mkIf but the predicate is inverted
# Like "lib.mkIf" but the predicate is inverted.
# Returns "do" if "pred" is false.
mkElse = pred: do: (lib.mkIf (!pred) do);
# Creates a symlink if it doesn't exist
# If it exists renew the link
mkLink = src: dest: ''
if [ -L "${dest}" ]; then
rm ${dest}
fi
ln -sf ${src} ${dest}
'';
# Removes a symlink if it exists
mkUnlink = dest: ''
if [ -L "${dest}" ]; then
rm ${dest}
fi
'';
# Returns true if base contains element
# Returns "true" if "base" contains "element".
contains = base: element:
lib.any (x: x == element) base;
# Returns base without occurences of elements that are also in remove
# Returns "base" without occurences of elements that are also in "remove".
without = base: remove:
lib.filter (x: !(contains remove x)) base;
# For use with single element sets
# Used with attrSets with a single element.
# Returns the name of the single attr.
attrName = set: let
names = lib.attrNames set;
in (
in
if (names != [])
then (lib.head names)
else null
);
else null;
# For use with single element sets
# Used with attrSets with a single element.
# Returns the value of the single attr.
attrValue = set: let
values = lib.attrValues set;
in (
in
if (values != [])
then (lib.head values)
else null
);
else null;
}

View File

@ -14,36 +14,40 @@
lib.nixosSystem {
inherit system;
# Make our inputs available to the configuration.nix (for importing modules)
# specialArgs are propagated to all modules
# Values in "specialArgs" are propagated to all system modules.
specialArgs = {inherit inputs hostname mylib system username;};
modules = builtins.concatLists [
[
# Replace the pkgs to include overlays/unfree
# Replace the default "pkgs" with my configured version
# to allow installation of unfree software and my own overlays.
{nixpkgs.pkgs = pkgs;}
# Main config file for all configs/hosts
# Import the toplevel system configuration module.
../system
]
extraModules
# HM is installed as a system module
# HM is installed as a system module when using mkNixosConfigWithHomeManagerModule.
[
inputs.home-manager.nixosModules.home-manager
{
# extraSpecialArgs are propagated to all hm config modules
home-manager.extraSpecialArgs = {inherit inputs hostname username mylib;};
home-manager = {
# Values in "extraSpecialArgs" are propagated to all HM modules.
extraSpecialArgs = {inherit inputs hostname username mylib;};
# Use systems pkgs, disables nixpkgs.* options in home.nix
home-manager.useGlobalPkgs = true;
# Use the "pkgs" from the system configuration.
# This disables "nixpkgs.*" options in HM modules.
useGlobalPkgs = true;
# Enable installing packages through users.christoph.packages to /etc/profiles instead of ~/.nix-profile
home-manager.useUserPackages = true;
# Packages in "users.${username}.packages" will be installed
# to /etc/profiles instead of ~/.nix-profile.
useUserPackages = true;
# User specific config file
home-manager.users.${username}.imports = [../home/${username}];
# Import the user-specific HM toplevel module.
users.${username}.imports = [../home/${username}];
};
}
]
];
@ -58,16 +62,16 @@
lib.nixosSystem {
inherit system;
# Make our inputs available to the configuration.nix (for importing modules)
# specialArgs are propagated to all modules
# Values in "specialArgs" are propagated to all system modules.
specialArgs = {inherit inputs hostname mylib system;};
modules = builtins.concatLists [
[
# Replace the pkgs to include overlays/unfree
# Replace the default "pkgs" with my configured version
# to allow installation of unfree software and my own overlays.
{nixpkgs.pkgs = pkgs;}
# Main config file for all configs/hosts
# Import the toplevel system configuration module.
../system
]
@ -85,11 +89,12 @@
inputs.home-manager.lib.homeManagerConfiguration {
inherit pkgs;
# HM propagates these to every module
# Values in "extraSpecialArgs" are propagated to all HM modules.
extraSpecialArgs = {inherit inputs system mylib username hostname;};
modules = builtins.concatLists [
[
# Import the user-specific HM toplevel module.
../home/${username}
]

View File

@ -9,35 +9,35 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Enable OCI Containers";
enable = mkEnableOption "Enable OCI Containers";
homeassistant = {
enable = mkEnableOpt "Enable HomeAssistant Container";
enable = mkEnableOption "Enable HomeAssistant Container";
};
stablediffusion = {
enable = mkEnableOpt "Enable StableDiffusion Container with Automatic1111 WebUI";
enable = mkEnableOption "Enable StableDiffusion Container with Automatic1111 WebUI";
};
jellyfin = {
enable = mkEnableOpt "Enable Jellyfin Container";
enable = mkEnableOption "Enable Jellyfin Container";
};
fileflows = {
enable = mkEnableOpt "Enable FileFlows Container";
enable = mkEnableOption "Enable FileFlows Container";
};
sonarr = {
enable = mkEnableOpt "Enable Sonarr Container";
enable = mkEnableOption "Enable Sonarr Container";
};
radarr = {
enable = mkEnableOpt "Enable Radarr Container";
enable = mkEnableOption "Enable Radarr Container";
};
hydra = {
enable = mkEnableOpt "Enable Hydra Container";
enable = mkEnableOption "Enable Hydra Container";
};
sabnzbd = {
enable = mkEnableOpt "Enable SabNzbd Container";
enable = mkEnableOption "Enable SabNzbd Container";
};
rofiIntegration = {
enable = mkEnableOpt "Enable Rofi Menu for Container Servicing";
enable = mkEnableOption "Enable Rofi Menu for Container Servicing";
hotkey = mkOption {
type = types.str;
example = ''

View File

@ -5,7 +5,7 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Polkit";
enable = mkEnableOption "Polkit";
allowed-system-services = mkOption {
type = types.listOf types.str;

View File

@ -5,7 +5,7 @@
}:
with lib;
with mylib.modules; {
enable = mkEnableOpt "Systemd Network Configuration";
enable = mkEnableOption "Systemd Network Configuration";
hostname = mkOption {
type = types.str;