Merge branch 'master' of ssh://git.nx2.site:20022/nx2/dotfiles

This commit is contained in:
Lennart J. Kurzweg (Nx2)
2024-04-30 16:34:35 +02:00
16 changed files with 500 additions and 113 deletions

View File

@@ -47,6 +47,9 @@ in
pkgs-unstable.hyprlock
pkgs-unstable.hypridle
pkgs.grim
pkgs.slurp
];
wayland.windowManager.hyprland = {
@@ -55,10 +58,10 @@ in
xwayland.enable = true;
systemd.enable = true;
plugins = [
# inputs.hyprland-plugins.packages.${pkgs.system}.hyprexpo
inputs.hyprland-plugins.packages.${pkgs.system}.hyprexpo
# inputs.hyprfocus.packages.${pkgs.system}.hyprfocus
# inputs.hycov.packages.${pkgs.system}.hycov
inputs.Hyprspace.packages.${pkgs.system}.Hyprspace
# inputs.Hyprspace.packages.${pkgs.system}.Hyprspace
];
settings = {
@@ -346,8 +349,8 @@ in
## ROW 2:
#bind = SUPER, TAB, hycov:toggleoverview
"SUPER, TAB, overview:toggle"
# "SUPER SHIFT, TAB, hyprexpo:expo, toggle"
# "SUPER, TAB, overview:toggle"
"SUPER, TAB, hyprexpo:expo, toggle"
"ALT, TAB, focuscurrentorlast"
"SUPER, Q, killactive"
"SUPER, W, exec, waybar_mode set '󰈹 '"
@@ -428,7 +431,7 @@ in
###########################################################################
## MEGA KEYS:
", Print, exec, /home/nx2/scripts/screenshot.sh "
'' , Print, exec, grim -g "$(slurp)"''
"SUPER, Next, resizeactive, 100 -100"
"SUPER, Prior, resizeactive, -100 100"
@@ -437,12 +440,12 @@ in
",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"
",XF86AudioLowerVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-"
",XF86AudioMute, exec, pactl set-sink-mute @DEFAULT_SINK@ toggle"
",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
",XF86AudioPlay, exec, playerctl play-pause"
",XF86AudioPrev, exec, playerctl playerctl previous"
",XF86AudioNext, exec, playerctl playerctl next"
",XF86MonBrightnessUp, exec, brightnessctl s '5%+'"
",XF86MonBrightnessDown, exec, brightnessctl s '5%-'"
",XF86AudioPrev, exec, playerctl previous"
",XF86AudioNext, exec, playerctl next"
",XF86MonBrightnessUp, exec, brightnessctl s '5%+'"
",XF86MonBrightnessDown, exec, brightnessctl s '5%-'"
###########################################################################
## MOUSE:
@@ -756,18 +759,18 @@ in
# plugin {
# hyprexpo {
# columns = 5
# gap_size = ${builtins.toString rice.gap-size}
# bg_col = rgb(${rice.lib.nohash rice.color.background})
# workspace_method = first 10 # [center/first] [workspace] e.g. first 1 or center m+1
plugin {
hyprexpo {
columns = 5
gap_size = ${builtins.toString rice.gap-size}
bg_col = rgb(${rice.lib.nohash rice.color.background})
workspace_method = first 10 # [center/first] [workspace] e.g. first 1 or center m+1
# enable_gesture = false # laptop touchpad, 4 fingers
# gesture_distance = 300 # how far is the "max"
# gesture_positive = true # positive = swipe down. Negative = swipe up.
# }
# }
enable_gesture = false # laptop touchpad, 4 fingers
gesture_distance = 300 # how far is the "max"
gesture_positive = true # positive = swipe down. Negative = swipe up.
}
}
plugin {

128
home-modules/nixvim.nix Normal file
View File

@@ -0,0 +1,128 @@
{ config, pkgs, inputs, system, rice, ... }:
{
imports = [
inputs.nixvim.homeManagerModules.nixvim
];
home.packages = [
pkgs.neovide
];
programs.nixvim = {
enable = true;
viAlias = true;
vimAlias = true;
clipboard.providers.wl-copy.enable = true;
options = {
number = true;
relativenumber = true;
shiftwidth = 2;
};
colorschemes.catppuccin = {
enable = true;
settings = {
mocha = {
base = "#ff0000";
};
disable_underline = true;
flavour = "mocha";
integrations = {
cmp = true;
gitsigns = true;
mini = {
enabled = true;
indentscope_color = "";
};
notify = false;
nvimtree = true;
treesitter = true;
};
styles = {
booleans = [
"bold"
"italic"
];
conditionals = [
"bold"
];
};
term_colors = true;
};
};
# colorschemes.base16 = {
# enable = true;
# setUpBar = true;
# colorscheme = "onedark";
# customColorScheme = {
# base00 = rice.color.background;
# base01 = rice.color.bright-black;
# base02 = rice.color.blue;
# base03 = rice.color.bright-blue;
# base04 = rice.color.cyan;
# base05 = rice.color.bright-cyan;
# base06 = rice.color.green;
# base07 = rice.color.bright-green;
# base08 = rice.color.magenta;
# base09 = rice.color.bright-magenta;
# base0A = rice.color.red;
# base0B = rice.color.bright-red;
# base0C = rice.color.white;
# base0D = rice.color.bright-white;
# base0E = rice.color.yellow;
# base0F = rice.color.bright-yellow;
# };
# };
opts = {
termguicolors = true;
};
globals = {
mapleader = " ";
};
plugins = {
telescope = {
enable = true;
extensions = {
fzf-native.enable = true;
};
keymaps = {
"<C-o>" = { action = "find_files"; };
"<leader>fg" = { action = "live_grep"; };
};
};
lightline = {
enable = true;
# colorscheme = "base16";
# active = {
# left = [
# ["mode" "paste"]
# ["readonly" "filename" "modified"]
# ];
# right = [
# [ "lineinfo" ]
# [ "percent" ]
# [ "fileformat" "fileencoding" "filetype" "charvaluehex" ]
# [ "git" ]
# ];
# };
};
nix.enable = true;
lsp-lines.enable = true;
lspkind.enable = true;
};
extraPlugins = [ ];
keymaps =
let
mkKeymap = mode: key: action: { inherit mode key action; };
mkKeymapWithOpts = mode: key: action: opts: (mkKeymap mode key action) // { options = opts; };
in
[
(mkKeymap "" "<Space>" "<Nop>")
(mkKeymap "n" "<leader>ff" "builtin.find_files")
];
};
}
## vl clipboard?

View File

@@ -0,0 +1,18 @@
vim.g.mapleader = ' '
vim.g.maplocalleader = ' '
vim.o.clipboard = 'unnamedplus'
vim.o.number = true
-- vim.o.relativenumber = true
vim.o.signcolumn = 'yes'
vim.o.tabstop = 4
vim.o.shiftwidth = 4
vim.o.updatetime = 300
vim.o.termguicolors = true
vim.o.mouse = 'a'

View File

@@ -0,0 +1,46 @@
local cmp = require('cmp')
local luasnip = require('luasnip')
require('luasnip.loaders.from_vscode').lazy_load()
luasnip.config.setup {}
cmp.setup {
snippet = {
expand = function(args)
luasnip.lsp_expand(args.body)
end,
},
mapping = cmp.mapping.preset.insert {
['<C-n>'] = cmp.mapping.select_next_item(),
['<C-p>'] = cmp.mapping.select_prev_item(),
['<C-d>'] = cmp.mapping.scroll_docs(-4),
['<C-f>'] = cmp.mapping.scroll_docs(4),
['<C-Space>'] = cmp.mapping.complete {},
['<CR>'] = cmp.mapping.confirm {
behavior = cmp.ConfirmBehavior.Replace,
select = true,
},
['<Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_next_item()
elseif luasnip.expand_or_locally_jumpable() then
luasnip.expand_or_jump()
else
fallback()
end
end, { 'i', 's' }),
['<S-Tab>'] = cmp.mapping(function(fallback)
if cmp.visible() then
cmp.select_prev_item()
elseif luasnip.locally_jumpable(-1) then
luasnip.jump(-1)
else
fallback()
end
end, { 'i', 's' }),
},
sources = {
{ name = 'nvim_lsp' },
{ name = 'luasnip' },
},
}

View File

@@ -0,0 +1,48 @@
local on_attach = function(_, bufnr)
local bufmap = function(keys, func)
vim.keymap.set('n', keys, func, { buffer = bufnr })
end
bufmap('<leader>r', vim.lsp.buf.rename)
bufmap('<leader>a', vim.lsp.buf.code_action)
bufmap('gd', vim.lsp.buf.definition)
bufmap('gD', vim.lsp.buf.declaration)
bufmap('gI', vim.lsp.buf.implementation)
bufmap('<leader>D', vim.lsp.buf.type_definition)
bufmap('gr', require('telescope.builtin').lsp_references)
bufmap('<leader>s', require('telescope.builtin').lsp_document_symbols)
bufmap('<leader>S', require('telescope.builtin').lsp_dynamic_workspace_symbols)
bufmap('K', vim.lsp.buf.hover)
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
vim.lsp.buf.format()
end, {})
end
local capabilities = vim.lsp.protocol.make_client_capabilities()
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
require('neodev').setup()
require('lspconfig').lua_ls.setup {
on_attach = on_attach,
capabilities = capabilities,
root_dir = function()
return vim.loop.cwd()
end,
cmd = { "lua-lsp" },
settings = {
Lua = {
workspace = { checkThirdParty = false },
telemetry = { enable = false },
},
}
}
require('lspconfig').rnix.setup {
on_attach = on_attach,
capabilities = capabilities,
}

View File

@@ -0,0 +1,11 @@
-- Lualine
require("lualine").setup({
icons_enabled = true,
theme = 'onedark',
})
-- Colorscheme
vim.cmd("colorscheme gruvbox")
-- Comment
require("Comment").setup()

View File

@@ -0,0 +1,13 @@
require('telescope').setup({
extensions = {
fzf = {
fuzzy = true, -- false will only do exact matching
override_generic_sorter = true, -- override the generic sorter
override_file_sorter = true, -- override the file sorter
case_mode = "smart_case", -- or "ignore_case" or "respect_case"
-- the default case_mode is "smart_case"
}
}
})
require('telescope').load_extension('fzf')

View File

@@ -0,0 +1,9 @@
require('nvim-treesitter.configs').setup {
ensure_installed = {},
auto_install = false,
highlight = { enable = true },
indent = { enable = true },
}

97
home-modules/nvim.nix Normal file
View File

@@ -0,0 +1,97 @@
{ config, pkgs, rice, ... }:
let
toLua = str: "lua << EOF\n${str}\nEOF\n";
toLuaFile = file: "lua << EOF\n${builtins.readFile file}\nEOF\n";
in
{
programs.neovim = {
enable = true;
viAlias = true;
vimAlias = true;
vimdiffAlias = true;
extraPackages = with pkgs; [
lua-language-server
# rnix-lsp
xclip
wl-clipboard
];
plugins = with pkgs.vimPlugins; [
{
plugin = nvim-lspconfig;
config = toLuaFile ./nvim-lua/plugin/lsp.lua;
}
{
plugin = comment-nvim;
config = toLua ''require("Comment").setup()'';
}
{
plugin = gruvbox-nvim;
config = "colorscheme gruvbox";
}
neodev-nvim
nvim-cmp
{
plugin = nvim-cmp;
config = toLuaFile ./nvim-lua/plugin/cmp.lua;
}
{
plugin = telescope-nvim;
config = toLuaFile ./nvim-lua/plugin/telescope.lua;
}
telescope-fzf-native-nvim
cmp_luasnip
cmp-nvim-lsp
luasnip
friendly-snippets
lualine-nvim
nvim-web-devicons
{
plugin = (nvim-treesitter.withPlugins (p: [
p.tree-sitter-nix
p.tree-sitter-vim
p.tree-sitter-bash
p.tree-sitter-lua
p.tree-sitter-python
p.tree-sitter-json
]));
config = toLuaFile ./nvim-lua/plugin/treesitter.lua;
}
vim-nix
# {
# plugin = vimPlugins.own-onedark-nvim;
# config = "colorscheme onedark";
# }
];
extraLuaConfig = ''
${builtins.readFile ./nvim-lua/options.lua}
'';
# extraLuaConfig = ''
# ${builtins.readFile ./nvim-lua/options.lua}
# ${builtins.readFile ./nvim-lua/plugin/lsp.lua}
# ${builtins.readFile ./nvim-lua/plugin/cmp.lua}
# ${builtins.readFile ./nvim-lua/plugin/telescope.lua}
# ${builtins.readFile ./nvim-lua/plugin/treesitter.lua}
# ${builtins.readFile ./nvim-lua/plugin/other.lua}
# '';
};
}

View File

@@ -1,5 +1,7 @@
{ config, pkgs, secrets, ... }:
let in
let
sep = " ";
in
{
home = {
file."${config.xdg.dataHome}/nx-gcal-event-credentials.json".text = ''
@@ -176,7 +178,7 @@ let in
name = escape(event['summary'])
print(f"󱙬 {sec_to_nice_string(remaining.seconds)}{mode}\'{name}\'")
print(f"󱙬${sep}{sec_to_nice_string(remaining.seconds)}{mode}\'{name}\'")
exit(0)
def print_help():

View File

@@ -1,14 +1,16 @@
{ config, pkgs, ... }:
{ config, pkgs, lib, host, ... }:
{
home.packages = with pkgs; [
virt-manager
];
config = lib.mkIf (host == "NxNORTH") {
home.packages = with pkgs; [
virt-manager
];
# programs.virt-manager.enable = true; # needs this in virtualization.nix
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu:///system" ];
uris = [ "qemu:///system" ];
# programs.virt-manager.enable = true; # needs this in virtualization.nix
dconf.settings = {
"org/virt-manager/virt-manager/connections" = {
autoconnect = [ "qemu:///system" ];
uris = [ "qemu:///system" ];
};
};
};
}
}

View File

@@ -1,5 +1,6 @@
{ config, lib, pkgs, rice, ... }:
let
sep = " ";
in
{
imports = [
@@ -46,7 +47,7 @@ in
#ord=$(date +"%e" | awk '{printf("%d%s\n", $1, substr("thstndrd", ($1%100-20)%10*2+1, 2))}')
ord=$(date +"%e" | awk '{printf("%d%s\n", $1, ($1==11||$1==12||$1==13)?"th":((($1%10)==1)?"st":((($1%10)==2)?"nd":((($1%10)==3)?"rd":"th"))))}')
if [ $# -eq 0 ]; then
echo "󰃮 $(date +'%A the')" "$ord" "of" "$(date +'%B')" " " "$(date +'%R')"
echo "󰃮${sep}$(date +'%A the')" "$ord" "of" "$(date +'%B')" " ${sep}$(date +'%R')"
elif [ "$1" = "--no-icons" ]; then
echo "$(date +'%A the')" "$ord" "of" "$(date +'%B')" "$(date +'%R')"
fi
@@ -58,7 +59,7 @@ in
enable = true;
settings = {
bar = {
height = 30;
height = 20;
layer = "top";
# position = "top";
position = "bottom";
@@ -68,8 +69,8 @@ in
margin-right = rice.gap-size;
spacing = 10;
modules-left = [
"cpu"
"memory"
# "cpu"
# "memory"
"wireplumber"
"backlight"
"battery"
@@ -92,6 +93,7 @@ in
active-only = false;
};
"hyprland/window" = {
# format = "${sep}{}";
format = "{}";
separate-outputs = true;
};
@@ -111,20 +113,20 @@ in
cpu = {
interval = 1;
format = "󰍛 {}%";
format = "󰍛${sep}{}%";
max-length = 10;
};
memory = {
interval = 5;
format = " {avail:.0f}G free";
format = "${sep}{avail:.0f}G free";
};
battery = {
interval = 60;
tooltip = false;
format = "{icon} {capacity}%";
format = "{icon}${sep}{capacity}%";
states = {
warning = 25;
critical = 10;
warning = 15;
critical = 5;
};
format-icons = [
" "
@@ -133,13 +135,13 @@ in
" "
" "
];
format-charging = "{icon} +{capacity}%";
format-plugged = "{icon} P{capacity}%";
format-full = "{icon} F{capacity}%";
format-charging = "{icon}${sep}+{capacity}%";
format-plugged = "{icon}${sep}P{capacity}%";
format-full = "{icon}${sep}F{capacity}%";
};
backlight = {
device = "DP-1";
format = "{icon} {percent}%";
device = "eDP-1";
format = "{icon}${sep}{percent}%";
format-icons = [
""
""
@@ -153,13 +155,13 @@ in
];
};
network = {
format-wifi = " {essid}";
format-ethernet = "󰈀 Wired";
format-disconnected = "󰌙 Disconnected";
format-wifi = "${sep}{essid}";
format-ethernet = "󰈀${sep}Wired";
format-disconnected = "󰌙${sep}Disconnected";
};
wireplumber = {
format = "󰕾 {volume}%";
format-muted = " Muted";
format = "󰕾${sep}{volume}%";
format-muted = "󰝟${sep}--%";
};
};
};
@@ -174,7 +176,7 @@ in
window#waybar {
background-color: rgba(${rice.lib.hex-to-rgb-comma-string rice.color.background},${builtins.toString rice.transparency});
transition-duration: 0.5s;
transition-duration: 2s;
padding: 7px 10px;
padding-top: 0.1em;
/* border: ${builtins.toString rice.border-width}px solid rgb(${rice.lib.hex-to-rgb-comma-string rice.color.blue}); */
@@ -227,10 +229,26 @@ in
color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.red});
}
#cpu {
margin-left: 0.5em;
}
#window, #custom-ctimeremaining {
font-family: ${rice.font.base.name}, ${rice.font.code.name2};
color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.blue});
}
#wireplumber.muted {
color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.blue});
}
#battery.warning:not(.charging) {
color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.green});;
}
#battery.critical {
color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.red});;
background: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.bright-red});
}
#battery.charging { color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.green}); }
'';
#battery.critical:not(.charging) {
};
}