From 15df83702174bb5572f210768eec67df14040a96 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Fri, 26 Apr 2024 15:25:17 +0200 Subject: [PATCH 1/5] waybar tweeks --- home-modules/hyprland.nix | 5 +++- home-modules/nx-gcal-event.nix | 6 +++-- home-modules/waybar.nix | 42 ++++++++++++++++++---------------- 3 files changed, 30 insertions(+), 23 deletions(-) diff --git a/home-modules/hyprland.nix b/home-modules/hyprland.nix index 1f10715..90ea492 100644 --- a/home-modules/hyprland.nix +++ b/home-modules/hyprland.nix @@ -47,6 +47,9 @@ in pkgs-unstable.hyprlock pkgs-unstable.hypridle + pkgs.grim + pkgs.slurp + ]; wayland.windowManager.hyprland = { @@ -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" diff --git a/home-modules/nx-gcal-event.nix b/home-modules/nx-gcal-event.nix index 6a7effe..581b557 100644 --- a/home-modules/nx-gcal-event.nix +++ b/home-modules/nx-gcal-event.nix @@ -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(): diff --git a/home-modules/waybar.nix b/home-modules/waybar.nix index 681fd0d..2ea1873 100644 --- a/home-modules/waybar.nix +++ b/home-modules/waybar.nix @@ -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 @@ -68,8 +69,8 @@ in margin-right = rice.gap-size; spacing = 10; modules-left = [ - "cpu" - "memory" + # "cpu" + # "memory" "wireplumber" "backlight" "battery" @@ -111,17 +112,17 @@ 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; @@ -133,13 +134,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 +154,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}Muted"; }; }; }; @@ -174,7 +175,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,9 +228,10 @@ in color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.red}); } - #cpu { - margin-left: 0.5em; - } + #window { + font-family: ${rice.font.base.name}; + color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.blue}); + } ''; }; From 2d3624e29054aceaa9dc74410606de5745f5feb2 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Fri, 26 Apr 2024 15:47:38 +0200 Subject: [PATCH 2/5] waybar tweeks ++ --- home-modules/hyprland.nix | 10 +++++----- home-modules/waybar.nix | 16 ++++++++++------ home.nix | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/home-modules/hyprland.nix b/home-modules/hyprland.nix index 90ea492..856cf71 100644 --- a/home-modules/hyprland.nix +++ b/home-modules/hyprland.nix @@ -440,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: diff --git a/home-modules/waybar.nix b/home-modules/waybar.nix index 2ea1873..32be260 100644 --- a/home-modules/waybar.nix +++ b/home-modules/waybar.nix @@ -47,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 "󰃮${sep}$(date +'%A the')" "$ord" "of" "$(date +'%B')" " ${sep}" "$(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 @@ -59,7 +59,7 @@ in enable = true; settings = { bar = { - height = 30; + height = 20; layer = "top"; # position = "top"; position = "bottom"; @@ -93,7 +93,7 @@ in active-only = false; }; "hyprland/window" = { - format = "{}"; + format = "${sep}{}"; separate-outputs = true; }; "custom/cclock" = { @@ -160,7 +160,7 @@ in }; wireplumber = { format = "󰕾${sep}{volume}%"; - format-muted = "󰝟${sep}Muted"; + format-muted = "󰝟${sep}--%"; }; }; }; @@ -228,8 +228,12 @@ in color: rgb(${rice.lib.hex-to-rgb-comma-string rice.color.red}); } - #window { - font-family: ${rice.font.base.name}; + #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}); } ''; diff --git a/home.nix b/home.nix index b1d3ec7..19d47b9 100644 --- a/home.nix +++ b/home.nix @@ -57,7 +57,7 @@ spotify spicetify-cli obs-studio - waybar swww rofi + waybar swww rofi playerctl imv mpv mediainfo exiftool ffmpeg pavucontrol fontpreview gtk2fontsel From 93c6fcbd717c212872eae83998fd315c086cefd1 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Fri, 26 Apr 2024 16:14:06 +0200 Subject: [PATCH 3/5] virt only on North --- home-modules/virt-manager.nix | 22 ++++++++++++---------- system-modules/virtualisation.nix | 16 +++++++++------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/home-modules/virt-manager.nix b/home-modules/virt-manager.nix index ab62466..9c75e75 100644 --- a/home-modules/virt-manager.nix +++ b/home-modules/virt-manager.nix @@ -1,14 +1,16 @@ -{ config, pkgs, ... }: +{ config, pkgs, host, ... }: { - home.packages = with pkgs; [ - virt-manager - ]; + config = pkgs.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" ]; + }; }; }; -} \ No newline at end of file +} diff --git a/system-modules/virtualisation.nix b/system-modules/virtualisation.nix index 94af820..6a8e6db 100644 --- a/system-modules/virtualisation.nix +++ b/system-modules/virtualisation.nix @@ -1,10 +1,12 @@ -{ config, pkgs, user, ... }: +{ config, pkgs, lib, user, host, ... }: { - environment.systemPackages = with pkgs; [ - virtiofsd - ]; - virtualisation.libvirtd.enable = true; - programs.virt-manager.enable = true; - users.users."${user}".extraGroups = [ "libvirtd" ]; + config = lib.mkIf (host == "NxNORTH") { + environment.systemPackages = with pkgs; [ + virtiofsd + ]; + virtualisation.libvirtd.enable = true; + programs.virt-manager.enable = true; + users.users."${user}".extraGroups = [ "libvirtd" ]; + }; } \ No newline at end of file From a64deb9113380252be3a2fea9b370df1c8cf2cc1 Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Fri, 26 Apr 2024 16:19:09 +0200 Subject: [PATCH 4/5] virt only on North rec fix --- home-modules/virt-manager.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/home-modules/virt-manager.nix b/home-modules/virt-manager.nix index 9c75e75..0494cf6 100644 --- a/home-modules/virt-manager.nix +++ b/home-modules/virt-manager.nix @@ -1,6 +1,6 @@ -{ config, pkgs, host, ... }: +{ config, pkgs, lib, host, ... }: { - config = pkgs.lib.mkIf (host == "NxNORTH") { + config = lib.mkIf (host == "NxNORTH") { home.packages = with pkgs; [ virt-manager ]; From 31df2f1a03e913915ec3cbdc06ac54c799ab7c1e Mon Sep 17 00:00:00 2001 From: "Lennart J. Kurzweg (Nx2)" Date: Mon, 29 Apr 2024 16:09:43 +0200 Subject: [PATCH 5/5] neovim start --- flake.lock | 63 ++++------ flake.nix | 22 ++-- home-modules/hyprland.nix | 30 ++--- home-modules/nixvim.nix | 128 ++++++++++++++++++++ home-modules/nvim-lua/options.lua | 18 +++ home-modules/nvim-lua/plugin/cmp.lua | 46 +++++++ home-modules/nvim-lua/plugin/lsp.lua | 48 ++++++++ home-modules/nvim-lua/plugin/other.lua | 11 ++ home-modules/nvim-lua/plugin/telescope.lua | 13 ++ home-modules/nvim-lua/plugin/treesitter.lua | 9 ++ home-modules/nvim.nix | 97 +++++++++++++++ home-modules/waybar.nix | 18 ++- home.nix | 3 + 13 files changed, 439 insertions(+), 67 deletions(-) create mode 100644 home-modules/nixvim.nix create mode 100644 home-modules/nvim-lua/options.lua create mode 100644 home-modules/nvim-lua/plugin/cmp.lua create mode 100644 home-modules/nvim-lua/plugin/lsp.lua create mode 100644 home-modules/nvim-lua/plugin/other.lua create mode 100644 home-modules/nvim-lua/plugin/telescope.lua create mode 100644 home-modules/nvim-lua/plugin/treesitter.lua create mode 100644 home-modules/nvim.nix diff --git a/flake.lock b/flake.lock index 781aed0..ff9f0fa 100644 --- a/flake.lock +++ b/flake.lock @@ -1,25 +1,5 @@ { "nodes": { - "Hyprspace": { - "inputs": { - "hyprland": [ - "hyprland" - ] - }, - "locked": { - "lastModified": 1713738762, - "narHash": "sha256-wXMqOQosjblsdV3x0DzpH7qSBUs5hT5Ca6eZ2Xp8TOA=", - "owner": "KZDKM", - "repo": "Hyprspace", - "rev": "de3b1ccbf30498b6fcd42b36418e33a2c8c1405a", - "type": "github" - }, - "original": { - "owner": "KZDKM", - "repo": "Hyprspace", - "type": "github" - } - }, "home-manager": { "inputs": { "nixpkgs": [ @@ -27,11 +7,11 @@ ] }, "locked": { - "lastModified": 1712386041, - "narHash": "sha256-dA82pOMQNnCJMAsPG7AXG35VmCSMZsJHTFlTHizpKWQ=", + "lastModified": 1714043624, + "narHash": "sha256-Xn2r0Jv95TswvPlvamCC46wwNo8ALjRCMBJbGykdhcM=", "owner": "nix-community", "repo": "home-manager", - "rev": "d6bb9f934f2870e5cbc5b94c79e9db22246141ff", + "rev": "86853e31dc1b62c6eeed11c667e8cdd0285d4411", "type": "github" }, "original": { @@ -82,11 +62,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1713778289, - "narHash": "sha256-h3ufswObZ8qUxQewTc5L173ILfV6JBQ+IaN1aN9RPjY=", + "lastModified": 1714248933, + "narHash": "sha256-hACvj8q0ucxslZmHf7j6bYlxVeDkJleAW+sCHGv4+2k=", "owner": "hyprwm", "repo": "Hyprland", - "rev": "e1644e91ead7cdef5d08bfe6a579c4478a816a8e", + "rev": "2e763764bfdaee2039961c6c220b5d6af31712d4", "type": "github" }, "original": { @@ -107,11 +87,11 @@ ] }, "locked": { - "lastModified": 1713607544, - "narHash": "sha256-nbqQmhvYbDVC/5YiZLSGj5r14cOk2k6TGPpP2TtCfhI=", + "lastModified": 1714219583, + "narHash": "sha256-s6yf/bsAum3sAXSxB5gDCHQoLMn5Skl9EWL8nvsXzog=", "owner": "hyprwm", "repo": "hyprland-plugins", - "rev": "9971fec974a9d94a2a1b1d68d5ada5fc59fec053", + "rev": "97e9d252ffec654cdc69a2cea8b63a172795706b", "type": "github" }, "original": { @@ -182,11 +162,11 @@ ] }, "locked": { - "lastModified": 1713730424, - "narHash": "sha256-MqYjTvQCxwuDIuAaqIEuyqserm5PYr0auiHHPuYFN/k=", + "lastModified": 1714171579, + "narHash": "sha256-eaWDIvt8ufUKKz3Lc2a3PyemLJG1m9RYlF+HP3hWbaw=", "owner": "hyprwm", "repo": "hyprwayland-scanner", - "rev": "7c9c8adfe7e424faa0c5ce6e8be90157fda53c06", + "rev": "126dad854f22fe30e6b82cd21808e76903d90ac5", "type": "github" }, "original": { @@ -197,11 +177,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1713537308, - "narHash": "sha256-XtTSSIB2DA6tOv+l0FhvfDMiyCmhoRbNB+0SeInZkbk=", + "lastModified": 1714076141, + "narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "5c24cf2f0a12ad855f444c30b2421d044120c66f", + "rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856", "type": "github" }, "original": { @@ -213,11 +193,11 @@ }, "nixpkgs-unstable": { "locked": { - "lastModified": 1713714899, - "narHash": "sha256-+z/XjO3QJs5rLE5UOf015gdVauVRQd2vZtsFkaXBq2Y=", + "lastModified": 1714076141, + "narHash": "sha256-Drmja/f5MRHZCskS6mvzFqxEaZMeciScCTFxWVLqWEY=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "6143fc5eeb9c4f00163267708e26191d1e918932", + "rev": "7bb2ccd8cdc44c91edba16c48d2c8f331fb3d856", "type": "github" }, "original": { @@ -228,11 +208,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1713725259, - "narHash": "sha256-9ZR/Rbx5/Z/JZf5ehVNMoz/s5xjpP0a22tL6qNvLt5E=", + "lastModified": 1713995372, + "narHash": "sha256-fFE3M0vCoiSwCX02z8VF58jXFRj9enYUSTqjyHAjrds=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "a5e4bbcb4780c63c79c87d29ea409abf097de3f7", + "rev": "dd37924974b9202f8226ed5d74a252a9785aedf8", "type": "github" }, "original": { @@ -243,7 +223,6 @@ }, "root": { "inputs": { - "Hyprspace": "Hyprspace", "home-manager": "home-manager", "hyprland": "hyprland", "hyprland-plugins": "hyprland-plugins", diff --git a/flake.nix b/flake.nix index 10fd9bb..9dc2595 100644 --- a/flake.nix +++ b/flake.nix @@ -9,7 +9,7 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - hyprland = { + hyprland ={ url = "github:hyprwm/Hyprland"; # inputs.nixpkgs.follows = "nixpkgs"; }; @@ -17,11 +17,15 @@ url = "github:hyprwm/hyprland-plugins"; inputs.hyprland.follows = "hyprland"; }; - Hyprspace = { - url = "github:KZDKM/Hyprspace"; - inputs.hyprland.follows = "hyprland"; - }; + # Hyprspace = { + # url = "github:KZDKM/Hyprspace"; + # inputs.hyprland.follows = "hyprland"; + # }; + # nixvim = { + # url = "github:nix-community/nixvim/nixos-23.11"; + # inputs.nixpkgs.follows = "nixpkgs"; + # }; }; @@ -126,12 +130,16 @@ homeConfigurations = { "${user}@NxXPS" = let host = "NxXPS"; in home-manager.lib.homeManagerConfiguration { inherit pkgs; - modules = [ ./home.nix ]; + modules = [ + ./home.nix + ]; extraSpecialArgs = { inherit inputs system user host allowed secrets pkgs-unstable rice nvidia; }; }; "${user}@NxNORTH" = let host = "NxNORTH"; in home-manager.lib.homeManagerConfiguration { inherit pkgs; - modules = [ ./home.nix ]; + modules = [ + ./home.nix + ]; extraSpecialArgs = { inherit inputs system user host allowed secrets pkgs-unstable rice nvidia; }; }; }; diff --git a/home-modules/hyprland.nix b/home-modules/hyprland.nix index 856cf71..de1eaf1 100644 --- a/home-modules/hyprland.nix +++ b/home-modules/hyprland.nix @@ -58,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 = { @@ -349,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 '󰈹 '" @@ -759,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 { diff --git a/home-modules/nixvim.nix b/home-modules/nixvim.nix new file mode 100644 index 0000000..5aad9de --- /dev/null +++ b/home-modules/nixvim.nix @@ -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 = { + "" = { action = "find_files"; }; + "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 "" "" "") + (mkKeymap "n" "ff" "builtin.find_files") + ]; + }; +} +## vl clipboard? diff --git a/home-modules/nvim-lua/options.lua b/home-modules/nvim-lua/options.lua new file mode 100644 index 0000000..c7fa617 --- /dev/null +++ b/home-modules/nvim-lua/options.lua @@ -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' diff --git a/home-modules/nvim-lua/plugin/cmp.lua b/home-modules/nvim-lua/plugin/cmp.lua new file mode 100644 index 0000000..cf2b7a7 --- /dev/null +++ b/home-modules/nvim-lua/plugin/cmp.lua @@ -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 { + [''] = cmp.mapping.select_next_item(), + [''] = cmp.mapping.select_prev_item(), + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete {}, + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, + [''] = 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' }), + [''] = 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' }, + }, +} diff --git a/home-modules/nvim-lua/plugin/lsp.lua b/home-modules/nvim-lua/plugin/lsp.lua new file mode 100644 index 0000000..a65c1b2 --- /dev/null +++ b/home-modules/nvim-lua/plugin/lsp.lua @@ -0,0 +1,48 @@ +local on_attach = function(_, bufnr) + + local bufmap = function(keys, func) + vim.keymap.set('n', keys, func, { buffer = bufnr }) + end + + bufmap('r', vim.lsp.buf.rename) + bufmap('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('D', vim.lsp.buf.type_definition) + + bufmap('gr', require('telescope.builtin').lsp_references) + bufmap('s', require('telescope.builtin').lsp_document_symbols) + bufmap('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, +} diff --git a/home-modules/nvim-lua/plugin/other.lua b/home-modules/nvim-lua/plugin/other.lua new file mode 100644 index 0000000..34ff92e --- /dev/null +++ b/home-modules/nvim-lua/plugin/other.lua @@ -0,0 +1,11 @@ +-- Lualine +require("lualine").setup({ + icons_enabled = true, + theme = 'onedark', +}) + +-- Colorscheme +vim.cmd("colorscheme gruvbox") + +-- Comment +require("Comment").setup() diff --git a/home-modules/nvim-lua/plugin/telescope.lua b/home-modules/nvim-lua/plugin/telescope.lua new file mode 100644 index 0000000..cf06b27 --- /dev/null +++ b/home-modules/nvim-lua/plugin/telescope.lua @@ -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') diff --git a/home-modules/nvim-lua/plugin/treesitter.lua b/home-modules/nvim-lua/plugin/treesitter.lua new file mode 100644 index 0000000..2edb953 --- /dev/null +++ b/home-modules/nvim-lua/plugin/treesitter.lua @@ -0,0 +1,9 @@ +require('nvim-treesitter.configs').setup { + ensure_installed = {}, + + auto_install = false, + + highlight = { enable = true }, + + indent = { enable = true }, +} diff --git a/home-modules/nvim.nix b/home-modules/nvim.nix new file mode 100644 index 0000000..49f5256 --- /dev/null +++ b/home-modules/nvim.nix @@ -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} + # ''; + }; +} diff --git a/home-modules/waybar.nix b/home-modules/waybar.nix index 32be260..679b2ff 100644 --- a/home-modules/waybar.nix +++ b/home-modules/waybar.nix @@ -93,7 +93,8 @@ in active-only = false; }; "hyprland/window" = { - format = "${sep}{}"; + # format = "${sep}{}"; + format = "{}"; separate-outputs = true; }; "custom/cclock" = { @@ -124,8 +125,8 @@ in tooltip = false; format = "{icon}${sep}{capacity}%"; states = { - warning = 25; - critical = 10; + warning = 15; + critical = 5; }; format-icons = [ " " @@ -236,7 +237,18 @@ in #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) { }; } diff --git a/home.nix b/home.nix index 3c6c070..65a2c44 100644 --- a/home.nix +++ b/home.nix @@ -24,6 +24,8 @@ ./home-modules/kitty.nix ./home-modules/shell/fish.nix ./home-modules/shell/starship.nix + # ./home-modules/nixvim.nix + ./home-modules/nvim.nix ./home-modules/shell/yazi.nix ./home-modules/shell/zoxide.nix ./home-modules/shell/nh.nix @@ -70,6 +72,7 @@ nodejs gnumake + cmake speedtest-go