Update Zed configuration for nix LSP and formatter.

This commit is contained in:
2025-11-23 16:34:22 +01:00
parent 2be712393f
commit 900b565405
114 changed files with 2311 additions and 2408 deletions

View File

@@ -2,8 +2,7 @@
pkgs,
username,
...
}:
{
}: {
home.packages = with pkgs; [
# hyprland
swww
@@ -17,19 +16,19 @@
# pyprland
pyprland
(import ./emopicker9000.nix { inherit pkgs; })
(import ./hm-find.nix { inherit pkgs; })
(import ./keybinds.nix { inherit pkgs username; })
(import ./note.nix { inherit pkgs; })
(import ./note-from-clipboard.nix { inherit pkgs; })
(import ./nvidia-offload.nix { inherit pkgs; })
(import ./rofi-launcher.nix { inherit pkgs; })
(import ./screenshootin.nix { inherit pkgs; })
(import ./task-waybar.nix { inherit pkgs; })
(import ./emopicker9000.nix {inherit pkgs;})
(import ./hm-find.nix {inherit pkgs;})
(import ./keybinds.nix {inherit pkgs username;})
(import ./note.nix {inherit pkgs;})
(import ./note-from-clipboard.nix {inherit pkgs;})
(import ./nvidia-offload.nix {inherit pkgs;})
(import ./rofi-launcher.nix {inherit pkgs;})
(import ./screenshootin.nix {inherit pkgs;})
(import ./task-waybar.nix {inherit pkgs;})
(import ./wallsetter.nix {
inherit pkgs;
inherit username;
})
(import ./web-search.nix { inherit pkgs; })
(import ./web-search.nix {inherit pkgs;})
];
}

View File

@@ -1,4 +1,4 @@
{ pkgs }:
{pkgs}:
pkgs.writeShellScriptBin "emopicker9000" ''
# check if rofi is already running
if pidof rofi > /dev/null; then

View File

@@ -1,4 +1,4 @@
{ pkgs }:
{pkgs}:
pkgs.writeShellScriptBin "hm-find" ''
#!/usr/bin/env bash

View File

@@ -1,29 +1,32 @@
{ pkgs, username, ... }:
let
{
pkgs,
username,
...
}: let
desktopEntriesPath = "/home/${username}/.local/state/home-manager/gcroots/current-home/home-path/share/applications/";
in
pkgs.writeShellScriptBin "list-keybinds" ''
# check if rofi is already running
if pidof rofi > /dev/null; then
pkill rofi
fi
pkgs.writeShellScriptBin "list-keybinds" ''
# check if rofi is already running
if pidof rofi > /dev/null; then
pkill rofi
fi
msg=' = Windows/Super/CAPS LOCK (Enter nie wykonuje skrótu)'
keybinds=$(cat ~/.config/hypr/hyprland.conf | grep -E '^bind')
msg=' = Windows/Super/CAPS LOCK (Enter nie wykonuje skrótu)'
keybinds=$(cat ~/.config/hypr/hyprland.conf | grep -E '^bind')
# replace $modifier with SUPER and clean up paths
display_keybinds=$(echo "$keybinds" | sed 's/\$modifier//g' | sed 's|${desktopEntriesPath}/||g')
# replace $modifier with SUPER and clean up paths
display_keybinds=$(echo "$keybinds" | sed 's/\$modifier//g' | sed 's|${desktopEntriesPath}/||g')
# remove "bind=" and "bindm=" prefixes
display_keybinds=$(echo "$display_keybinds" | sed 's/^bind=//' | sed 's/^bindm=/🖱/')
# remove "bind=" and "bindm=" prefixes
display_keybinds=$(echo "$display_keybinds" | sed 's/^bind=//' | sed 's/^bindm=/🖱/')
# add + before CONTROL, SHIFT, ALT when they appear after removed $modifier
display_keybinds=$(echo "$display_keybinds" | sed 's/ CONTROL/ + CONTROL/g' | sed 's/ SHIFT/ + SHIFT/g' | sed 's/ ALT/ + ALT/g')
# add + before CONTROL, SHIFT, ALT when they appear after removed $modifier
display_keybinds=$(echo "$display_keybinds" | sed 's/ CONTROL/ + CONTROL/g' | sed 's/ SHIFT/ + SHIFT/g' | sed 's/ ALT/ + ALT/g')
# replace commas: first comma -> " +", second comma -> " =", remaining commas -> " ->"
display_keybinds=$(echo "$display_keybinds" | sed 's/,/ +/1' | sed 's/,/ =/1' | sed 's/,/ ->/g')
# replace commas: first comma -> " +", second comma -> " =", remaining commas -> " ->"
display_keybinds=$(echo "$display_keybinds" | sed 's/,/ +/1' | sed 's/,/ =/1' | sed 's/,/ ->/g')
# use rofi to display the keybinds with the modified content
echo "$display_keybinds" | rofi -dmenu -i -config ~/.config/rofi/config-long.rasi -mesg "$msg"
# use rofi to display the keybinds with the modified content
echo "$display_keybinds" | rofi -dmenu -i -config ~/.config/rofi/config-long.rasi -mesg "$msg"
''
''

View File

@@ -1,4 +1,4 @@
{ pkgs, ... }:
{pkgs, ...}:
pkgs.writeShellScriptBin "note-from-clipboard" ''
#!/usr/bin/env bash

View File

@@ -1,4 +1,4 @@
{ pkgs, ... }:
{pkgs, ...}:
pkgs.writeShellScriptBin "note" ''
# Colors for nice output
@@ -42,24 +42,24 @@ pkgs.writeShellScriptBin "note" ''
local note_text="$1"
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
local date_only=$(date '+%Y-%m-%d')
# Create notes file if it doesn't exist
touch "$NOTES_FILE"
# Get next note number
local note_num=1
if [ -f "$NOTES_FILE" ] && [ -s "$NOTES_FILE" ]; then
note_num=$(grep -E "^#[0-9]+" "$NOTES_FILE" | sed 's/^#\([0-9]*\).*/\1/' | sort -n | tail -1)
note_num=$((note_num + 1))
fi
# Add the note with proper formatting
{
echo "#$note_num [$timestamp]"
echo "$note_text"
echo ""
} >> "$NOTES_FILE"
echo -e "''${GREEN}''${NC} Note #$note_num added ''${GRAY}($date_only)''${NC}"
}
@@ -70,14 +70,14 @@ pkgs.writeShellScriptBin "note" ''
echo -e "''${GRAY}Use ''${CYAN}note <text>''${GRAY} to add your first note''${NC}"
return
fi
echo -e "''${BOLD}''${BLUE}📝 Your Notes''${NC}"
echo -e "''${GRAY}📁 $NOTES_FILE''${NC}"
echo -e "''${GRAY}$(printf '%.0s' {1..50})''${NC}"
local in_note=false
local note_content=""
while IFS= read -r line; do
# Check if line starts with # followed by numbers and space and [
if echo "$line" | grep -q "^#[0-9][0-9]* \["; then
@@ -86,13 +86,13 @@ pkgs.writeShellScriptBin "note" ''
echo -e "$note_content"
echo ""
fi
# Extract note number and timestamp
local num=$(echo "$line" | sed 's/^#\([0-9]*\) \[.*/\1/')
local timestamp=$(echo "$line" | sed 's/^#[0-9]* \[\(.*\)\]/\1/')
local date_part=$(echo "$timestamp" | cut -d' ' -f1)
local time_part=$(echo "$timestamp" | cut -d' ' -f2)
echo -e "''${BOLD}''${CYAN}#$num''${NC} ''${GRAY}[$date_part ''${YELLOW}$time_part''${GRAY}]''${NC}"
in_note=true
note_content=""
@@ -113,13 +113,13 @@ pkgs.writeShellScriptBin "note" ''
note_content=""
fi
done < "$NOTES_FILE"
# Print last note if file doesn't end with empty line
if [ "$in_note" = true ] && [ -n "$note_content" ]; then
echo -e "$note_content"
echo ""
fi
local total_notes=$(grep -c "^#[0-9]" "$NOTES_FILE")
echo -e "''${GRAY}$(printf '%.0s' {1..50})''${NC}"
echo -e "''${GRAY}Total: ''${BOLD}$total_notes''${NC} ''${GRAY}notes''${NC}"
@@ -128,27 +128,27 @@ pkgs.writeShellScriptBin "note" ''
# Function to delete a note
delete_note() {
local note_num="$1"
if [ ! -f "$NOTES_FILE" ] || [ ! -s "$NOTES_FILE" ]; then
echo -e "''${RED}''${NC} No notes found"
return 1
fi
if ! echo "$note_num" | grep -q "^[0-9][0-9]*$"; then
echo -e "''${RED}''${NC} Invalid note number: $note_num"
return 1
fi
# Check if note exists
if ! grep -q "^#$note_num " "$NOTES_FILE"; then
echo -e "''${RED}''${NC} Note #$note_num not found"
return 1
fi
# Create temporary file without the specified note
local temp_file=$(mktemp)
local skip_lines=false
while IFS= read -r line; do
if echo "$line" | grep -q "^#[0-9][0-9]* "; then
local current_num=$(echo "$line" | sed 's/^#\([0-9]*\) .*/\1/')
@@ -159,7 +159,7 @@ pkgs.writeShellScriptBin "note" ''
skip_lines=false
fi
fi
if [ "$skip_lines" = false ]; then
echo "$line" >> "$temp_file"
elif [ -z "$line" ]; then
@@ -167,7 +167,7 @@ pkgs.writeShellScriptBin "note" ''
skip_lines=false
fi
done < "$NOTES_FILE"
mv "$temp_file" "$NOTES_FILE"
echo -e "''${GREEN}''${NC} Note #$note_num deleted"
}
@@ -178,11 +178,11 @@ pkgs.writeShellScriptBin "note" ''
echo -e "''${YELLOW}📝 No notes to clear''${NC}"
return
fi
local total_notes=$(grep -c "^#[0-9]" "$NOTES_FILE")
echo -e "''${YELLOW}''${NC} This will delete all $total_notes notes. Are you sure? ''${GRAY}[y/N]''${NC}"
read -r confirmation
if echo "$confirmation" | grep -qi "^y"; then
> "$NOTES_FILE"
echo -e "''${GREEN}''${NC} All notes cleared"
@@ -204,7 +204,7 @@ pkgs.writeShellScriptBin "note" ''
piped_content="$piped_content"$'\n'"$line"
fi
done
if [ -n "$piped_content" ]; then
add_note "$piped_content"
else
@@ -213,7 +213,7 @@ pkgs.writeShellScriptBin "note" ''
fi
return
fi
# Handle command line arguments
case "$1" in
"")

View File

@@ -1,5 +1,4 @@
{ pkgs }:
{pkgs}:
pkgs.writeShellScriptBin "nvidia-offload" ''
export __NV_PRIME_RENDER_OFFLOAD=1
export __NV_PRIME_RENDER_OFFLOAD_PROVIDER=NVIDIA-G0

View File

@@ -1,4 +1,4 @@
{ pkgs }:
{pkgs}:
pkgs.writeShellScriptBin "rofi-launcher" ''
# check if rofi is already running
if pidof rofi > /dev/null; then

View File

@@ -1,5 +1,4 @@
{ pkgs }:
{pkgs}:
pkgs.writeShellScriptBin "screenshootin" ''
grim -g "$(slurp)" - | swappy -f -
''

View File

@@ -1,5 +1,4 @@
{ pkgs }:
{pkgs}:
pkgs.writeShellScriptBin "task-waybar" ''
sleep 0.1
${pkgs.swaynotificationcenter}/bin/swaync-client -t &

View File

@@ -1,5 +1,4 @@
{ pkgs, ... }:
{pkgs, ...}:
pkgs.writeShellScriptBin "wallsetter" ''
TIMEOUT=720

View File

@@ -1,4 +1,4 @@
{ pkgs }:
{pkgs}:
pkgs.writeShellScriptBin "web-search" ''
# check if rofi is already running
if pidof rofi > /dev/null; then