From 3f2b2f2a2063339faece0267f0cb5fc1e764868d Mon Sep 17 00:00:00 2001 From: Kalle Struik Date: Wed, 10 Jan 2024 11:54:07 +0100 Subject: [PATCH] Bunch of stuff --- eww/config/_variables.yuck | 3 + eww/config/bar.yuck | 87 +++++++ eww/config/eww.scss | 0 eww/config/eww.yuck | 2 + eww/default.nix | 15 ++ flake.lock | 293 +++++++++++++++++++-- flake.nix | 66 +++-- home-manager/kalle-pc/kalle.nix | 270 ++++++++++++++++++- hyprland/default.nix | 429 +++++++++++++++++++++++++++++++ hyprland/hyprpaper.nix | 59 +++++ nixos/kalle-pc/configuration.nix | 81 +++++- nvim/default.nix | 61 +++-- nvim/plugin/cmp.lua | 11 +- nvim/plugin/lsp.lua | 36 +++ nvim/plugin/telescope.lua | 13 + overlays/default.nix | 55 +++- 16 files changed, 1406 insertions(+), 75 deletions(-) create mode 100644 eww/config/_variables.yuck create mode 100644 eww/config/bar.yuck create mode 100644 eww/config/eww.scss create mode 100644 eww/config/eww.yuck create mode 100644 eww/default.nix create mode 100644 hyprland/default.nix create mode 100644 hyprland/hyprpaper.nix create mode 100644 nvim/plugin/telescope.lua diff --git a/eww/config/_variables.yuck b/eww/config/_variables.yuck new file mode 100644 index 0000000..34a5a59 --- /dev/null +++ b/eww/config/_variables.yuck @@ -0,0 +1,3 @@ +(defpoll time :interval "10s" "date '+%H:%M'") +(defpoll year :interval "10h" "date '+%Y'") +(defpoll date :interval "30m" "date '+%m-%d'") diff --git a/eww/config/bar.yuck b/eww/config/bar.yuck new file mode 100644 index 0000000..a6ab912 --- /dev/null +++ b/eww/config/bar.yuck @@ -0,0 +1,87 @@ +(defwidget notifications [] + (eventbox :class "notifications" + "" + ) +) + +(defwidget audio [] + (eventbox :class "audio" + :onclick "eww open --toggle audio" + "󰕾" + )) + +(defwidget clipboard [] + (eventbox :class "clipboard" + "󰅌" + ) +) + +(defwidget left [] + (box :class "left" + :space-evenly "false" + :halign "start" + :valign "center" + :orientation "h" + (notifications) + (audio) + (clipboard) + ) +) + +(defwidget workspace-indicator [] + ". . . . . . . . . ." +) + +(defwidget center [] + (box :class "center" + :space-evenly "false" + :halign "center" + :valign "center" + :orientation "h" + (workspace-indicator) + ) +) + +(defwidget time [] + (eventbox :class "time" + time + ) +) + +(defwidget date [] + (eventbox :class "date" + "${year}-${date}" + ) +) + +(defwidget right [] + (box :class "right" + :space-evenly "false" + :halign "end" + :valign "center" + :orientation "v" + (time) + (date) + ) +) + +(defwidget bar [] + (box :class "bar" + :orientation "h" + (left) + (center) + (right) + ) +) + +(defwindow bar + :monitor 2 + :geometry (geometry :x "0px" + :y "10px" + :width "1060px" + :height "48px" + :anchor "center top") + :stacking "fg" + :exclusive true + (bar) +) diff --git a/eww/config/eww.scss b/eww/config/eww.scss new file mode 100644 index 0000000..e69de29 diff --git a/eww/config/eww.yuck b/eww/config/eww.yuck new file mode 100644 index 0000000..2dd08c8 --- /dev/null +++ b/eww/config/eww.yuck @@ -0,0 +1,2 @@ +(include "_variables.yuck") +(include "bar.yuck") diff --git a/eww/default.nix b/eww/default.nix new file mode 100644 index 0000000..bc5df7d --- /dev/null +++ b/eww/default.nix @@ -0,0 +1,15 @@ +{ inputs +, lib +, config +, pkgs +, ... +}: + +{ + programs.eww = { + enable = true; + package = pkgs.eww-wayland; + + configDir = ./config; + }; +} diff --git a/flake.lock b/flake.lock index a148efa..593c204 100644 --- a/flake.lock +++ b/flake.lock @@ -1,5 +1,82 @@ { "nodes": { + "coq-8_18": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": [ + "vscoq", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1694096282, + "narHash": "sha256-WhiBs4nzPHQ0R24xAdM49kmxSCPOxiOVMA1iiMYunz4=", + "owner": "coq", + "repo": "coq", + "rev": "f022d5d194cb42c2321ea91cecbcce703a9bcad3", + "type": "github" + }, + "original": { + "owner": "coq", + "ref": "V8.18.0", + "repo": "coq", + "type": "github" + } + }, + "discord-screenaudio": { + "flake": false, + "locked": { + "lastModified": 1698432393, + "narHash": "sha256-pD3NtDRqpi3too7jKGvno9QkYN6pSbP/hycRqS2SwaE=", + "ref": "refs/heads/master", + "rev": "3f3f17949d13f479c2f21573d5471b5ecf33c633", + "revCount": 178, + "submodules": true, + "type": "git", + "url": "ssh://git@github.com/maltejur/discord-screenaudio?tag=v1.9.2" + }, + "original": { + "submodules": true, + "type": "git", + "url": "ssh://git@github.com/maltejur/discord-screenaudio?tag=v1.9.2" + } + }, + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1681202837, + "narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "cfacdce06f30d2b68473a46042957675eebb3401", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1689068808, + "narHash": "sha256-6ixXo3wt24N/melDWjq70UuHQLxGV8jZvooRanIHXw0=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "919d646de7be200f3bf08cb76ae1f09402b6f9b4", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "home-manager": { "inputs": { "nixpkgs": [ @@ -7,44 +84,119 @@ ] }, "locked": { - "lastModified": 1695108154, - "narHash": "sha256-gSg7UTVtls2yO9lKtP0yb66XBHT1Fx5qZSZbGMpSn2c=", + "lastModified": 1704309533, + "narHash": "sha256-n/krnzgnmYWdVoMv0MJfEMTOYCkoY13rCwKhQ4RVd2U=", "owner": "nix-community", "repo": "home-manager", - "rev": "07682fff75d41f18327a871088d20af2710d4744", + "rev": "992b38f29cd7e50d88a2ae069133750beda010a4", "type": "github" }, "original": { "owner": "nix-community", - "ref": "release-23.05", + "ref": "master", "repo": "home-manager", "type": "github" } }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "xdg-desktop-portal-hyprland", + "nixpkgs" + ], + "systems": [ + "xdg-desktop-portal-hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1691753796, + "narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=", + "owner": "hyprwm", + "repo": "hyprland-protocols", + "rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland-protocols", + "type": "github" + } + }, + "hyprlang": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, + "locked": { + "lastModified": 1704287638, + "narHash": "sha256-TuRXJGwtK440AXQNl5eiqmQqY4LZ/9+z/R7xC0ie3iA=", + "owner": "hyprwm", + "repo": "hyprlang", + "rev": "6624f2bb66d4d27975766e81f77174adbe58ec97", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprlang", + "type": "github" + } + }, "nixpkgs": { "locked": { - "lastModified": 1698562188, - "narHash": "sha256-9nkxGnA/T+jLhHAMFRW157Qi/zfbf5dF1q7HfKROl3o=", + "lastModified": 1703961334, + "narHash": "sha256-M1mV/Cq+pgjk0rt6VxoyyD+O8cOUiai8t9Q6Yyq4noY=", "owner": "nixos", "repo": "nixpkgs", - "rev": "3e10c80821dedb93592682379f476745f370a58e", + "rev": "b0d36bd0a420ecee3bc916c91886caca87c894e9", "type": "github" }, "original": { "owner": "nixos", - "ref": "nixos-23.05", + "ref": "nixos-unstable", "repo": "nixpkgs", "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1702645756, + "narHash": "sha256-qKI6OR3TYJYQB3Q8mAZ+DG4o/BR9ptcv9UnRV2hzljc=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "40c3c94c241286dd2243ea34d3aef8a488f9e4d0", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "plugin-harpoon1": { + "flake": false, + "locked": { + "lastModified": 1703631439, + "narHash": "sha256-SIqssvuNnkw1YbEEElLYCHmh9OLnoHzggXNIZMb3jYI=", + "owner": "ThePrimeagen", + "repo": "harpoon", + "rev": "ccae1b9bec717ae284906b0bf83d720e59d12b91", + "type": "github" + }, + "original": { + "owner": "ThePrimeagen", + "repo": "harpoon", + "type": "github" + } + }, "plugin-rainbow-delimiters-nvim": { "flake": false, "locked": { - "lastModified": 1698573782, - "narHash": "sha256-rJOWVz1cplThmx9HY7RqYSxUgKKq1yjzhS4Pb2ebFQ4=", + "lastModified": 1704196511, + "narHash": "sha256-sUB85XGP3XQvF3TcdLhKLCDoSTFOeOlUiptK9DjYYqE=", "owner": "HiPhish", "repo": "rainbow-delimiters.nvim", - "rev": "df8cdf68234fbf056202a9684931c3dfa89988c1", + "rev": "4a90ac83c7c8e0ba8a1b6af38bed6d5ee1b04e08", "type": "gitlab" }, "original": { @@ -56,11 +208,11 @@ "plugin-undotree-nvim": { "flake": false, "locked": { - "lastModified": 1695641489, - "narHash": "sha256-1d7OMaWsf0MW6w6Yzev9b3qF6Va4y8VNciSEdWq+VxY=", + "lastModified": 1703849391, + "narHash": "sha256-clxoKM5kusRz8OR5+Z+4NS0WsoMx9tdyi9GG+sE6r3s=", "owner": "jiaoshijie", "repo": "undotree", - "rev": "41f56b30cc774ad26c4945c7e10673453893e7ad", + "rev": "80552a0180b49e5ba072c89ae91ce5d4e3aed36b", "type": "github" }, "original": { @@ -69,12 +221,123 @@ "type": "github" } }, + "plugin-vscoq-nvim": { + "flake": false, + "locked": { + "lastModified": 1702025258, + "narHash": "sha256-0ozz2vxmuEym/pR6AftgIZBt4fT4qJxEpngtZXqXT30=", + "owner": "tomtomjhj", + "repo": "vscoq.nvim", + "rev": "0dee175a75153fc6057605c90749e0d6eb131cd4", + "type": "github" + }, + "original": { + "owner": "tomtomjhj", + "repo": "vscoq.nvim", + "type": "github" + } + }, "root": { "inputs": { + "discord-screenaudio": "discord-screenaudio", "home-manager": "home-manager", "nixpkgs": "nixpkgs", + "plugin-harpoon1": "plugin-harpoon1", "plugin-rainbow-delimiters-nvim": "plugin-rainbow-delimiters-nvim", - "plugin-undotree-nvim": "plugin-undotree-nvim" + "plugin-undotree-nvim": "plugin-undotree-nvim", + "plugin-vscoq-nvim": "plugin-vscoq-nvim", + "vscoq": "vscoq", + "xdg-desktop-portal-hyprland": "xdg-desktop-portal-hyprland" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1689347949, + "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "owner": "nix-systems", + "repo": "default-linux", + "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default-linux", + "type": "github" + } + }, + "vscoq": { + "inputs": { + "coq-8_18": "coq-8_18", + "flake-utils": "flake-utils_2", + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1701447720, + "narHash": "sha256-VXhHCP6Ni5/OcsgoI1EbJfYCpXzwkuR8kbbKrl6dfjU=", + "owner": "coq-community", + "repo": "vscoq", + "rev": "d4a702e676f2d17952e82df27962736d10810c37", + "type": "github" + }, + "original": { + "owner": "coq-community", + "repo": "vscoq", + "type": "github" + } + }, + "xdg-desktop-portal-hyprland": { + "inputs": { + "hyprland-protocols": "hyprland-protocols", + "hyprlang": "hyprlang", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_3" + }, + "locked": { + "lastModified": 1704308317, + "narHash": "sha256-/3IcC3oi0MPtC9OyE687HI/a7vat3m9Sx67I85tTcdI=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "bd110073cfe6ac3ce756c1577af78d672f89e853", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "type": "github" } } }, diff --git a/flake.nix b/flake.nix index 8715727..29b7a1c 100644 --- a/flake.nix +++ b/flake.nix @@ -3,12 +3,15 @@ inputs = { # Nixpkgs - nixpkgs.url = "github:nixos/nixpkgs/nixos-23.05"; + nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable"; # Home manager - home-manager.url = "github:nix-community/home-manager/release-23.05"; + home-manager.url = "github:nix-community/home-manager/master"; home-manager.inputs.nixpkgs.follows = "nixpkgs"; + # VS Coq language server + vscoq.url = "github:coq-community/vscoq"; + vscoq.inputs.nixpkgs.follows = "nixpkgs"; # Neovim plugins not in nixpkgs plugin-rainbow-delimiters-nvim.url = "gitlab:HiPhish/rainbow-delimiters.nvim"; @@ -16,30 +19,47 @@ plugin-undotree-nvim.url = "github:jiaoshijie/undotree"; plugin-undotree-nvim.flake = false; + + plugin-vscoq-nvim.url = "github:tomtomjhj/vscoq.nvim"; + plugin-vscoq-nvim.flake = false; + + plugin-harpoon1.url = "github:ThePrimeagen/harpoon"; + plugin-harpoon1.flake = false; + + # Discord screen audio + discord-screenaudio.url = "git+ssh://git@github.com/maltejur/discord-screenaudio?tag=v1.9.2&submodules=1"; + discord-screenaudio.flake = false; + + # Track hyprland xdg desktop portal master until screenshots get released again + xdg-desktop-portal-hyprland.url = "github:hyprwm/xdg-desktop-portal-hyprland"; + xdg-desktop-portal-hyprland.inputs.nixpkgs.follows = "nixpkgs"; + }; - outputs = { - self, - nixpkgs, - home-manager, - ... - } @ inputs : let - inherit (self) outputs; - in { - overlays = import ./overlays {inherit inputs;}; + outputs = + { self + , nixpkgs + , home-manager + , ... + } @ inputs: + let + inherit (self) outputs; + in + { + overlays = import ./overlays { inherit inputs; }; - nixosConfigurations = { - "kalle-pc" = nixpkgs.lib.nixosSystem { - specialArgs = {inherit inputs outputs;}; - modules = [ ./nixos/kalle-pc/configuration.nix ]; + nixosConfigurations = { + "kalle-pc" = nixpkgs.lib.nixosSystem { + specialArgs = { inherit inputs outputs; }; + modules = [ ./nixos/kalle-pc/configuration.nix ]; + }; + }; + homeConfigurations = { + "kalle@kalle-pc" = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + extraSpecialArgs = { inherit inputs outputs; }; + modules = [ ./home-manager/kalle-pc/kalle.nix ]; + }; }; }; - homeConfigurations = { - "kalle@kalle-pc" = home-manager.lib.homeManagerConfiguration { - pkgs = nixpkgs.legacyPackages.x86_64-linux; - extraSpecialArgs = {inherit inputs outputs;}; - modules = [ ./home-manager/kalle-pc/kalle.nix ]; - }; - }; - }; } diff --git a/home-manager/kalle-pc/kalle.nix b/home-manager/kalle-pc/kalle.nix index a3ec135..3d410f1 100644 --- a/home-manager/kalle-pc/kalle.nix +++ b/home-manager/kalle-pc/kalle.nix @@ -11,15 +11,223 @@ username = "kalle"; homeDirectory = "/home/kalle"; }; + imports = [ ../../nvim ../../eww + ../../hyprland + ../../hyprland/hyprpaper.nix ]; + hyprland = + let + mod = "SUPER"; in + { + mod = mod; + + primaryMonitor = "DP-2"; + + monitors = [ + { + name = "DP-2"; + width = 1920; + height = 1080; + refreshRate = 144; + x = 0; + y = 1080; + vrr = 1; + } + + { + name = "HDMI-A-1"; + width = 1920; + height = 1080; + x = 1500; + y = 0; + } + + { + name = "HDMI-A-2"; + width = 1920; + height = 1080; + x = 1920; + y = 1080; + transform = 3; + } + ]; + + autoStart = [ + # Bar + "${pkgs.dunst}/bin/dunst" + "${pkgs.firefox}/bin/firefox" + "${pkgs.discord}/bin/discord" + ]; + + environment = { + XCURSOR_SIZE = "24"; + QT_QPA_PLATFORMTHEME = "qt5ct"; + }; + + sensitivity = 0.1; + + keyboard = { + layout = "us"; + variant = ""; + options = ""; + }; + + inner_gaps = 5; + outer_gaps = 10; + + border = { + size = 1; + active = "rgba(33ccffee) rgba(00ff99ee) 45deg"; + inactive = "rgba(595959aa)"; + }; + + layout = "dwindle"; + + rounding = 5; + + layerRules = { + "gtk-layer-shell" = [ "blur" "ignorezero" ]; + }; + + windowRules = { + # Auto workspace + firefox = [ "workspace 1 silent" ]; + discord = [ "workspace name:HDMI-A-2" ]; + }; + + + windowRulesV2 = { + # ULauncher + "class:^(ulauncher)$" = [ + "forceinput" + "dimaround" + ]; + }; + + # Media keys + # bind = ,XF86AudioPlay, exec, playerctl --player plasma-browser-integration play-pause + # bind = ,XF86AudioPrev, exec, playerctl previous + # bind = ,XF86AudioNext, exec, playerctl next + # bind = ,XF86AudioLowerVolume, exec, playerctl --player plasma-browser-integration volume 0.01- + # bind = ,XF86AudioRaiseVolume, exec, playerctl --player plasma-browser-integration volume 0.01+ + + # This is a dumb work around for hyprland not passing ALT half the time with the pass dispatcher. + # bind = ALT, M, exec, xdotool key 'ALT+m' + # bind = ALT, B, exec, xdotool key 'ALT+b' + binds = { + "${mod}, return" = "exec, kitty"; + "${mod}, E" = "exec, ulauncher-toggle #wofi --show drun"; + "${mod}, Print" = "exec, bash -c \"grim -g \\\"$(slurp)\\\" - | wl-copy\""; + # Clipboard history + # bind = $mainMod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy + }; + + mouseBinds = { }; + }; + + hyprpaper = { + wallpaperFolder = "/home/kalle/Pictures/Wallpapers"; + }; + + services.dunst = { + enable = true; + settings = { + global = { + monitor = 0; + follow = "none"; + width = 300; + height = 300; + origin = "top-left"; + offset = "10x10"; + scale = 0; + notification_limit = 20; + progress_bar = true; + progress_bar_height = 10; + progress_bar_frame_width = 0; + progress_bar_min_width = 150; + progress_bar_max_width = 300; + progress_bar_corner_radius = 0; + icon_corner_radius = 0; + indicate_hidden = "yes"; + transparency = "0.3"; + separator_height = 2; + padding = 8; + horizontal_padding = 8; + text_icon_padding = 0; + frame_width = 0; + frame_color = "#aaaaaa"; + gap_size = 10; + separator_color = "frame"; + sort = "yes"; + font = "Monospace 8"; + line_height = 0; + markup = "full"; + format = "%s\n%b"; + alignment = "left"; + vertical_alignment = "center"; + show_age_threshold = 60; + ellipsize = "middle"; + ignore_newline = "no"; + stack_duplicates = true; + hide_duplicate_count = false; + show_indicators = "yes"; + enable_recursive_icon_lookup = true; + icon_theme = "Adwaita"; + icon_position = "left"; + min_icon_size = 32; + max_icon_size = 128; + icon_path = "/usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/"; + sticky_history = "yes"; + history_length = 20; + dmenu = "/usr/bin/dmenu -p dunst:"; + browser = "/usr/bin/xdg-open"; + always_run_script = true; + title = "Dunst"; + class = "Dunst"; + corner_radius = 0; + ignore_dbusclose = false; + force_xwayland = false; + force_xinerama = false; + mouse_left_click = "close_current"; + mouse_middle_click = "do_action, close_current"; + mouse_right_click = "close_all"; + }; + + experimental = { + per_monitor_dpi = false; + }; + + + urgency_low = { + background = "#222222"; + foreground = "#888888"; + timeout = 10; + }; + + urgency_normal = { + background = "#285577"; + foreground = "#ffffff"; + timeout = 10; + }; + + urgency_critical = { + background = "#900000"; + foreground = "#ffffff"; + frame_color = "#ff0000"; + timeout = 0; + }; + }; + }; + nixpkgs = { overlays = with outputs.overlays; [ nvim-plugins + discord-screenaudio ]; config = { @@ -32,20 +240,78 @@ # environment. home.packages = with pkgs; [ discord + # discord-screenaudio # Not working with some EGL error firefox + chromium httpie kate - kitty + dolphin + ark rustup + gcc prismlauncher + pavucontrol + coq_8_18 + difftastic + sops + + cachix ]; programs.home-manager.enable = true; - programs.bash.enable = true; + + programs.bash = { + enable = true; + shellAliases = { + # Git aliases + gg = "git log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n'' %C(white)%s%C(reset) %C(dim white)- %an (%ae)%C(reset)' --all"; + gca = "git add -A; git commit -a --amend --no-edit"; + gs = "git status"; + + # Replace some commands with better versions + ssh = "kitty +kitten ssh"; + diff = "${pkgs.difftastic}/bin/difftastic"; + }; + initExtra = '' + function open() { + xdg-open $@ &> /dev/null & + } + ''; + }; + + programs.kitty = { + enable = true; + theme = "Catppuccin-Mocha"; + settings = { + background_opacity = "0.8"; + allow_remote_control = true; + }; + }; + + programs.starship = { + enable = true; + settings = { + add_newline = true; + + # Remove text from nix shell component + nix_shell.format = "via [$symbol]($style) "; + + git_status.disabled = true; + package.disabled = true; + }; + }; + + programs.direnv = { + enable = true; + enableBashIntegration = true; + nix-direnv.enable = true; + }; + programs.git = { enable = true; userName = "Kalle Struik"; userEmail = "kalle@kallestruik.nl"; + difftastic.enable = true; extraConfig = { init.defaultBranch = "main"; }; diff --git a/hyprland/default.nix b/hyprland/default.nix new file mode 100644 index 0000000..222704f --- /dev/null +++ b/hyprland/default.nix @@ -0,0 +1,429 @@ +{ inputs +, lib +, config +, pkgs +, ... +}: + +{ + options = + let + inherit (lib) mkOption types; + in + { + hyprland = { + mod = mkOption { + type = types.str; + default = "SUPER"; + }; + + autoStart = mkOption { + type = types.listOf types.str; + default = [ ]; + }; + + primaryMonitor = mkOption { + type = types.str; + }; + + monitors = mkOption { + type = types.listOf (types.submodule { + options = { + name = mkOption { + type = types.str; + }; + width = mkOption { + type = types.int; + }; + height = mkOption { + type = types.int; + }; + refreshRate = mkOption { + type = types.int; + default = 60; + }; + x = mkOption { + type = types.int; + default = 0; + }; + y = mkOption { + type = types.int; + default = 0; + }; + transform = mkOption { + type = types.int; + default = 0; + }; + vrr = mkOption { + type = types.int; + default = 0; + }; + enabled = mkOption { + type = types.bool; + default = true; + }; + }; + }); + default = [ ]; + }; + + environment = mkOption { + type = types.attrsOf types.str; + default = { }; + }; + + sensitivity = mkOption { + type = types.float; + default = 0.0; + }; + + keyboard = { + layout = mkOption { + type = types.str; + default = "us"; + }; + + variant = mkOption { + type = types.str; + default = "qwerty"; + }; + + options = mkOption { + type = types.str; + default = ""; + }; + }; + + inner_gaps = mkOption { type = types.int; }; + + outer_gaps = mkOption { type = types.int; }; + + border = { + size = mkOption { type = types.int; }; + active = mkOption { type = types.str; }; + inactive = mkOption { type = types.str; }; + }; + + animations = { + enable = mkOption { + type = types.bool; + default = true; + }; + + beziers = mkOption { + type = types.listOf types.str; + default = [ + "myBezier, 0.05, 0.9, 0.1, 1.05" + ]; + }; + + windows = mkOption { + type = types.str; + default = "1, 3, myBezier"; + }; + + windowsOut = mkOption { + type = types.str; + default = "1, 3, default, popin 80%"; + }; + + border = mkOption { + type = types.str; + default = "1, 5, default"; + }; + + borderangle = mkOption { + type = types.str; + default = "1, 4, default"; + }; + + fade = mkOption { + type = types.str; + default = "1, 3, default"; + }; + + workspaces = mkOption { + type = types.str; + default = "1, 2, default"; + }; + }; + + layout = mkOption { type = types.str; }; + rounding = mkOption { type = types.int; }; + + blur = { + enable = mkOption { + type = types.bool; + default = true; + }; + + size = mkOption { + type = types.int; + default = 3; + }; + + passes = mkOption { + type = types.int; + default = 1; + }; + }; + + shadow = { + enable = mkOption { + type = types.bool; + default = true; + }; + + range = mkOption { + type = types.int; + default = 4; + }; + + strength = mkOption { + type = types.int; + default = 3; + }; + + color = mkOption { + type = types.str; + default = "rgba(1a1a1aee)"; + }; + }; + + layerRules = mkOption { + type = types.attrsOf (types.listOf types.str); + default = { }; + }; + + windowRules = mkOption { + type = types.attrsOf (types.listOf types.str); + default = { }; + }; + + windowRulesV2 = mkOption { + type = types.attrsOf (types.listOf types.str); + default = { }; + }; + + generateWorkspaceBinds = mkOption { + type = types.bool; + default = true; + }; + + generateWindowManagementBinds = mkOption { + type = types.bool; + default = true; + }; + + binds = mkOption { + type = types.attrsOf types.str; + default = { }; + }; + + mouseBinds = mkOption { + type = types.attrsOf types.str; + default = { }; + }; + }; + }; + + config = + let + cfg = config.hyprland; + in + { + home.packages = with pkgs; [ + wl-clipboard + cliphist + ulauncher + ]; + + wayland.windowManager.hyprland = { + enable = true; + settings = { + monitor = map + (m: + let + resolution = "${toString m.width}x${toString m.height}@${toString m.refreshRate}"; + position = "${toString m.x}x${toString m.y}"; + vrr = if m.vrr != 0 then ",vrr,${toString m.vrr}" else ""; + transform = if m.transform != 0 then ",transform,${toString m.transform}" else ""; + in + "${m.name},${if m.enabled then "${resolution},${position},1${vrr}${transform}" else "disable"}" + ) + (cfg.monitors) + # Automatically detect newly connected monitors + ++ [ ",preferred,auto,auto" ]; + + exec-once = [ + "${pkgs.wl-clipboard}/bin/wl-paste --watch ${pkgs.cliphist}/bin/cliphist store" + "${pkgs.ulauncher}/bin/ulauncher --no-window-shadow --hide-window" + "${pkgs.libsForQt5.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1" + # kde-connect (somehow, wasnt working well last time) + ] ++ cfg.autoStart; + + env = lib.mapAttrsToList (k: v: "${toString k},${v}") cfg.environment; + + input = { + kb_layout = cfg.keyboard.layout; + kb_variant = cfg.keyboard.variant; + kb_options = cfg.keyboard.options; + + follow_mouse = 1; + + touchpad = { + natural_scroll = "yes"; + }; + + sensitivity = cfg.sensitivity; + accel_profile = "flat"; + }; + + general = { + gaps_in = cfg.inner_gaps; + gaps_out = cfg.outer_gaps; + + border_size = cfg.border.size; + "col.active_border" = cfg.border.active; + "col.inactive_border" = cfg.border.inactive; + + layout = cfg.layout; + }; + + decoration = { + rounding = cfg.rounding; + + blur = { + enabled = if cfg.blur.enable then "yes" else "no"; + size = cfg.blur.size; + passes = cfg.blur.passes; + new_optimizations = "on"; + }; + + drop_shadow = if cfg.shadow.enable then "yes" else "no"; + shadow_range = cfg.shadow.range; + shadow_render_power = cfg.shadow.strength; + "col.shadow" = cfg.shadow.color; + }; + + dwindle = { + pseudotile = "yes"; + preserve_split = "yes"; + }; + + master = { + new_is_master = true; + }; + + gestures = { + workspace_swipe = "on"; + }; + + animations = { + enabled = if cfg.animations.enable then "yes" else "no"; + + # Some default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more + + bezier = cfg.animations.beziers; + + animation = [ + "windows, ${cfg.animations.windows}" + "windowsOut, ${cfg.animations.windowsOut}" + "border, ${cfg.animations.border}" + "borderangle, ${cfg.animations.borderangle}" + "fade, ${cfg.animations.fade}" + "workspaces, ${cfg.animations.workspaces}" + ]; + + }; + + layerrule = + let + y = ident: value: "${value},${ident}"; + x = ident: values: map (y ident) values; + in + lib.flatten (lib.mapAttrsToList x cfg.layerRules); + + workspace = + let + # Create one work space for each non primary monitor + perMonitorWorkspaces = map + (m: "${m.name}, name:${m.name}") + (lib.filter + (m: m.name != cfg.primaryMonitor) + cfg.monitors + ); + + # Create 10 work spaces on the primary monitor + primaryMonitorWorkspaces = map (i: "${toString i}, monitor:${cfg.primaryMonitor}") (lib.range 1 10); + + in + primaryMonitorWorkspaces ++ perMonitorWorkspaces; + + bind = + let + # Create binds to switch workspaces and move windows between them + workspaceBinds = + if cfg.generateWorkspaceBinds then + lib.flatten + (map + (i: + let + k = if i == 10 then 0 else i; + in + [ + "${cfg.mod}, ${toString k}, workspace, ${toString i}" + "${cfg.mod} SHIFT, ${toString k}, movetoworkspace, ${toString i}" + ] + ) + (lib.range 1 10) + ) + else + [ ]; + + # Create binds to manage wiwdows + windowManagementBinds = + if cfg.generateWindowManagementBinds then [ + "${cfg.mod} SHIFT, Q, killactive" + "${cfg.mod}, F, togglefloating" + "${cfg.mod} SHIFT, F, fullscreen" + ] + else + [ ]; + + configBinds = lib.mapAttrsToList (k: v: "${k}, ${v}") cfg.binds; + in + configBinds ++ workspaceBinds ++ windowManagementBinds; + + bindm = + let + windowManagementBinds = + if cfg.generateWindowManagementBinds then [ + "${cfg.mod}, mouse:272, movewindow" + "${cfg.mod}, mouse:273, resizewindow" + ] + else + [ ]; + + configBinds = lib.mapAttrsToList (k: v: "${k}, ${v}") cfg.mouseBinds; + + in + configBinds ++ windowManagementBinds; + + windowrule = + let + y = ident: value: "${value},${ident}"; + x = ident: values: map (y ident) values; + in + lib.flatten (lib.mapAttrsToList x cfg.windowRules); + + windowrulev2 = + let + y = ident: value: "${value},${ident}"; + x = ident: values: map (y ident) values; + in + lib.flatten (lib.mapAttrsToList x cfg.windowRulesV2); + }; + }; + }; +} diff --git a/hyprland/hyprpaper.nix b/hyprland/hyprpaper.nix new file mode 100644 index 0000000..fc49ece --- /dev/null +++ b/hyprland/hyprpaper.nix @@ -0,0 +1,59 @@ +{ inputs +, lib +, config +, pkgs +, ... +}: + +{ + options = + let + inherit (lib) mkOption types; + in + { + hyprpaper = { + wallpaperFolder = mkOption { + type = types.str; + }; + }; + }; + + config = + let + cfg = config.hyprpaper; + hyprlandCfg = config.hyprland; + + changeWallpaperScript = + pkgs.writeShellScriptBin + "change-wallpaper" + (lib.concatStringsSep + "\n" + (lib.flatten + (map + (m: + let + output = m.name; + wallpaper = "\"$(${pkgs.findutils}/bin/find -L \"${cfg.wallpaperFolder}\" -type f | ${pkgs.coreutils}/bin/shuf -n 1)\""; + in + [ + "wallpaper=${wallpaper}" + "${pkgs.hyprland}/bin/hyprctl hyprpaper preload $wallpaper" + "${pkgs.hyprland}/bin/hyprctl hyprpaper wallpaper ${output},$wallpaper" + ] + ) + hyprlandCfg.monitors) + ++ [ "${pkgs.hyprland}/bin/hyprctl hyprpaper unload all" ]) + ); + in + { + hyprland.autoStart = [ + "${pkgs.hyprpaper}/bin/hyprpaper" + "sleep 2; ${changeWallpaperScript}/bin/change-wallpaper" + ]; + + home.packages = with pkgs; [ + hyprpaper + changeWallpaperScript + ]; + }; +} diff --git a/nixos/kalle-pc/configuration.nix b/nixos/kalle-pc/configuration.nix index b23ae8e..ef6e211 100644 --- a/nixos/kalle-pc/configuration.nix +++ b/nixos/kalle-pc/configuration.nix @@ -1,8 +1,13 @@ -{ config, pkgs, ... }: +{ inputs +, config +, pkgs +, ... +}: { imports = - [ # Include the results of the hardware scan. + [ + # Include the results of the hardware scan. ./hardware-configuration.nix ./hardware-configuration.override.nix ]; @@ -30,23 +35,33 @@ # Select internationalisation properties. i18n.defaultLocale = "en_US.UTF-8"; + console = { font = "Lat2-Terminus16"; useXkbConfig = true; # use xkbOptions in tty. }; # Enable the X11 windowing system. - services.xserver.enable = true; + services.xserver = { + enable = true; + displayManager.sddm.enable = true; - # Enable the Plasma 5 Desktop Environment. - services.xserver.displayManager.sddm.enable = true; - services.xserver.desktopManager.plasma5.enable = true; - + # Configure keymap in X11 + layout = "us"; + # xkbVariant = "dvorak"; + # xkbOptions = "eurosign:e,caps:escape"; + }; - # Configure keymap in X11 - services.xserver.layout = "dvorak"; - services.xserver.xkbOptions = "eurosign:e,caps:escape"; + # Allow flashing ZSA keyboards + hardware.keyboard.zsa.enable = true; + + programs.hyprland = { + enable = true; + portalPackage = inputs.xdg-desktop-portal-hyprland.packages.x86_64-linux.xdg-desktop-portal-hyprland; + }; + + xdg.portal.extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; # Enable CUPS to print documents. services.printing.enable = true; @@ -71,10 +86,54 @@ environment.systemPackages = with pkgs; [ xdg-user-dirs + + grim # For xdg-desktop-portal-hyprland which does not declare this dependency + slurp # Some for this one + + qemu_full + gamescope ]; + fonts = { + enableDefaultPackages = true; + packages = with pkgs; [ + noto-fonts + noto-fonts-cjk + noto-fonts-color-emoji + + fira-code + fira-code-symbols + + (nerdfonts.override { fonts = [ "NerdFontsSymbolsOnly" ]; }) + ]; + + fontconfig = { + defaultFonts = { + serif = [ "Noto Serif" "Symbols Nerd Font" ]; + sansSerif = [ "Noto Sans" "Symbols Nerd Font" ]; + monospace = [ "Fira Code" "Symbols Nerd Font Mono" ]; + }; + }; + }; + # Steam needs to be installed on system level, because reasons - programs.steam.enable = true; + programs.steam = { + enable = true; + package = pkgs.steam.override { + extraPkgs = pkgs: with pkgs; [ + xorg.libXcursor + xorg.libXi + xorg.libXinerama + xorg.libXScrnSaver + libpng + libpulseaudio + libvorbis + stdenv.cc.cc.lib + libkrb5 + keyutils + ]; + }; + }; # Enable the OpenSSH daemon. services.openssh.enable = true; diff --git a/nvim/default.nix b/nvim/default.nix index 4958b84..c38a9dc 100644 --- a/nvim/default.nix +++ b/nvim/default.nix @@ -19,14 +19,22 @@ vimdiffAlias = true; extraPackages = with pkgs; [ + nodejs_21 # Required for copilot-vim + ripgrep # Required for telescope + wl-clipboard # Required for clipboard sync + + # Language servers + clang-tools lua-language-server rnix-lsp - - ripgrep - wl-clipboard + nodePackages.typescript-language-server + tailwindcss-language-server + inputs.vscoq.packages.x86_64-linux.vscoq-language-server ]; plugins = with pkgs.vimPlugins; [ + yuck-vim + { plugin = which-key-nvim; config = toLua "require('which-key').setup()"; @@ -35,14 +43,20 @@ neodev-nvim plenary-nvim - telescope-nvim + { + plugin = telescope-nvim; + config = toLuaFile ./plugin/telescope.lua; + } telescope-ui-select-nvim FTerm-nvim - neogit + { + plugin = neogit; + config = toLua "require('neogit').setup()"; + } - harpoon + harpoon1 { plugin = undotree-nvim; @@ -75,6 +89,7 @@ cmp-git cmp-calc cmp_luasnip + copilot-cmp luasnip friendly-snippets { @@ -96,23 +111,29 @@ rainbow-delimiters-nvim { - 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 - p.tree-sitter-yaml - p.tree-sitter-rust - p.tree-sitter-javascript - p.tree-sitter-typescript - p.tree-sitter-c - p.tree-sitter-cpp - ])); + plugin = (nvim-treesitter.withAllGrammars); config = toLuaFile ./plugin/treesitter.lua; } + { + plugin = Coqtail; + # Don't load Coqtail with neovim + config = '' + let g:loaded_coqtail = 1 + let g:coqtail#supported = 0 + ''; + } + vscoq-nvim + + { + plugin = copilot-lua; + config = toLua '' + require("copilot").setup({ + suggestion = { enabled = false }, + panel = { enabled = false }, + }) + ''; + } ]; extraLuaConfig = '' diff --git a/nvim/plugin/cmp.lua b/nvim/plugin/cmp.lua index 25a6012..0fa8876 100644 --- a/nvim/plugin/cmp.lua +++ b/nvim/plugin/cmp.lua @@ -1,6 +1,14 @@ local cmp = require 'cmp' local luasnip = require 'luasnip' +require("copilot_cmp").setup() + +local has_words_before = function() + if vim.api.nvim_buf_get_option(0, "buftype") == "prompt" then return false end + local line, col = unpack(vim.api.nvim_win_get_cursor(0)) + return col ~= 0 and vim.api.nvim_buf_get_text(0, line - 1, 0, line - 1, col, {})[1]:match("^%s*$") == nil +end + cmp.setup({ snippet = { expand = function(args) @@ -21,7 +29,7 @@ cmp.setup({ end end, { 'i', 's' }), [''] = cmp.mapping(function(fallback) - if cmp.visible() then + if cmp.visible() and has_words_before() then cmp.select_next_item() elseif luasnip.expand_or_jumpable() then luasnip.expand_or_jump() @@ -39,6 +47,7 @@ cmp.setup({ }) }), sources = cmp.config.sources({ + { name = "copilot", group_index = 2 }, { name = 'path' }, -- file paths { name = 'nvim_lsp' }, -- from language server { name = 'nvim_lsp_signature_help' }, -- display function signatures with current parameter emphasized diff --git a/nvim/plugin/lsp.lua b/nvim/plugin/lsp.lua index d69a896..e0ec259 100644 --- a/nvim/plugin/lsp.lua +++ b/nvim/plugin/lsp.lua @@ -67,6 +67,10 @@ vim.diagnostic.config({ }, }) +vim.cmd([[ +autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) +]]) + -- LSP Configuration local capabilities = vim.lsp.protocol.make_client_capabilities() @@ -101,6 +105,21 @@ require('lspconfig').rnix.setup { capabilities = capabilities, } +require('lspconfig').tsserver.setup { + on_attach = on_attach, + capabilities = capabilities, +} + +require('lspconfig').tailwindcss.setup { + on_attach = on_attach, + capabilities = capabilities, +} + +require('lspconfig').clangd.setup { + on_attach = on_attach, + capabilities = capabilities, +} + require('rust-tools').setup({ server = { on_attach = on_attach, @@ -113,3 +132,20 @@ require('rust-tools').setup({ } }, }) + +require 'vscoq'.setup { + -- Configuration for vscoq, used in both the client and the server. + -- See "configuration" in https://github.com/coq-community/vscoq/blob/main/client/package.json. + -- The following is an example. + vscoq = { + proof = { + mode = 1, -- automatic mode + }, + }, + + -- The configuration forwarded to `:help lspconfig-setup`. + -- The following is an example. + lsp = { + on_attach = on_attach, + }, +} diff --git a/nvim/plugin/telescope.lua b/nvim/plugin/telescope.lua new file mode 100644 index 0000000..4980c91 --- /dev/null +++ b/nvim/plugin/telescope.lua @@ -0,0 +1,13 @@ +require('telescope').setup { + defaults = { + mappings = { + i = { + [''] = false, + [''] = false, + }, + }, + }, +} + +require("telescope").load_extension("ui-select") +pcall(require('telescope').load_extension, 'fzf') diff --git a/overlays/default.nix b/overlays/default.nix index b4956f3..bcfb059 100644 --- a/overlays/default.nix +++ b/overlays/default.nix @@ -1,6 +1,5 @@ -{ - inputs, - ... +{ inputs +, ... }: { @@ -15,6 +14,56 @@ name = "undotree.nvim"; src = inputs.plugin-undotree-nvim; }; + + vscoq-nvim = prev.vimUtils.buildVimPlugin { + name = "vscoq.nvim"; + src = inputs.plugin-vscoq-nvim; + }; + + harpoon1 = prev.vimUtils.buildVimPlugin { + name = "harpoon"; + src = inputs.plugin-harpoon1; + }; }; }; + + discord-screenaudio = final: prev: { + discord-screenaudio = prev.stdenv.mkDerivation + rec { + pname = "discord-screenaudio"; + version = "1.9.1"; + + src = inputs.discord-screenaudio; + + nativeBuildInputs = with prev; [ + qt6.wrapQtAppsHook + cmake + pkg-config + qt6.qtbase + qt6.qtwebengine + ]; + + buildInputs = with prev; [ + pipewire + ]; + + preConfigure = '' + # version.cmake either uses git tags or a version.txt file to get app version. + # Since cmake can't access git tags, write the version to a version.txt ourselves. + echo "${version}" > version.txt + ''; + + passthru.updateScript = prev.nix-update-script { }; + + meta = { + description = "A custom discord client that supports streaming with audio on Linux"; + homepage = "https://github.com/maltejur/discord-screenaudio"; + downloadPage = "https://github.com/maltejur/discord-screenaudio/releases"; + changelog = "https://github.com/maltejur/discord-screenaudio/releases/tag/v${version}"; + # license = lib.licenses.gpl3Only; + # maintainers = with lib.maintainers; [ huantian ]; + # platforms = lib.platforms.linux; + }; + }; + }; }