This commit is contained in:
Hadi 2024-03-11 23:19:59 +01:00
parent fc06455cbf
commit 720c6a3dbb
9 changed files with 164 additions and 66 deletions

View File

@ -0,0 +1,3 @@
{
}

View File

@ -1,4 +1,4 @@
{ pkgs, ... }: {
{ pkgs, config, ... }: {
home.packages = with pkgs; [
xdg-desktop-portal-hyprland
@ -26,7 +26,7 @@
settings = {
"$mod" = "SUPER";
"$menu" = "~/scripts/menu.sh";
"$menu" = "menu";
"$powermenu" = "${pkgs.wlogout}/bin/wlogout";
exec-once = [

View File

@ -1,24 +1,11 @@
{
# TODO:
# choose output sound
# choose wallpaper
# import wireguard config
# powermenu
# menu
# custom colors on all config files
# vim format on save
imports = [ ./scripts.nix ./sshconfig.nix ];
# TODO:
# custom colors on all config files
# auto update
# auto remove old
# script to edit, rebuild, push
home.file = {
".ssh/config" = {
text = ''
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github
'';
executable = false;
};
};
}

87
home/misc/scripts.nix Normal file
View File

@ -0,0 +1,87 @@
{ pkgs, config, ... }:
let
homedir = config.home.homeDirectory;
wallpaper = pkgs.writeShellScriptBin "wallpaper" ''
WALLPAPER_FOLDER="${homedir}/Nextcloud/wallpaper"
cd $WALLPAPER_FOLDER
choosed_wallpaper=$(fd . |
fzf \
--preview='kitty icat --clear --transfer-mode=memory --stdin=no --place=''${FZF_PREVIEW_COLUMNS}x''${FZF_PREVIEW_LINES}@0x0 {}' \
--preview-window=bottom,border-top \
--margin=1 \
--layout=reverse \
--border --border-label "Wallpaper" \
--info="hidden" \
--header="" \
--prompt='/ ' \
--color="dark,fg+:white,bg+:-1,fg:white,bg:-1"\
--color='prompt:grey,pointer:magenta,fg+:regular') || exit 1
swww img $choosed_wallpaper
'';
menu = pkgs.writeShellScriptBin "menu" ''
if pgrep wofi; then
pkill wofi
else
wofi --show drun
fi
'';
wireguard-import = pkgs.writeShellScriptBin "wireguard-import" ''
nmcli connection import type wireguard file "$0"
'';
choose-output = pkgs.writeShellScriptBin "choose-output" ''
function parse_sinks(){
output=$(wpctl status)
sinks=($(echo "$output" | sed 's/ //' | awk '/Sinks:/ {flag=1; next} /^$/ {flag=0} flag' | sed 's/ /-/g'))
for sink in "''${sinks[@]}"; do
id=""
default=false
sink=$(echo "$sink" | sed 's/-/ /g')
sink_name=$(echo "$sink" | sed 's/\[vol:.*$//')
if [[ $sink_name == "*"* ]]; then
sink_name=$(echo "$sink_name" | sed 's/*//')
default=true
fi
id=$(echo "$sink_name" | cut -d'.' -f1)
sink_name=$(echo "$sink_name" | sed 's/^[ ]*//;s/[ ]*$//' )
sink_name=$(echo "$sink_name" | cut -d'.' -f2 )
if [[ $default == true ]];then
printf "*%s (%d)" "$sink_name" "$id"
else
printf " %s (%d)" "$sink_name" "$id"
fi
printf "\n"
done
}
choosed_sink=$(echo "$(parse_sinks)" | fzf \
--margin=1 \
--layout=reverse \
--border --border-label "Wallpaper" \
--info="hidden" \
--header="" \
--prompt='/ ' \
--color="dark,fg+:white,bg+:-1,fg:white,bg:-1"\
--color='prompt:grey,pointer:magenta,fg+:regular') || exit 1
choosed_sink_id=$(echo "$choosed_sink" | sed 's/.*(\(.*\))/\1/')
wpctl set-default $choosed_sink_id
'';
in {
home.packages = with pkgs; [ wallpaper menu wireguard-import choose-output ];
}

14
home/misc/sshconfig.nix Normal file
View File

@ -0,0 +1,14 @@
{
home.file = {
".ssh/config" = {
text = ''
Host github.com
User git
Hostname github.com
PreferredAuthentications publickey
IdentityFile ~/.ssh/github
'';
executable = false;
};
};
}

View File

@ -79,8 +79,8 @@
window = {
completion = {
winhighlight =
"FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
scrollbar = false;
"FloatBorder:CmpBorder,Normal:CmpPmenu,Search:PmenuSel";
scrollbar = true;
sidePadding = 0;
border = [ "" "" "" "" "" "" "" "" ];
};
@ -88,7 +88,7 @@
documentation = {
border = [ "" "" "" "" "" "" "" "" ];
winhighlight =
"FloatBorder:CmpBorder,Normal:CmpPmenu,CursorLine:CmpSel,Search:PmenuSel";
"FloatBorder:CmpBorder,Normal:CmpPmenu,Search:PmenuSel";
};
};

View File

@ -25,22 +25,17 @@ enable = true;
colorschemes.catppuccin.enable = true;
keymaps = [
# Global Mappings
# Default mode is "" which means normal-visual-op
{
# Toggle NvimTree
key = "<leader>e";
action = "<CMD>Neotree toggle<CR>";
}
{
# Format file
key = "<space>fm";
action = "<CMD>lua vim.lsp.buf.format()<CR>";
}
# Terminal Mappings
{
# Escape terminal mode using ESC
mode = "t";
key = "<esc>";
action = "<C-\\><C-n>";

View File

@ -8,6 +8,7 @@
clangd.enable = true;
gopls.enable = true;
nixd.enable = true;
tailwindcss.enable = true;
};
keymaps.lspBuf = {
"gd" = "definition";

View File

@ -2,24 +2,35 @@
programs.nixvim.globals.mapleader = " ";
programs.nixvim.options = {
updatetime = 100; # Faster completion
updatetime = 50; # Faster completion
number = true;
relativenumber = true;
autoindent = true;
clipboard = "unnamedplus";
clipboard = "unnamed,unnamedplus";
expandtab = true;
tabstop = 2;
softtabstop = 2;
shiftwidth = 2;
smartindent = true;
tabstop = 2;
breakindent = true;
ignorecase = true;
incsearch = true;
hlsearch = true;
smartcase = true;
wildmode = "list:longest";
completeopt = [ "menuone" "noselect" ];
signcolumn = "yes";
cursorline = true;
scrolloff = 8;
mouse = "a";
wrap = false;
swapfile = false;
undofile = true; # Build-in persistent undo
undofile = true;
};
}