Merge remote-tracking branch 'origin/nixos' into nixos-work

This commit is contained in:
Moritz Böhme 2024-10-08 09:55:15 +02:00
commit 7eb7b63684
23 changed files with 1161 additions and 464 deletions

View file

@ -9,7 +9,7 @@ in
(import ./_catppuccin.nix
{
inherit config lib pkgs;
flavor = "mocha";
flavor = "macchiato";
rosewater = "f4dbd6";
flamingo = "f0c6c6";
pink = "f5bde6";

View file

@ -255,10 +255,11 @@ in
fonts = {
enableDefaultPackages = true;
packages = with pkgs; [
(nerdfonts.override {
packages = [
(pkgs.nerdfonts.override {
fonts = [ "FiraCode" ];
})
pkgs.master.intel-one-mono
];
};

View file

@ -3,10 +3,18 @@
, ...
}:
with lib;
let
inherit (lib) concatStringsSep flip boolToString mapAttrsToList;
cfg = config.my.programs.hyprland;
mkMonitor = { name, resolution, position, scale, disabled, extra }:
if disabled
then "monitor=${name},disabled"
else "monitor=${name},${resolution},${position},${scale},${extra}";
monitorsList = mapAttrsToList (name: value: { name = name; } // value) cfg.monitors;
monitors = map mkMonitor monitorsList;
mkRule = rule: windowRegexes: "windowrulev2 = ${rule},${concatStringsSep "," windowRegexes}";
mkRules = rules: windowRegexes: concatStringsSep "\n" (map (flip mkRule windowRegexes) rules);
in
@ -17,7 +25,7 @@ in
#
# See https://wiki.hyprland.org/Configuring/Monitors/
${concatLines (map (x: "monitor=${x}") cfg.monitors)}
${concatStringsSep "\n" monitors}
# See https://wiki.hyprland.org/Configuring/Keywords/ for more
@ -131,7 +139,7 @@ in
windowrulev2 = opaque, class:^(emacs)$
# Fullscreen Applications
${mkRules ["opaque" "noblur" "noborder" "noshadow" "forceinput"] ["fullscreen:1"]}
${mkRules ["opaque" "noblur" "noborder" "noshadow" "allowsinput"] ["fullscreen:1"]}
${mkRules ["tile" "opaque"] ["class:^(neovide)$"]}
@ -228,6 +236,10 @@ in
bindl=,switch:on:Lid Switch,exec,monitors="$(hyprctl monitors | grep -c '^Monitor')" && hyprctl keyword monitor "eDP-1, disable" && [ "$monitors" = 1 ] && loginctl lock-session
bindl=,switch:off:Lid Switch,exec, hyprctl keyword monitor "eDP-1, preferred, auto"
# Lock Screen
bind=$mainMod ALT, L, exec, loginctl lock-session
# Extra Config
${cfg.extraConfig}
''

View file

@ -5,8 +5,8 @@
, ...
} @ args:
with lib;
let
inherit (lib) mkOption mkEnableOption mkIf types getExe genAttrs optionalAttrs optional;
cfg = config.my.programs.hyprland;
hyprland = inputs.hyprland.packages.${pkgs.system}.default;
@ -31,9 +31,35 @@ in
default = [ "de" "us" ];
};
monitors = mkOption {
type = types.listOf types.str;
description = "monitor settings";
default = [ ",preferred,auto,1" ];
type = types.attrsOf (
let
sub = types.submodule {
options = {
resolution = mkOption {
type = types.strMatching "\(preferred\)|\([[:digit:]]+x[[:digit:]]+\(@[[:digit:]]+\)\?\)";
default = "preferred";
};
position = mkOption {
type = types.strMatching "\(auto\)|\(-\?[[:digit:]]+x-?[[:digit:]]+\)";
default = "auto";
};
disabled = mkEnableOption "disabled";
scale = mkOption {
type = types.oneOf [ types.float (types.strMatching "auto") ];
default = 1.0;
apply = x: if lib.isFloat x then lib.strings.floatToString x else x;
};
extra = mkOption {
type = types.listOf types.str;
default = [ ];
apply = lib.concatStringsSep ",";
};
};
};
in
sub
);
description = "monitor setting";
};
extraConfig = mkOption {
type = types.str;
@ -51,6 +77,8 @@ in
# foot.enable = true;
kitty.enable = true;
rofi.enable = true;
hyprland.monitors."" = lib.mkDefault { };
hyprland.monitors."Unknown-1" = { disabled = true; };
};
wallpapers.enable = true;
services = {
@ -85,6 +113,14 @@ in
# add waybar as a status bar
programs.waybar = {
enable = true;
package = pkgs.waybar.overrideAttrs (old: {
patches = old.patches or [ ] ++ [
(pkgs.fetchpatch {
url = "https://gitlab.archlinux.org/archlinux/packaging/packages/waybar/-/raw/0306af03fcb6de6aee1e288f42b0bf1b223513bd/a544f4b2cdcf632f1a4424b89f6e3d85ef5aaa85.patch";
sha256 = "sha256-S/1oUj9Aj6BElNTsDY8CTcKtS1j7Gl54JFgCywH05pg=";
})
];
});
# start using systemd service
systemd = {
@ -97,7 +133,7 @@ in
start_hidden = true;
layer = "top";
position = "top";
height = 20;
height = 24;
modules-left = [ "hyprland/workspaces" ];
modules-center = [ "hyprland/window" ];
modules-right = [ "hyprland/language" "network" "memory" "cpu" "battery" "clock" ];
@ -196,17 +232,16 @@ in
alsa.support32Bit = true;
pulse.enable = true;
};
xserver = {
displayManager = {
enable = true;
displayManager = {
lightdm.enable = true;
autoLogin = {
enable = true;
user = "moritz";
};
defaultSession = "hyprland";
autoLogin = {
enable = true;
user = "moritz";
};
defaultSession = "hyprland";
};
xserver.enable = true;
xserver.displayManager.lightdm.enable = true;
};
security.rtkit.enable = true;

View file

@ -22,13 +22,15 @@ in
window_padding_width = 3;
confirm_os_window_close = 0;
background_opacity = "0.9";
font_features = "IntelOneMono-Regular +ss01";
resize_in_steps = "yes";
};
keybindings = {
"ctrl+plus" = "change_font_size all +2.0";
"ctrl+minus" = "change_font_size all -2.0";
};
font = {
name = "FiraCode Nerd Font";
name = "Intel One Mono";
size = 10;
};
};

View file

@ -6,26 +6,16 @@
, ...
}:
with lib;
let
inherit (lib) mkEnableOption mkOption types;
cfg = config.my.programs.nix;
mkSuper = system: nix:
if cfg.useSuper
then inputs.nix-super.packages.${system}.default
else nix;
mkNom = system: nix:
if cfg.useNom
then
inputs.nix-monitored.packages.${system}.default.override
{
withNotify = false;
nix = nix;
}
else nix;
mkNix = system: nix: mkNom system (mkSuper system nix);
inputs.nix-monitored.packages.${system}.default.override
{
withNotify = false;
nix = nix;
};
in
{
options.my.programs.nix = {
@ -38,8 +28,6 @@ in
};
};
optimise.enable = mkEnableOption "nix-optimise";
useSuper = mkEnableOption "use nix super";
useNom = mkEnableOption "use nix output monitor";
};
config = {
@ -59,7 +47,7 @@ in
nix = {
nixPath = [ "nixpkgs=${inputs.nixpkgs}" ];
package = mkNix pkgs.system pkgs.nix;
package = pkgs.nix;
extraOptions = "experimental-features = nix-command flakes";

View file

@ -42,7 +42,6 @@ in
nixpkgs-fmt
nodePackages.bash-language-server
python3Packages.python-lsp-server
python3Packages.ruff-lsp
shellcheck
shfmt
stable.yamlfix

View file

@ -38,7 +38,6 @@ in
{ plugin = pkgs.vimPlugins.cmp-cmdline; }
{ plugin = pkgs.vimPlugins.cmp-nvim-lsp-signature-help; }
{ plugin = pkgs.vimPlugins.cmp-nvim-lsp; }
{ plugin = pkgs.vimPlugins.cmp-spell; }
{
plugin = pkgs.vimUtils.buildVimPlugin {
pname = "cmp-vimtex";
@ -47,23 +46,23 @@ in
};
}
{ plugin = pkgs.vimPlugins.cmp_luasnip; }
{
plugin = pkgs.vimPlugins.copilot-cmp;
opts = { };
dependencies = [
{
plugin = pkgs.vimPlugins.copilot-lua;
opts = {
suggestion = { enabled = false; };
panel = { enabled = false; };
};
conf = /* lua */ ''
require("copilot").setup(opts)
vim.cmd("Copilot disable")
'';
}
];
}
# {
# plugin = pkgs.vimPlugins.copilot-cmp;
# opts = { };
# dependencies = [
# {
# plugin = pkgs.vimPlugins.copilot-lua;
# opts = {
# suggestion = { enabled = false; };
# panel = { enabled = false; };
# };
# conf = /* lua */ ''
# require("copilot").setup(opts)
# vim.cmd("Copilot disable")
# '';
# }
# ];
# }
{ plugin = pkgs.vimPlugins.friendly-snippets; }
{ plugin = pkgs.vimPlugins.lspkind-nvim; }
{

View file

@ -2,6 +2,7 @@ local conform = require("conform")
local formatters_by_ft = {
["*"] = { "codespell", "trim_whitespace" },
elixir = { "mix" },
gleam = { "gleam" },
go = { "gofmt" },
json = { "jq" },

View file

@ -1,15 +1,13 @@
require("gitsigns").setup()
require("which-key").register({
["[h"] = { "<cmd>Gitsigns prev_hunk<cr>", "Previous hunk" },
["]h"] = { "<cmd>Gitsigns next_hunk<cr>", "Next hunk" },
["<leader>g"] = {
s = { "<cmd>Gitsigns stage_hunk<cr>", "Stage hunk", mode = { "n", "v" } },
r = { "<cmd>Gitsigns reset_hunk<cr>", "Reset hunk", mode = { "n", "v" } },
S = { "<cmd>Gitsigns stage_buffer<cr>", "Stage buffer" },
R = { "<cmd>Gitsigns reset_buffer<cr>", "Reset buffer" },
u = { "<cmd>Gitsigns undo_stage_hunk<cr>", "Undo stage hunk" },
p = { "<cmd>Gitsigns preview_hunk_inline<cr>", "Preview hunk (inline)" },
P = { "<cmd>Gitsigns preview_hunk<cr>", "Preview hunk (float)" },
},
["ih"] = { ":<C-U>Gitsigns select_hunk<cr>", "gitsigns hunk", mode = { "o", "x" } },
require("which-key").add({
{ "<leader>gP", "<cmd>Gitsigns preview_hunk<cr>", desc = "Preview hunk (float)" },
{ "<leader>gR", "<cmd>Gitsigns reset_buffer<cr>", desc = "Reset buffer" },
{ "<leader>gS", "<cmd>Gitsigns stage_buffer<cr>", desc = "Stage buffer" },
{ "<leader>gp", "<cmd>Gitsigns preview_hunk_inline<cr>", desc = "Preview hunk (inline)" },
{ "<leader>gu", "<cmd>Gitsigns undo_stage_hunk<cr>", desc = "Undo stage hunk" },
{ "[h", "<cmd>Gitsigns prev_hunk<cr>", desc = "Previous hunk" },
{ "]h", "<cmd>Gitsigns next_hunk<cr>", desc = "Next hunk" },
{ "<leader>gr", "<cmd>Gitsigns reset_hunk<cr>", desc = "Reset hunk", mode = { "n", "v" } },
{ "<leader>gs", "<cmd>Gitsigns stage_hunk<cr>", desc = "Stage hunk", mode = { "n", "v" } },
{ "ih", ":<C-U>Gitsigns select_hunk<cr>", desc = "gitsigns hunk", mode = { "o", "x" } },
})

View file

@ -19,6 +19,7 @@ ls.setup({
},
},
},
ft_func = require("luasnip.extras.filetype_functions").from_pos_or_filetype,
})
require("luasnip.loaders.from_lua").load({ paths = "~/.config/nvim/snippets" })

View file

@ -9,13 +9,10 @@ cmp.setup({
maxwidth = 50, -- prevent the popup from showing more than provided characters
ellipsis_char = "...", -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead
symbol_map = {
Copilot = "",
-- Copilot = "",
},
}),
},
enabled = function()
return not luasnip.jumpable(1)
end,
snippet = {
-- REQUIRED - you must specify a snippet engine
expand = function(args)
@ -49,6 +46,8 @@ cmp.setup({
["<C-n>"] = cmp.mapping(function(fallback)
if luasnip.choice_active() then
luasnip.change_choice(1)
elseif luasnip.locally_jumpable(1) then
luasnip.jump(1)
else
fallback()
end
@ -56,6 +55,8 @@ cmp.setup({
["<C-p>"] = cmp.mapping(function(fallback)
if luasnip.choice_active() then
luasnip.change_choice(-1)
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
@ -66,7 +67,7 @@ cmp.setup({
{ priority = 1, name = "buffer" },
{ priority = 1, name = "spell" },
{ priority = 2, name = "nvim_lsp" },
{ priority = 3, name = "copilot" },
-- { priority = 3, name = "copilot" },
{ priority = 3, name = "nvim_lsp_signature_help" },
{ priority = 4, name = "luasnip" },
{ priority = 4, name = "vimtex" },

View file

@ -21,76 +21,80 @@ capabilities.didChangeWatchedFiles = {
local lspconfig = require("lspconfig")
local on_attach_def = function(client, bufnr)
require("which-key").register({
K = {
vim.lsp.buf.hover,
"Hover",
require("which-key").add({
{ "<leader>c", buffer = bufnr, group = "code" },
{
"<leader>cr",
function()
return ":IncRename " .. vim.fn.expand("<cword>")
end,
buffer = bufnr,
desc = "Rename",
expr = true,
replace_keycodes = false,
},
["<leader>"] = {
c = {
name = "code",
c = { require("actions-preview").code_actions, "Code action", mode = { "v", "n" } },
r = {
function()
return ":IncRename " .. vim.fn.expand("<cword>")
end,
"Rename",
expr = true,
},
f = {
function()
vim.lsp.buf.format({ async = true })
end,
"Format (lsp)",
mode = { "n", "v" },
},
},
t = {
l = {
function()
lsp_lines.toggle()
if vim.diagnostic.is_enabled() then
vim.diagnostic.disable()
else
vim.diagnostic.enable()
end
end,
"LSP lines",
},
i = {
function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end,
"LSP inlay hints",
},
},
{
"<leader>ti",
function()
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled())
end,
buffer = bufnr,
desc = "LSP inlay hints",
},
g = {
d = {
function()
require("telescope.builtin").lsp_definitions({ reuse_win = true })
end,
"Goto definition",
},
t = {
function()
require("telescope.builtin").lsp_type_definitions({ reuse_win = true })
end,
"Goto type definition",
},
r = { "<cmd>Telescope lsp_references<cr>", "Goto references" },
D = { vim.lsp.buf.declaration, "Goto declaration" },
I = { "<cmd>Telescope lsp_implementations<cr>", "Goto implementation" },
K = { vim.lsp.buf.signature_help, "Signature help" },
{
"<leader>tl",
function()
lsp_lines.toggle()
if vim.diagnostic.is_disabled() then
vim.diagnostic.enable()
else
vim.diagnostic.disable()
end
end,
buffer = bufnr,
desc = "LSP lines",
},
["["] = {
d = { vim.diagnostic.goto_prev, "Previous diagnostic" },
{ "K", vim.lsp.buf.hover, buffer = bufnr, desc = "Hover" },
{ "[d", vim.diagnostic.goto_prev, buffer = bufnr, desc = "Previous diagnostic" },
{ "]d", vim.diagnostic.goto_next, buffer = bufnr, desc = "Next diagnostic" },
{ "gD", vim.lsp.buf.declaration, buffer = bufnr, desc = "Goto declaration" },
{ "gI", "<cmd>Telescope lsp_implementations<cr>", buffer = bufnr, desc = "Goto implementation" },
{ "gK", vim.lsp.buf.signature_help, buffer = bufnr, desc = "Signature help" },
{
"gd",
function()
require("telescope.builtin").lsp_definitions({ reuse_win = true })
end,
buffer = bufnr,
desc = "Goto definition",
},
["]"] = {
d = { vim.diagnostic.goto_next, "Next diagnostic" },
},
}, { buffer = bufnr, silent = true })
{ "gr", "<cmd>Telescope lsp_references<cr>", buffer = bufnr, desc = "Goto references" },
{
"gt",
function()
require("telescope.builtin").lsp_type_definitions({ reuse_win = true })
end,
buffer = bufnr,
desc = "Goto type definition",
},
{
"<leader>cc",
require("actions-preview").code_actions,
buffer = bufnr,
desc = "Code action",
mode = { "n", "v" },
},
{
"<leader>cf",
function()
vim.lsp.buf.format({ async = true })
end,
buffer = bufnr,
desc = "Format (lsp)",
mode = { "n", "v" },
},
})
if client.server_capabilities.inlayHintProvider then
local slow_lsp_servers = {
"rust_analyzer",
@ -124,7 +128,7 @@ local servers = {
"gleam",
"gopls",
"pylsp",
"ruff_lsp",
"ruff",
"templ",
"typst_lsp",
}
@ -132,6 +136,10 @@ for _, lsp in ipairs(servers) do
lspconfig_setup(lsp, {})
end
lspconfig_setup("elixirls", {
cmd = { "elixir-ls" },
})
lspconfig_setup("nil_ls", {
settings = {
flake = {

View file

@ -2,60 +2,50 @@ vim.o.timeout = true
vim.o.timeoutlen = 500
-- Delete
require("which-key").register({
d = {
name = "delete",
b = { "<cmd>bd<cr>", "Delete buffer" },
w = { "<C-w>c", "Delete window" },
},
}, { prefix = "<leader>" })
require("which-key").add({
{ "<leader>d", group = "delete" },
{ "<leader>db", "<cmd>bd<cr>", desc = "Delete buffer" },
{ "<leader>dw", "<C-w>c", desc = "Delete window" },
})
-- buffer
require("which-key").register({
["["] = {
b = { "<cmd>bprevious<cr>", "Previous buffer" },
},
["]"] = {
b = { "<cmd>bnext<cr>", "Next buffer" },
},
require("which-key").add({
{ "[b", "<cmd>bprevious<cr>", desc = "Previous buffer" },
{ "]b", "<cmd>bnext<cr>", desc = "Next buffer" },
})
-- window
require("which-key").register({
w = {
name = "window",
["|"] = { "<C-w>v", "Split window horizontally" },
["-"] = { "<C-w>s", "Split window vertically" },
w = { "<C-w>w", "Switch window" },
},
}, { prefix = "<leader>" })
require("which-key").add({
{ "<leader>w", group = "window" },
{ "<leader>w-", "<C-w>s", desc = "Split window vertically" },
{ "<leader>ww", "<C-w>w", desc = "Switch window" },
{ "<leader>w|", "<C-w>v", desc = "Split window horizontally" },
})
-- better descriptions for navigation
require("which-key").register({
["<leader>"] = {
f = { name = "file/find" },
g = { name = "git" },
c = { name = "code" },
s = { name = "search" },
t = { name = "toggle" },
},
["["] = { name = "prev" },
["]"] = { name = "next" },
g = { name = "goto" },
require("which-key").add({
{ "<leader>c", group = "code" },
{ "<leader>f", group = "file/find" },
{ "<leader>g", group = "git" },
{ "<leader>s", group = "search" },
{ "<leader>t", group = "toggle" },
{ "[", group = "prev" },
{ "]", group = "next" },
{ "g", group = "goto" },
})
-- Clear search with <esc>
require("which-key").register({
["<esc>"] = { "<cmd>noh<cr><esc>", "Escape and clear hlsearch", mode = { "n", "i" } },
require("which-key").add({
{ "<esc>", "<cmd>noh<cr><esc>", desc = "Escape and clear hlsearch", mode = { "i", "n" } },
})
-- better indenting
require("which-key").register({
["<"] = { "<gv", "Shift left" },
[">"] = { ">gv", "Shift right" },
}, { mode = "v" })
require("which-key").add({
{ "<", "<gv", desc = "Shift left", mode = "v" },
{ ">", ">gv", desc = "Shift right", mode = "v" },
})
-- better yank in visual mode
require("which-key").register({
y = { "ygv<esc>", "Yank" },
}, { mode = "v" })
require("which-key").add({
{ "y", "ygv<esc>", desc = "Yank", mode = "v" },
})

View file

@ -0,0 +1,46 @@
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local isn = ls.indent_snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local r = ls.restore_node
local events = require("luasnip.util.events")
local ai = require("luasnip.nodes.absolute_indexer")
local extras = require("luasnip.extras")
local l = extras.lambda
local rep = extras.rep
local p = extras.partial
local m = extras.match
local n = extras.nonempty
local dl = extras.dynamic_lambda
local fmt = require("luasnip.extras.fmt").fmt
local fmta = require("luasnip.extras.fmt").fmta
local conds = require("luasnip.extras.expand_conditions")
local postfix = require("luasnip.extras.postfix").postfix
local types = require("luasnip.util.types")
local parse = require("luasnip.util.parser").parse_snippet
local ms = ls.multi_snippet
local k = require("luasnip.nodes.key_indexer").new_key
local def_template = [[
def {fname}({args}) do
{final}
end
]]
local def = s(
"def",
fmt(def_template, {
fname = i(1, "fname"),
args = i(2),
final = i(3),
}, { priority = 1001 })
)
return {
def,
}

View file

@ -0,0 +1,138 @@
local ls = require("luasnip")
local s = ls.snippet
local sn = ls.snippet_node
local isn = ls.indent_snippet_node
local t = ls.text_node
local i = ls.insert_node
local f = ls.function_node
local c = ls.choice_node
local d = ls.dynamic_node
local r = ls.restore_node
local events = require("luasnip.util.events")
local ai = require("luasnip.nodes.absolute_indexer")
local extras = require("luasnip.extras")
local l = extras.lambda
local rep = extras.rep
local p = extras.partial
local m = extras.match
local n = extras.nonempty
local dl = extras.dynamic_lambda
local fmt = require("luasnip.extras.fmt").fmt
local fmta = require("luasnip.extras.fmt").fmta
local conds = require("luasnip.extras.expand_conditions")
local postfix = require("luasnip.extras.postfix").postfix
local types = require("luasnip.util.types")
local parse = require("luasnip.util.parser").parse_snippet
local ms = ls.multi_snippet
local k = require("luasnip.nodes.key_indexer").new_key
local pe = s(
"pe",
fmt("<%= {final} %>", {
final = i(1),
}, { priority = 1001 })
)
local ln = s(
"ln",
fmt(
[[
<.link navigate={{~p"{path}"}}">{final}</.link>
]],
{ path = i(1, "/"), final = i(2) },
{ priority = 1001 }
)
)
local lp = s(
"lp",
fmt(
[[
<.link patch={{~p"{path}"}}">{final}</.link>
]],
{ path = i(1, "/"), final = i(2) },
{ priority = 1001 }
)
)
local if_ = s(
"if",
fmt("<%= if {condition} do %>{final}<% end %>", { condition = i(1, "condition"), final = i(2) }, { priority = 1001 })
)
local ife = s(
"ife",
fmt(
[[
<%= if {condition} do %>
{when}
<% else %>
{final}
<% end %>"
]],
{ condition = i(1, "condition"), when = i(2), final = i(3) },
{ priority = 1001 }
)
)
local for_ = s(
"for",
fmt(
[[
<%= for {item} <- {list} do %>
{final}
<% end %>
]],
{ item = i(1, "item"), list = i(2, "items"), final = i(3) },
{ priority = 1001 }
)
)
local lc =
s("lc", fmt("<.live_component module={{{module}}} id={{{id}}} />", { module = i(1), id = i(2) }, { priority = 1001 }))
local slot = s(
"slot",
fmt("<:slot>{final}</:slot>", {
final = i(1),
}, { priority = 1001 })
)
local socketp = s(
"socketp",
fmt(
[[
socket =
socket
|> {final}
]],
{ final = i(1) },
{ priority = 1001 }
)
)
local fl = s(
"fl",
fmt(
[[
<{elem} :for={{{item} <- {list}}} class="{class}">
{final}
</{elem}>
]],
{ elem = i(1, "div"), item = i(2, "item"), list = i(3, "items"), class = i(4), final = i(5) },
{ priority = 1001, repeat_duplicates = true }
)
)
return {
pe,
ln,
lp,
if_,
ife,
for_,
lc,
slot,
socketp,
fl,
}

View file

@ -1,16 +1,17 @@
{ pkgs, ... }:
{ pkgs, inputs, lib, ... }:
{
config.home-manager.users.moritz.programs.neovim.lazy.plugins = [
(
let
nvim-treesitter = pkgs.vimPlugins.nvim-treesitter;
parserDir = pkgs.symlinkJoin {
name = "tresitter-grammars-all";
paths = pkgs.vimPlugins.nvim-treesitter.withAllGrammars.dependencies;
paths = nvim-treesitter.withAllGrammars.dependencies;
};
in
{
plugin = pkgs.vimPlugins.nvim-treesitter;
plugin = nvim-treesitter;
event = [ "BufReadPost" "BufNewFile" ];
opts = {
sync_install = false;
@ -51,12 +52,10 @@
};
};
conf =
''
local final_opts = vim.tbl_deep_extend("keep", opts, { parser_install_dir = "${parserDir}" })
require('nvim-treesitter.configs').setup(final_opts)
'';
init = ''
vim.opt.runtimepath:prepend("${parserDir}")
/* lua */ ''
vim.opt.runtimepath:append("${parserDir}")
local final_opts = vim.tbl_deep_extend("keep", opts, { parser_install_dir = "${parserDir}" })
require('nvim-treesitter.configs').setup(final_opts)
'';
priority = 100;
dependencies = [

View file

@ -1,33 +1,35 @@
{ pkgs, lib, inputs, ... }:
with builtins;
let
inherit (lib) readFile;
in
{
config.home-manager.users.moritz.programs.neovim.lazy.plugins = with pkgs.vimPlugins; [
config.home-manager.users.moritz.programs.neovim.lazy.plugins = [
{
plugin = which-key-nvim;
plugin = pkgs.vimPlugins.which-key-nvim;
lazy = false;
conf = readFile ./lua/which-key-nvim.lua;
}
{
plugin = catppuccin-nvim;
plugin = pkgs.vimPlugins.catppuccin-nvim;
conf = readFile ./lua/catppuccin-nvim.lua;
lazy = false;
priority = 99;
}
{
plugin = todo-comments-nvim;
dependencies = [{ plugin = plenary-nvim; }];
plugin = pkgs.vimPlugins.todo-comments-nvim;
dependencies = [{ plugin = pkgs.vimPlugins.plenary-nvim; }];
opts = { };
}
{
plugin = dressing-nvim;
plugin = pkgs.vimPlugins.dressing-nvim;
event = [ "VeryLazy" ];
}
{
plugin = gitsigns-nvim;
plugin = pkgs.vimPlugins.gitsigns-nvim;
event = [ "BufReadPost" "BufNewFile" ];
conf = readFile ./lua/gitsigns-nvim.lua;
dependencies = [{ plugin = which-key-nvim; }];
dependencies = [{ plugin = pkgs.vimPlugins.which-key-nvim; }];
}
{
plugin = pkgs.vimUtils.buildVimPlugin {
@ -38,8 +40,44 @@ with builtins;
cmd = [ "Hawtkeys" "HawtkeysAll" "HawtkeysDupes" ];
opts = { };
dependencies = [
{ plugin = plenary-nvim; }
{ plugin = nvim-treesitter; }
{ plugin = pkgs.vimPlugins.plenary-nvim; }
{ plugin = pkgs.vimPlugins.nvim-treesitter; }
];
}
{
plugin = pkgs.vimPlugins.zen-mode-nvim;
keys = [
{ key = "<leader>tz"; cmd = "<cmd>ZenMode<cr>"; desc = "Zen mode"; }
];
conf = /* lua */ ''
require("zen-mode").setup({
plugins = {
tmux = {
enabled = true,
},
},
})
'';
dependencies = [
{
plugin = pkgs.vimPlugins.twilight-nvim;
keys = [
{ key = "<leader>tZ"; cmd = "<cmd>Twilight<cr>"; desc = "Twilight mode"; }
];
conf = /* lua */ ''
require("twilight").setup({
context = 20,
expand = { -- for treesitter, we we always try to expand to the top-most ancestor with these types
"function",
"function_definition",
"if_statement",
"method",
"method_definition",
"table",
},
})
'';
}
];
}
];

View file

@ -1,12 +1,13 @@
{ config
, lib
, pkgs
, inputs
, ...
} @ args:
}:
with lib;
let
inherit (lib) mkEnableOption mkIf mkOption types;
cfg = config.my.programs.river;
in
{
@ -15,7 +16,7 @@ in
keyboardLayouts = mkOption {
type = types.listOf types.str;
description = "list of keyboard layouts";
default = [ "de" "us" ];
default = [ "us" "de" ];
};
nvidiaSupport = mkEnableOption "nvidiaSupport";
};
@ -25,7 +26,7 @@ in
my = {
programs = {
wallpaper.enable = true;
foot.enable = true;
kitty.enable = true;
tofi.enable = true;
};
wallpapers.enable = true;
@ -49,22 +50,6 @@ in
};
wayland.windowManager.river = {
enable = true;
package = pkgs.river.overrideAttrs (old: {
src = inputs.river;
version = lib.my.mkVersionInput inputs.river;
# HACK: to change wlroots to 0.17.x
buildInputs = with pkgs; [
libGL
libevdev
libinput
libxkbcommon
pixman
udev
wayland-protocols
wlroots_0_17
xorg.libX11
];
});
settings = {
border-width = 2;
declare-mode = [
@ -75,8 +60,7 @@ in
map = {
normal = {
"Super Q" = "close";
"Super Return" = ''spawn "systemctl --user is-active --quiet foot && footclient --no-wait || foot"'';
"Super+Shift Return" = "spawn foot";
"Super Return" = "spawn kitty";
"Super R" = ''spawn 'exec $(tofi-run --fuzzy-match=true)' '';
"Super W" = ''spawn "pkill -USR1 waybar"'';
"Super+Shift R" = "spawn ~/.config/river/init";
@ -100,11 +84,13 @@ in
# bump in layout stack
"Super Z" = "zoom";
# lock screen
"Super+Alt L" = ''spawn "loginctl lock-session"'';
} //
# tags
(
let
numbers = range 1 9;
numbers = lib.range 1 9;
toTag = num: "$((1 << (${toString num} - 1)))";
mkMappings = num:
@ -114,14 +100,14 @@ in
in
[
# Super+Control+[1-9] to toggle focus of tag [0-8]
{ name = "Super ${numStr}"; value = "toggle-focused-tags ${tag}"; }
{ name = "Super ${numStr}"; value = "set-focused-tags ${tag}"; }
# Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view
{ name = "Super+Shift ${numStr}"; value = "toggle-view-tags ${tag}"; }
];
mappings = flatten (map mkMappings numbers);
mappings = lib.flatten (map mkMappings numbers);
in
listToAttrs mappings
lib.listToAttrs mappings
);
};
map-pointer = {
@ -139,6 +125,7 @@ in
when-typing = "enabled";
};
set-cursor-warp = "on-focus-change";
keyboard-layout = "-options grp:win_space_toggle,caps:escape ${lib.concatStringsSep "," cfg.keyboardLayouts}";
};
extraConfig = /* bash */ ''
rivercarro_pid="$(pidof rivercarro)"
@ -151,6 +138,14 @@ in
# add waybar as a status bar
programs.waybar = {
enable = true;
package = pkgs.waybar.overrideAttrs (old: {
patches = old.patches or [ ] ++ [
(pkgs.fetchpatch {
url = "https://gitlab.archlinux.org/archlinux/packaging/packages/waybar/-/raw/0306af03fcb6de6aee1e288f42b0bf1b223513bd/a544f4b2cdcf632f1a4424b89f6e3d85ef5aaa85.patch";
sha256 = "sha256-S/1oUj9Aj6BElNTsDY8CTcKtS1j7Gl54JFgCywH05pg=";
})
];
});
# start using systemd service
systemd = {
@ -169,11 +164,7 @@ in
modules-right = [ "network" "memory" "cpu" "battery" "clock" ];
};
};
style = ''
#tags button.focused {
color: #ffffff
}
'';
style = lib.readFile ./style.css;
};
# lock screen after timeout
@ -188,11 +179,11 @@ in
events = [
{
event = "before-sleep";
command = "${getExe pkgs.swaylock} -fF";
command = "${lib.getExe pkgs.swaylock} -fF";
}
{
event = "lock";
command = "${getExe pkgs.swaylock} -fF";
command = "${lib.getExe pkgs.swaylock} -fF";
}
];
timeouts =
@ -239,7 +230,7 @@ in
QT_WAYLAND_DISABLE_WINDOWDECORATION = "1";
QT_QPA_PLATFORMTHEME = "qt5ct";
_JAVA_AWT_WM_NONEREPARENTING = "1";
} // (optionalAttrs cfg.nvidiaSupport
} // (lib.optionalAttrs cfg.nvidiaSupport
{
GBM_BACKEND = "nvidia-drm";
GDK_BACKEND = "wayland";
@ -263,16 +254,16 @@ in
alsa.support32Bit = true;
pulse.enable = true;
};
displayManager = {
autoLogin = {
enable = true;
user = "moritz";
};
defaultSession = "river";
};
xserver = {
enable = true;
displayManager = {
lightdm.enable = true;
autoLogin = {
enable = true;
user = "moritz";
};
defaultSession = "river";
};
displayManager.lightdm.enable = true;
};
};
security.rtkit.enable = true;
@ -287,7 +278,7 @@ in
};
};
in
genAttrs units mkAfter;
lib.genAttrs units mkAfter;
systemd.user.services =
let
@ -297,6 +288,6 @@ in
wants = [ "river-session.target" ];
};
in
genAttrs units mkAfter;
lib.genAttrs units mkAfter;
};
}

View file

@ -0,0 +1,339 @@
* {
/* `otf-font-awesome` is required to be installed for icons */
font-family: FontAwesome, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
}
window#waybar {
background-color: rgba(43, 48, 59, 0.5);
border-bottom: 3px solid rgba(100, 114, 125, 0.5);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.2;
}
/*
window#waybar.empty {
background-color: transparent;
}
window#waybar.solo {
background-color: #FFFFFF;
}
*/
window#waybar.termite {
background-color: #3F3F3F;
}
window#waybar.chromium {
background-color: #000000;
border: none;
}
button {
/* Use box-shadow instead of border so the text isn't offset */
box-shadow: inset 0 -3px transparent;
/* Avoid rounded borders under each button name */
border: none;
border-radius: 0;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
button:hover {
background: inherit;
box-shadow: inset 0 -3px #ffffff;
}
/* you can set a style on hover for any module like this */
#pulseaudio:hover {
background-color: #a37800;
}
#workspaces button {
padding: 0 5px;
background-color: transparent;
color: #ffffff;
}
#workspaces button:hover {
background: rgba(0, 0, 0, 0.2);
}
#workspaces button.focused {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#workspaces button.urgent {
background-color: #eb4d4b;
}
#mode {
background-color: #64727D;
box-shadow: inset 0 -3px #ffffff;
}
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#wireplumber,
#custom-media,
#tray,
#mode,
#idle_inhibitor,
#scratchpad,
#power-profiles-daemon,
#mpd {
padding: 0 10px;
color: #ffffff;
}
#window,
#workspaces {
margin: 0 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0;
}
#clock {
background-color: #64727D;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
/* Using steps() instead of linear as a timing function to limit cpu usage */
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: steps(12);
animation-iteration-count: infinite;
animation-direction: alternate;
}
#power-profiles-daemon {
padding-right: 15px;
}
#power-profiles-daemon.performance {
background-color: #f53c3c;
color: #ffffff;
}
#power-profiles-daemon.balanced {
background-color: #2980b9;
color: #ffffff;
}
#power-profiles-daemon.power-saver {
background-color: #2ecc71;
color: #000000;
}
label:focus {
background-color: #000000;
}
#cpu {
background-color: #2ecc71;
color: #000000;
}
#memory {
background-color: #9b59b6;
}
#disk {
background-color: #964B00;
}
#backlight {
background-color: #90b1b1;
}
#network {
background-color: #2980b9;
}
#network.disconnected {
background-color: #f53c3c;
}
#pulseaudio {
background-color: #f1c40f;
color: #000000;
}
#pulseaudio.muted {
background-color: #90b1b1;
color: #2a5c45;
}
#wireplumber {
background-color: #fff0f5;
color: #000000;
}
#wireplumber.muted {
background-color: #f53c3c;
}
#custom-media {
background-color: #66cc99;
color: #2a5c45;
min-width: 100px;
}
#custom-media.custom-spotify {
background-color: #66cc99;
}
#custom-media.custom-vlc {
background-color: #ffa000;
}
#temperature {
background-color: #f0932b;
}
#temperature.critical {
background-color: #eb4d4b;
}
#tray {
background-color: #2980b9;
}
#tray > .passive {
-gtk-icon-effect: dim;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
background-color: #eb4d4b;
}
#idle_inhibitor {
background-color: #2d3436;
}
#idle_inhibitor.activated {
background-color: #ecf0f1;
color: #2d3436;
}
#mpd {
background-color: #66cc99;
color: #2a5c45;
}
#mpd.disconnected {
background-color: #f53c3c;
}
#mpd.stopped {
background-color: #90b1b1;
}
#mpd.paused {
background-color: #51a37a;
}
#language {
background: #00b093;
color: #740864;
padding: 0 5px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
padding: 0 0px;
margin: 0 5px;
min-width: 16px;
}
#keyboard-state > label {
padding: 0 5px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad {
background: rgba(0, 0, 0, 0.2);
}
#scratchpad.empty {
background-color: transparent;
}
#privacy {
padding: 0;
}
#privacy-item {
padding: 0 5px;
color: white;
}
#privacy-item.screenshare {
background-color: #cf5700;
}
#privacy-item.audio-in {
background-color: #1ca000;
}
#privacy-item.audio-out {
background-color: #0069d4;
}
#tags button {
color: black;
}
#tags button.occupied {
color: white;
}
#tags button.focused {
background-color: grey;
}