From b406b8bbfad5885a16ef9790af006ae12c0db76b Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Wed, 3 Apr 2024 20:30:38 +0200 Subject: [PATCH 01/22] start refactoring --- common/hypridle.nix | 8 -- common/hyprland-vnc.nix | 115 -------------------- common/hyprland.nix | 13 +-- common/hyprlock.nix | 8 -- common/waybar-vnc.nix | 88 ---------------- common/waybar.nix | 4 +- common/wofi.nix | 7 +- flake.lock | 180 ++++++++++++++++++++++---------- flake.nix | 13 +-- hosts/default/configuration.nix | 17 +-- hosts/default/home.nix | 5 +- modules/hyprland.nix | 141 +++++++++++++++++++++++++ 12 files changed, 296 insertions(+), 303 deletions(-) delete mode 100644 common/hypridle.nix delete mode 100644 common/hyprland-vnc.nix delete mode 100644 common/hyprlock.nix delete mode 100644 common/waybar-vnc.nix create mode 100644 modules/hyprland.nix diff --git a/common/hypridle.nix b/common/hypridle.nix deleted file mode 100644 index 648f782..0000000 --- a/common/hypridle.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, pkgs, inputs, ... }: - -{ - services.hypridle = { - enable = true; - # TODO: find commands to turn on/off monitors - }; -} diff --git a/common/hyprland-vnc.nix b/common/hyprland-vnc.nix deleted file mode 100644 index 26afcbe..0000000 --- a/common/hyprland-vnc.nix +++ /dev/null @@ -1,115 +0,0 @@ -{ config, pkgs, inputs, ... }: - -{ - # these are necessary for the config to function correctly - imports = [ - ./kitty.nix - ./waybar-vnc.nix - ./wofi.nix - ]; - home.packages = with pkgs; [ - hyprland - - # I always want these with hyprland anyways - dunst - wl-clipboard - - slurp - grim - ]; - wayland.windowManager.hyprland = { - enable = true; - settings = { - monitor = [ - "DP-3,2560x1440@144,0x0,1" - "DP-2,disable" - ]; - windowrulev2 = [ - "opacity 0.8 0.8,class:^(kitty)$" - "stayfocused,class:^(wofi)$" - ]; - env = [ - "WLR_NO_HARDWARE_CURSORS,1" - ]; - exec-once = [ - "waybar" - "wayvnc --output=DP-3 0.0.0.0 5909" - "dunst" - "hyprctl dispatcher focusmonitor 1" - ]; - general = { - sensitivity = "1.2"; - gaps_in = "2"; - gaps_out = "3"; - border_size = "3"; - "col.active_border"="0xff950fad"; - "col.inactive_border"="0xff26052e"; - }; - decoration = { - rounding = "6"; - active_opacity = "1"; - inactive_opacity = "1"; - }; - workspace = [ - "HEADLESS-2,1" - ]; - animations = { - enabled = "1"; - animation = [ - "windows,1,2,default" - "border,1,10,default" - "fade,0,5,default" - "workspaces,1,4,default" - ]; - }; - "$mod" = "SUPER"; - bind = [ - "$mod,Return,exec,kitty" - "$mod,tab,cyclenext" - "SUPERSHIFT,Q,killactive" - "$mod,SPACE,exec,wofi-launch" - "$mod,P,exec,wofi-power" - "SUPERSHIFT,m,exit" - "$mod,H,movefocus,l" - "$mod,J,movefocus,u" - "$mod,K,movefocus,d" - "$mod,L,movefocus,r" - "SUPERSHIFT,H,movewindow,l" - "SUPERSHIFT,J,movewindow,u" - "SUPERSHIFT,K,movewindow,d" - "SUPERSHIFT,L,movewindow,r" - "$mod,F,togglefloating" - "$mod,X,togglespecialworkspace" - "SUPERSHIFT,X,movetoworkspace,special" - "$mod,Print,exec,grim - | wl-copy && notify-send 'Screenshot Copied to Clipboard'" - "SUPERSHIFT,S,exec,slurp | grim -g - /tmp/photo && wl-copy < /tmp/photo && notify-send 'Screenshot Copied to Clipboard'" - "$mod,f11,fullscreen,0" - ",XF86AudioLowerVolume,exec,wpctl set-volume @DEFAULT_SINK@ 1%-" - ",XF86AudioRaiseVolume,exec,wpctl set-volume @DEFAULT_SINK@ 1%+" - ",XF86AudioMute,exec,wpctl set-mute @DEFAULT_SINK@ toggle" - ",XF86AudioPlay,exec,playerctl play-pause" - ",XF86AudioPrev,exec,playerctl previous" - ",XF86AudioNext,exec,playerctl next" - ] - ++ ( - builtins.concatLists (builtins.genList ( - x: let - ws = let - c = (x+1); - in - builtins.toString (x); - in [ - "$mod,${ws},workspace,${ws}" - "ALT,${ws},movetoworkspace,${ws}" - ] - ) - 10) - ); - bindm = [ - "$mod,mouse:272,movewindow" - "$mod,mouse:273,resizewindow" - ]; - }; - }; - -} diff --git a/common/hyprland.nix b/common/hyprland.nix index 49638fe..fd1bebe 100644 --- a/common/hyprland.nix +++ b/common/hyprland.nix @@ -1,18 +1,16 @@ { config, pkgs, inputs, ... }: - +let + hyprland = inputs.hyprland.packages.${pkgs.system}.hyprland; +in { # these are necessary for the config to function correctly imports = [ ./kitty.nix ./waybar.nix ./wofi.nix - # ./hypridle.nix # TODO: find out why these bitches not work - # ./hyprlock.nix ./dunst.nix ]; home.packages = with pkgs; [ - hyprland - # I always want these with hyprland anyways libnotify # to enable the notify-send command wl-clipboard @@ -24,9 +22,13 @@ playerctl ]; + + xdg.portal.configPackages = [ hyprland ]; + services.playerctld.enable = true; wayland.windowManager.hyprland = { enable = true; + package = hyprland; settings = { monitor = [ "DP-3,2560x1440@360,2560x0,1" @@ -122,5 +124,4 @@ ]; }; }; - } diff --git a/common/hyprlock.nix b/common/hyprlock.nix deleted file mode 100644 index 076f805..0000000 --- a/common/hyprlock.nix +++ /dev/null @@ -1,8 +0,0 @@ -{ config, pkgs, inputs, ... }: - -{ - programs.hyprlock = { - enable = true; - # TODO: find commands to turn on/off monitors - }; -} diff --git a/common/waybar-vnc.nix b/common/waybar-vnc.nix deleted file mode 100644 index 78d4e40..0000000 --- a/common/waybar-vnc.nix +++ /dev/null @@ -1,88 +0,0 @@ -{ config, pkgs, inputs, ... }: - -{ - home.packages = with pkgs; [ - waybar - font-awesome - ]; - programs.waybar = { - enable = true; - settings = { - mainBar = { - layer = "top"; - position = "top"; - height = 28; - output = [ - "HEADLESS-2" - ]; - modules-left = [ "hyprland/workspaces" "tray" "custom/pronouns" "custom/spotify" ]; - modules-center = [ "hyprland/window" "clock" ]; - modules-right = [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "temperature" "custom/poweroff" ]; - "clock" = { - tooltip-format = "{:%Y %B}\n\n{calendar}"; - interval = 1; - format = "{:%H:%M:%S}"; - format-alt = ":%Y-%m-%d %H:%M:%S}"; - on-click-middle = "gnome-clocks"; - calendar = { - weeks-pos = "left"; - format = { - today = "{}"; - weeks = "{}"; - }; - }; - }; - "tray".spacing = 10; - "cpu" = { - format = "cpu: {usage}%"; - tooltip = false; - }; - "memory" = { - format = "mem: {}%"; - }; - "wireplumber" = { - format = "{volume}%"; - }; - "custom/vpn" = { - format = "VPN"; - exec = "echo '{\"class\": \"connected\"}'"; - exec-if = "test -d /proc/sys/net/ipv4/conf/tun0"; - return-type = "json"; - interval = 5; - }; - "temperature" = { - thermal-zone = 2; - hwmon-path = "/sys/class/hwmon/hwmon2/temp1_input"; - critical-threshold = 80; - format = "{temperatureC}°C {icon}"; - format-icons = ["" "" ""]; - }; - "custom/poweroff" = { - format = ""; - on-click = "wofi-power"; - on-click-right = "swaylock"; - }; - "network" = { - format-wifi = "{essid} ({signalStrength}%) 󰖩"; - format-ethernet = "{ipaddr}/{cidr} 󰛳"; - tooltip-format = "{ifname} via {gwaddr} 󰛳"; - format-linked = "{ifname} (No IP) 󰛳"; - format-disconnected = "Disconnected "; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - }; - "custom/pronouns" = { - format = "{}"; - exec = "${config.xdg.configHome}/waybar/pronouns"; - interval = 5; - }; - "hyprland/workspaces" = { - format = "{name}"; - on-click = "activate"; - sort-by = "id"; - }; - }; - }; - style = ../styles/waybar.css; - }; - -} diff --git a/common/waybar.nix b/common/waybar.nix index fc50528..4abf1c4 100644 --- a/common/waybar.nix +++ b/common/waybar.nix @@ -1,4 +1,4 @@ -{ config, pkgs, inputs, ... }: +{ config, pkgs, lib, ... }: { home.packages = with pkgs; [ @@ -6,7 +6,7 @@ font-awesome ]; programs.waybar = { - enable = true; + enable = lib.mkDefault true; settings = { mainBar = { layer = "top"; diff --git a/common/wofi.nix b/common/wofi.nix index afd3999..13b2458 100644 --- a/common/wofi.nix +++ b/common/wofi.nix @@ -10,21 +10,16 @@ '') (writeShellScriptBin "wofi-power" '' lock="Lock" - logout="Logout" poweroff="Poweroff" reboot="Reboot" sleep="Suspend" - selected_option=$(echo -e "$lock\n$logout\n$sleep\n$reboot\n$poweroff" | wofi --dmenu -i -p "Powermenu") + selected_option=$(echo -e "$lock\n$sleep\n$reboot\n$poweroff" | wofi --dmenu -i -p "Powermenu") if [ "$selected_option" == "$lock" ] then echo "lock" swaylock - elif [ "$selected_option" == "$logout" ] - then - echo "logout" - loginctl terminate-user `whoami` elif [ "$selected_option" == "$poweroff" ] then echo "poweroff" diff --git a/flake.lock b/flake.lock index 06146aa..43623ed 100644 --- a/flake.lock +++ b/flake.lock @@ -131,7 +131,7 @@ }, "flake-utils": { "inputs": { - "systems": "systems_4" + "systems": "systems_3" }, "locked": { "lastModified": 1701680307, @@ -149,7 +149,7 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems_5" + "systems": "systems_4" }, "locked": { "lastModified": 1710146030, @@ -228,41 +228,98 @@ "type": "github" } }, - "hypridle": { + "hyprcursor": { "inputs": { "hyprlang": "hyprlang", "nixpkgs": [ + "hyprland", "nixpkgs" ], - "systems": "systems" + "systems": [ + "hyprland", + "systems" + ] }, "locked": { - "lastModified": 1710180874, - "narHash": "sha256-ZSn3wXQuRz36Ta/L+UCFKuUVG6QpwK2QmRkPjpQprU4=", + "lastModified": 1711466786, + "narHash": "sha256-sArxGyUBiCA1in+q6t0QqT+ZJiZ1PyBp7cNPKLmREM0=", "owner": "hyprwm", - "repo": "hypridle", - "rev": "4395339a2dc410bcf49f3e24f9ed3024fdb25b0a", + "repo": "hyprcursor", + "rev": "d3876f34779cc03ee51e4aafc0d00a4f187c7544", "type": "github" }, "original": { "owner": "hyprwm", - "repo": "hypridle", + "repo": "hyprcursor", + "type": "github" + } + }, + "hyprland": { + "inputs": { + "hyprcursor": "hyprcursor", + "hyprland-protocols": "hyprland-protocols", + "hyprlang": "hyprlang_2", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_2", + "wlroots": "wlroots", + "xdph": "xdph" + }, + "locked": { + "lastModified": 1712160491, + "narHash": "sha256-OQmbZnMPex/66HmyD7SKN5eKcyLR6ZCzHn/i/YF61qE=", + "owner": "hyprwm", + "repo": "hyprland", + "rev": "93915502d2677b70382b7cba09620b445f6b832e", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprland", + "type": "github" + } + }, + "hyprland-protocols": { + "inputs": { + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "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": [ - "hypridle", + "hyprland", + "hyprcursor", "nixpkgs" - ] + ], + "systems": "systems" }, "locked": { - "lastModified": 1708212860, - "narHash": "sha256-nW3Zrhh9RJcMTvOcXAaKADnJM/g6tDf3121lJtTHnYo=", + "lastModified": 1709914708, + "narHash": "sha256-bR4o3mynoTa1Wi4ZTjbnsZ6iqVcPGriXp56bZh5UFTk=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "11d5ccda071c153dfdc18ef65338956a51cef96a", + "rev": "a685493fdbeec01ca8ccdf1f3655c044a8ce2fe2", "type": "github" }, "original": { @@ -274,10 +331,13 @@ "hyprlang_2": { "inputs": { "nixpkgs": [ - "hyprlock", + "hyprland", "nixpkgs" ], - "systems": "systems_2" + "systems": [ + "hyprland", + "systems" + ] }, "locked": { "lastModified": 1711250455, @@ -293,28 +353,6 @@ "type": "github" } }, - "hyprlock": { - "inputs": { - "hyprlang": "hyprlang_2", - "nixpkgs": [ - "nixpkgs" - ], - "systems": "systems_3" - }, - "locked": { - "lastModified": 1711884603, - "narHash": "sha256-y1Om75muuJcEoLd/FOYGIZ5/ja/Mc4iBX/9S7vWF0C8=", - "owner": "hyprwm", - "repo": "hyprlock", - "rev": "071ebcefb9070e4397d75103f5f535b58dacf250", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprlock", - "type": "github" - } - }, "nix-colors": { "inputs": { "base16-schemes": "base16-schemes", @@ -445,8 +483,7 @@ "automapaper": "automapaper", "disko": "disko", "home-manager": "home-manager", - "hypridle": "hypridle", - "hyprlock": "hyprlock", + "hyprland": "hyprland", "nix-colors": "nix-colors", "nixpkgs": "nixpkgs", "nixvim": "nixvim" @@ -484,16 +521,16 @@ }, "systems_3": { "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default-linux", + "repo": "default", "type": "github" } }, @@ -512,18 +549,55 @@ "type": "github" } }, - "systems_5": { + "wlroots": { + "flake": false, "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "host": "gitlab.freedesktop.org", + "lastModified": 1709983277, + "narHash": "sha256-wXWIJLd4F2JZeMaihWVDW/yYXCLEC8OpeNJZg9a9ly8=", + "owner": "wlroots", + "repo": "wlroots", + "rev": "50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b", + "type": "gitlab" + }, + "original": { + "host": "gitlab.freedesktop.org", + "owner": "wlroots", + "repo": "wlroots", + "rev": "50eae512d9cecbf0b3b1898bb1f0b40fa05fe19b", + "type": "gitlab" + } + }, + "xdph": { + "inputs": { + "hyprland-protocols": [ + "hyprland", + "hyprland-protocols" + ], + "hyprlang": [ + "hyprland", + "hyprlang" + ], + "nixpkgs": [ + "hyprland", + "nixpkgs" + ], + "systems": [ + "hyprland", + "systems" + ] + }, + "locked": { + "lastModified": 1709299639, + "narHash": "sha256-jYqJM5khksLIbqSxCLUUcqEgI+O2LdlSlcMEBs39CAU=", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", + "rev": "2d2fb547178ec025da643db57d40a971507b82fe", "type": "github" }, "original": { - "owner": "nix-systems", - "repo": "default", + "owner": "hyprwm", + "repo": "xdg-desktop-portal-hyprland", "type": "github" } } diff --git a/flake.nix b/flake.nix index e10e03d..5a7c802 100644 --- a/flake.nix +++ b/flake.nix @@ -25,14 +25,9 @@ inputs.nixpkgs.follows = "nixpkgs"; }; - hypridle = { - url = "github:hyprwm/hypridle"; - inputs.nixpkgs.follows = "nixpkgs"; - }; - - hyprlock = { - url = "github:hyprwm/hyprlock"; - inputs.nixpkgs.follows = "nixpkgs"; + hyprland = { + url = "github:hyprwm/hyprland"; + inputs.nixpkgs.follows = "nixpkgs"; }; disko = { @@ -42,7 +37,7 @@ }; - outputs = { self, nixpkgs, nix-colors, automapaper, disko, home-manager, ... }@inputs: + outputs = { self, nixpkgs, nix-colors, automapaper, disko, home-manager, hyprland, ... }@inputs: { nixosConfigurations = { default = nixpkgs.lib.nixosSystem { diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index 8648b59..000e77d 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -62,17 +62,22 @@ }; services.xserver = { - enable = true; - displayManager = { - sddm.enable = true; - defaultSession = "hyprland"; - }; xkb = { layout = "us"; variant = "intl"; }; }; + services.greetd = { + enable = true; + settings = rec { + initial_session = { + command = "${pkgs.hyprland}/bin/Hyprland"; + user = "noa"; + }; + default_session = initial_session; + }; + }; # Configure console keymap console.keyMap = "us-acentos"; @@ -108,7 +113,6 @@ # List packages installed in system profile. To search, run: # $ nix search wget environment.systemPackages = with pkgs; [ - sddm git zsh ]; @@ -135,6 +139,7 @@ programs.hyprland = { enable = true; + package = inputs.hyprland.packages.${pkgs.system}.hyprland; portalPackage = pkgs.xdg-desktop-portal-hyprland; }; diff --git a/hosts/default/home.nix b/hosts/default/home.nix index 40b8b52..f98be27 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -5,7 +5,7 @@ [ inputs.nixvim.homeManagerModules.nixvim ../../common/zsh.nix - ../../common/hyprland.nix + ../../modules/hyprland.nix ../../common/git.nix ../../common/nvim/nvim.nix ../../common/discord/discord.nix @@ -29,6 +29,8 @@ nixpkgs.config.allowUnfree = true; + modules.hyprland.enable = true; + # The home.packages option allows you to install Nix packages into your # environment. home.packages = with pkgs; [ @@ -107,7 +109,6 @@ xdg.portal = { enable = true; extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; - configPackages = [ pkgs.hyprland ]; }; dconf = { diff --git a/modules/hyprland.nix b/modules/hyprland.nix new file mode 100644 index 0000000..310a8c9 --- /dev/null +++ b/modules/hyprland.nix @@ -0,0 +1,141 @@ +{ config, lib, pkgs, inputs, ... }: +let + hyprland = inputs.hyprland.packages.${pkgs.system}.hyprland; + cfg = config.modules.hyprland; +in +{ + options = { + cfg.enable = lib.mkEnableOption "enable hyprland"; + # TODO: make custom terminal support work better + # cfg.terminal = lib.mkOption { + # type = lib.types.package; + # default = pkgs.kitty; + # description = "What terminal emulator should be used in hyprland"; + # }; + }; + + config = lib.mkIf cfg.enable { + # these are necessary for the config to function correctly + imports = [ + ./kitty.nix + ./waybar.nix + ./wofi.nix + ./dunst.nix + ]; + home.packages = with pkgs; [ + # I always want these with hyprland anyways + libnotify # to enable the notify-send command + wl-clipboard + + slurp + grim + + hypridle # TODO: remove when fixed with config + playerctl + ]; + + programs.waybar.enable = true; + + xdg.portal.configPackages = [ hyprland ]; + + services.playerctld.enable = true; + wayland.windowManager.hyprland = { + enable = true; + package = hyprland; + settings = { + monitor = [ + "DP-3,2560x1440@360,2560x0,1" + "DP-2,2560x1440@144,0x0,1" + ]; + windowrulev2 = [ + "opacity 1.0 0.6,class:^(kitty)$" + "stayfocused,class:^(wofi)$" + ]; + env = [ + "WLR_NO_HARDWARE_CURSORS,1" + ]; + exec-once = [ + "waybar" + "dunst" + "automapaper -C ${config.xdg.configHome}/automapaper/config.toml" + "automapaper -C ${config.xdg.configHome}/automapaper/config2nd.toml" + "hyprctl dispatcher focusmonitor 1" + "hypridle" + ]; + general = { + sensitivity = "1.2"; + gaps_in = "2"; + gaps_out = "3"; + border_size = "3"; + "col.active_border"="0xff950fad"; + "col.inactive_border"="0xff26052e"; + }; + misc = { + key_press_enables_dpms = true; + }; + decoration = { + rounding = "6"; + active_opacity = "1"; + inactive_opacity = "1"; + }; + workspace = [ + "DP-3,1" + "DP-2,2" + ]; + animations = { + enabled = "1"; + animation = [ + "windows,1,2,default" + "border,1,10,default" + "fade,0,5,default" + "workspaces,1,4,default" + ]; + }; + "$mod" = "SUPER"; + bind = [ + "$mod,Return,exec,${pkgs.kitty.pname}" + "$mod,tab,cyclenext" + "SUPERSHIFT,Q,killactive" + "$mod,SPACE,exec,wofi-launch" + "$mod,P,exec,wofi-power" + "SUPERSHIFT,m,exit" + "$mod,H,movefocus,l" + "$mod,J,movefocus,u" + "$mod,K,movefocus,d" + "$mod,L,movefocus,r" + "SUPERSHIFT,H,movewindow,l" + "SUPERSHIFT,J,movewindow,u" + "SUPERSHIFT,K,movewindow,d" + "SUPERSHIFT,L,movewindow,r" + "$mod,F,togglefloating" + "$mod,X,togglespecialworkspace" + "SUPERSHIFT,X,movetoworkspace,special" + "$mod,Print,exec,grim - | wl-copy && notify-send 'Screenshot Copied to Clipboard'" + "SUPERSHIFT,S,exec,slurp | grim -g - /tmp/photo && wl-copy < /tmp/photo && notify-send 'Screenshot Copied to Clipboard'" + "$mod,f11,fullscreen,0" + ",XF86AudioLowerVolume,exec,wpctl set-volume @DEFAULT_SINK@ 1%-" + ",XF86AudioRaiseVolume,exec,wpctl set-volume @DEFAULT_SINK@ 1%+" + ",XF86AudioMute,exec,wpctl set-mute @DEFAULT_SINK@ toggle" + ",XF86AudioPlay,exec,playerctl play-pause" + ",XF86AudioPrev,exec,playerctl previous" + ",XF86AudioNext,exec,playerctl next" + ] + ++ ( + builtins.concatLists (builtins.genList ( + x: let + ws = builtins.toString (x); + in [ + "$mod,${ws},workspace,${ws}" + "ALT,${ws},movetoworkspace,${ws}" + ] + ) + 10) + ); + bindm = [ + "$mod,mouse:272,movewindow" + "$mod,mouse:273,resizewindow" + ]; + }; + }; + }; +} From 2343d3f309e156f28202cc450fc2a0c2adf7cf27 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Wed, 3 Apr 2024 21:25:04 +0200 Subject: [PATCH 02/22] modularize hyprland --- common/dunst.nix | 1 - modules/dunst.nix | 14 ++ modules/hyprland.nix | 44 +++-- modules/waybar.nix | 431 +++++++++++++++++++++++++++++++++++++++++++ modules/wofi.nix | 126 +++++++++++++ 5 files changed, 596 insertions(+), 20 deletions(-) create mode 100644 modules/dunst.nix create mode 100644 modules/waybar.nix create mode 100644 modules/wofi.nix diff --git a/common/dunst.nix b/common/dunst.nix index 818061d..05fe9fe 100644 --- a/common/dunst.nix +++ b/common/dunst.nix @@ -3,6 +3,5 @@ { services.dunst = { enable = true; - }; } diff --git a/modules/dunst.nix b/modules/dunst.nix new file mode 100644 index 0000000..052f450 --- /dev/null +++ b/modules/dunst.nix @@ -0,0 +1,14 @@ +{ config, lib, pkgs, inputs, ... }: +let + cfg = config.modules.dunst; +in +{ + options.modules.dunst = { + enable = lib.mkEnableOption "enable dunst for notifications"; + }; + config = lib.mkIf cfg.enable { + services.dunst = { + enable = true; + }; + }; +} diff --git a/modules/hyprland.nix b/modules/hyprland.nix index 310a8c9..0d18fe7 100644 --- a/modules/hyprland.nix +++ b/modules/hyprland.nix @@ -1,27 +1,34 @@ { config, lib, pkgs, inputs, ... }: let - hyprland = inputs.hyprland.packages.${pkgs.system}.hyprland; cfg = config.modules.hyprland; in { - options = { - cfg.enable = lib.mkEnableOption "enable hyprland"; - # TODO: make custom terminal support work better - # cfg.terminal = lib.mkOption { - # type = lib.types.package; - # default = pkgs.kitty; - # description = "What terminal emulator should be used in hyprland"; - # }; + options.modules.hyprland = { + enable = lib.mkEnableOption "enable hyprland"; + package = lib.mkOption { + type = lib.types.package; + default = pkgs.hyprland; + example = lib.literalExpression ''inputs.hyprland.packages.${pkgs.system}.hyprland''; + }; + terminal = lib.mkOption { + type = lib.types.package; + default = pkgs.kitty; + description = "What terminal emulator should be used in hyprland"; + }; }; + imports = [ + ./waybar.nix + ./wofi.nix + ./dunst.nix + ]; config = lib.mkIf cfg.enable { + modules = { + waybar.enable = lib.mkDefault true; + wofi.enable = lib.mkDefault true; + dunst.enable = lib.mkDefault true; + }; # these are necessary for the config to function correctly - imports = [ - ./kitty.nix - ./waybar.nix - ./wofi.nix - ./dunst.nix - ]; home.packages = with pkgs; [ # I always want these with hyprland anyways libnotify # to enable the notify-send command @@ -34,14 +41,13 @@ in playerctl ]; - programs.waybar.enable = true; - xdg.portal.configPackages = [ hyprland ]; + xdg.portal.configPackages = [ cfg.package ]; services.playerctld.enable = true; wayland.windowManager.hyprland = { enable = true; - package = hyprland; + package = cfg.package; settings = { monitor = [ "DP-3,2560x1440@360,2560x0,1" @@ -93,7 +99,7 @@ in }; "$mod" = "SUPER"; bind = [ - "$mod,Return,exec,${pkgs.kitty.pname}" + "$mod,Return,exec,${cfg.terminal.pname}" "$mod,tab,cyclenext" "SUPERSHIFT,Q,killactive" "$mod,SPACE,exec,wofi-launch" diff --git a/modules/waybar.nix b/modules/waybar.nix new file mode 100644 index 0000000..cb91d7c --- /dev/null +++ b/modules/waybar.nix @@ -0,0 +1,431 @@ +{ config, pkgs, lib, ... }: +let + cfg = config.modules.waybar; +in +{ + options.modules.waybar = { + enable = lib.mkEnableOption "enable waybar"; + package = lib.mkOption { + type = lib.types.package; + default = pkgs.waybar; + }; + }; + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + font-awesome + ]; + programs.waybar = { + enable = true; + package = cfg.package; + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 39; + margin-top = 8; + margin-left = 10; + margin-right = 10; + output = [ + "DP-3" + "DP-2" + ]; + modules-left = [ "hyprland/workspaces" "tray" "custom/pronouns" "hyprland/window" ]; + modules-center = [ "clock" ]; + modules-right = [ "custom/vpn" "wireplumber" "battery" "network" "cpu" "memory" "temperature" "custom/poweroff" ]; + "clock" = { + tooltip-format = "{:%Y %B}\n\n{calendar}"; + interval = 1; + format = "{:%H:%M:%S}"; + format-alt = ":%Y-%m-%d %H:%M:%S}"; + on-click-middle = "gnome-clocks"; + calendar = { + weeks-pos = "left"; + format = { + today = "{}"; # TODO: use nix-colors + weeks = "{}"; # TODO: use nix-colors + }; + }; + }; + "tray".spacing = 10; + "cpu" = { + format = "cpu: {usage}%"; + tooltip = false; + }; + "memory" = { + format = "mem: {}%"; + tooltip = false; + }; + "wireplumber" = { + format = "{volume}% {icon}"; + format-muted = ""; + on-click = "helvum"; + format-icons = ["" "" ""]; + }; + "custom/vpn" = { + format = "VPN"; + exec = "echo '{\"class\": \"connected\"}'"; + exec-if = "test -d /proc/sys/net/ipv4/conf/tun0"; + return-type = "json"; + interval = 5; + }; + "temperature" = { + thermal-zone = 2; + hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input"; + critical-threshold = 80; + format = "{temperatureC}°C {icon}"; + format-icons = ["" "" ""]; + }; + "custom/poweroff" = { + format = ""; + on-click = "wofi-power"; + on-click-right = "swaylock"; + }; + "battery" = { + bat = "hidpp_battery_2"; + states = { + full = 100; + good = 50; + warning = 30; + critical = 30; + }; + format = "mouse: {capacity}% {icon}"; + format-charging = "mouse: {capacity}% {icon}"; + format-plugged = "mouse: {capacity}% {icon}"; + format-alt = "mouse: {time} {icon}"; + interval = 1; + format-icons = [ + "󰂎" + "󰁻" + "󰁾" + "󰂀" + "󰁹" + ]; + }; + "hyprland/window" = { + max-length = 36; + }; + "network" = { + format-wifi = "{essid} ({signalStrength}%) 󰖩"; + format-ethernet = "{ipaddr}/{cidr} 󰛳"; + tooltip-format = "{ifname} via {gwaddr} 󰛳"; + format-linked = "{ifname} (No IP) 󰛳"; + format-disconnected = "Disconnected "; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + }; + "custom/pronouns" = { + format = "{}"; + # exec = "${config.xdg.configHome}/waybar/pronouns"; # TODO: install pronouns + interval = 5; + }; + "hyprland/workspaces" = { + format = "{name}"; + on-click = "activate"; + sort-by = "id"; + }; + }; + }; + style = '' + * { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: "Maple Mono NF"; + font-size: 14px; + } + + window#waybar { + background-color: transparent; + + border-radius: 999px; + color: #${config.colorScheme.palette.text}; + transition-property: background-color; + transition-duration: .5s; + } + window#waybar.hidden { + opacity: 0.2; + } + + window#waybar.termite { + background-color: transparent; + } + + window#waybar.chromium { + background-color: transparent; + } + + button { + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -1px transparent; + /* Avoid rounded borders under each button name */ + border: none; + border-radius: 0; + } + + /* https://githbackground: #000000ub.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ + button:hover { + background: inherit; + border-radius: 999px; + } + + #workspaces button { + transition: all 0.2s; + padding: 3px 3px 3px 5px; + margin: 3px; + min-width: 15px; + min-height: 15px; + background-color: transparent; + color: #${config.colorScheme.palette.textMuted}; + border-radius: 999px; + } + + #workspaces button:hover { + background-color: #${config.colorScheme.palette.highlight}; + } + + #workspaces button.active { + color: #${config.colorScheme.palette.text}; + font-weight: bold; + background-color: #${config.colorScheme.palette.highlight}; + } + + #workspaces button.urgent { + background-color: #${config.colorScheme.palette.danger}; + } + + #clock, + #battery, + #cpu, + #memory, + #disk, + #temperature, + #backlight, + #network, + #pulseaudio, + #wireplumber, + #custom-media, + #mode, + #idle_inhibitor, + #custom-vpn, + #scratchpad, + #tray, + #custom-updates, + #custom-poweroff, + #mpd { + color: #${config.colorScheme.palette.textMuted}; + margin: 0px 2px; + padding: 0 15px; + + border-radius: 999px; + box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.backgroundMuted}; + } + + .modules-right > widget:last-child > #battery { + margin-right: 0px; + } + + #tray { + padding: 4px 10px; + border-radius: 999px 999px 999px 999px; + box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.backgroundMuted}; + } + + #window { + margin-left: 6px; + color: #${config.colorScheme.palette.textMuted}; + } + + #workspaces { + margin: 0 4px; + padding: 4px 4px; + border-radius: 999px; + box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.backgroundMuted}; + } + + #cpu { + border-radius: 999px 0px 0px 999px; + margin-right: 0px; + } + + #memory { + border-radius: 0px; + padding: 0 10px; + margin: 0px; + box-shadow: inset 0px 2px 0 -1px #${config.colorScheme.palette.backgroundMuted}, + inset 0px -2px 0 -1px #${config.colorScheme.palette.backgroundMuted}; + } + + #clock { + box-shadow: none; + } + + + #battery { + min-width: 50px; + border-radius: 999px; + box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.backgroundMuted}; + background-color: #${config.colorScheme.palette.backgroundMuted}; + transition: all 0.3s; + } + + #battery.charging, #battery.plugged { + color: #${config.colorScheme.palette.succes}; + background-color: transparent; + animation: batteryCharging 1.2s linear 0s infinite normal forwards, + } + #battery.full { + animation: batteryFull 7.0s linear 0s infinite normal forwards; + } + #battery.critical:not(.charging) { + background-color: #${config.colorScheme.palette.background}; + animation: batteryCritical 1.2s linear 0s infinite normal forwards; + } + + #network { + + } + + #network.disconnected, + #pulseaudio.muted { + transition: all 0.2s; + color: #${config.colorScheme.palette.backgroundMuted}; + } + + .custom-spotify { + color: #${config.colorScheme.palette.spotifyGreen}; + margin-right: 10px; + } + + #temperature { + margin-left: 0px; + border-radius: 0px 999px 999px 0px; + } + + #temperature.critical { + background-color: transparent; + color: #${config.colorScheme.palette.danger}; + } + + #tray { + background-color: transparent; + } + + + #tray > .passive { + -gtk-icon-effect: dim; + } + + #tray > .needs-attention { + background-color: #${config.colorScheme.palette.danger}; + border-radius: 999px; + } + + #scratchpad { + background: rgba(0, 0, 0, 0.1); + } + #scratchpad.empty { + background-color: transparent; + } + + #custom-updates { + box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.backgroundMuted}; + color: #${config.colorScheme.palette.textMuted}; + transition: all 0.5s; + } + + #custom-updates.pending { + box-shadow: inset 0 0 0 2px #${config.colorScheme.palette.highlight}; + color: #${config.colorScheme.palette.highlight}; + font-weight: bold; + transition: all 0.5s; + } + + tooltip { + background-color: #${config.colorScheme.palette.background}; + border: 1px solid; + border-color: #${config.colorScheme.palette.border}; + border-radius: 10px; + color: #${config.colorScheme.palette.text}; + } + tooltip label { + padding: 5px; + } + + /* Keyframes ---------------------------------------------------------------- */ + + @keyframes batteryCritical { + 0% { + box-shadow: inset 0px 20px 8px -16px #${config.colorScheme.palette.danger}, + inset 0px -20px 8px -16px #${config.colorScheme.palette.danger}; + color: #${config.colorScheme.palette.danger}; + } + 50% { + box-shadow: inset 0px 12px 8px -16px #${config.colorScheme.palette.danger}, + inset 0px -12px 8px -16px #${config.colorScheme.palette.danger}; + color: #${config.colorScheme.palette.textMuted}; + } + 100% { + box-shadow: inset 0px 20px 8px -16px #${config.colorScheme.palette.danger}, + inset 0px -20px 8px -16px #${config.colorScheme.palette.danger}; + color: #${config.colorScheme.palette.danger}; + } + } + + @keyframes batteryCharging { + 0% { + box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, + inset 0px 20px 8px -18px #${config.colorScheme.palette.ok}, + inset 0px -20px 8px -18px #${config.colorScheme.palette.ok}; + } + 25% { + box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, + inset 14px 14px 8px -18px #${config.colorScheme.palette.ok}, + inset -14px -14px 8px -18px #${config.colorScheme.palette.ok}; + } + 50% { + box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, + inset 20px 0px 8px -18px #${config.colorScheme.palette.ok}, + inset -20px 0px 8px -18px #${config.colorScheme.palette.ok}; + } + 75% { + box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, + inset 14px -14px 8px -18px #${config.colorScheme.palette.ok}, + inset -14px 14px 8px -18px #${config.colorScheme.palette.ok}; + } + 100% { + box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, + inset 0px -20px 8px -18px #${config.colorScheme.palette.ok}, + inset 0px 20px 8px -18px #${config.colorScheme.palette.ok}; + } + } + + + + @keyframes batteryFull { + 0% { + box-shadow: inset 0px 20px 8px -16px #${config.colorScheme.palette.warn}, + inset 0px -20px 8px -16px #${config.colorScheme.palette.warn}; + color: #${config.colorScheme.palette.warn}; + } + 25% { + box-shadow: inset 0px 19px 8px -16px #${config.colorScheme.palette.warn}, + inset 0px -19px 8px -16px #${config.colorScheme.palette.warn}; + color: #${config.colorScheme.palette.warn}; + } + 50% { + box-shadow: inset 0px 15px 8px -16px #${config.colorScheme.palette.warn}, + inset 0px -15px 8px -16px #${config.colorScheme.palette.warn}; + color: #${config.colorScheme.palette.warn}; + } + 75% { + box-shadow: inset 0px 19px 8px -16px #${config.colorScheme.palette.warn}, + inset 0px -19px 8px -16px #${config.colorScheme.palette.warn}; + color: #${config.colorScheme.palette.warn}; + } + 100% { + box-shadow: inset 0px 20px 8px -16px #${config.colorScheme.palette.warn}, + inset 0px -20px 8px -16px #${config.colorScheme.palette.warn}; + color: #${config.colorScheme.palette.warn}; + } + } + ''; + }; + }; +} diff --git a/modules/wofi.nix b/modules/wofi.nix new file mode 100644 index 0000000..41e9681 --- /dev/null +++ b/modules/wofi.nix @@ -0,0 +1,126 @@ +{ lib, config, pkgs, ... }: +let + cfg = config.modules.wofi; +in +{ + options.modules.wofi = { + enable = lib.mkEnableOption "enable wofi app launcher"; + }; + imports = [ + ../common/colors.nix + ]; + config = lib.mkIf cfg.enable { + home.packages = with pkgs; [ + (writeShellScriptBin "wofi-launch" '' + ${wofi}/bin/wofi --show drun + '') + (writeShellScriptBin "wofi-power" '' + lock="Lock" + poweroff="Poweroff" + reboot="Reboot" + sleep="Suspend" + + selected_option=$(echo -e "$lock\n$sleep\n$reboot\n$poweroff" | wofi --dmenu -i -p "Powermenu") + + if [ "$selected_option" == "$lock" ] + then + echo "lock" + swaylock + elif [ "$selected_option" == "$poweroff" ] + then + echo "poweroff" + poweroff + elif [ "$selected_option" == "$reboot" ] + then + echo "reboot" + reboot + elif [ "$selected_option" == "$sleep" ] + then + echo "sleep" + suspend + else + echo "No match" + fi + '') + ]; + programs.wofi = { + enable = true; + settings = { + + }; + style = '' + * { + outline: none; + outline-style: none; + } + + #window { + margin: 10px; + border: none; + background-color: #${config.colorScheme.palette.background}; + border-radius: 10px; + font-family: + JetBrains Mono NF, + monospace; + font-weight: bold; + font-size: 14px; + } + + #outer-box { + margin: 10px; + border: 2px #${config.colorScheme.palette.backgroundMuted}; + border-radius: 10px; + background-color: transparent; + } + + #input { + border: none; + border-radius: 10px; + margin-left: 2px; + color: #${config.colorScheme.palette.info}; + outline-style: none; + background-color: #${config.colorScheme.palette.background}; + } + + #scroll { + border: 10px solid #${config.colorScheme.palette.border}; + border-radius: 10px; + /*padding-right: 10px;*/ + outline: none; + background-color: #${config.colorScheme.palette.background}; + } + + #inner-box { + border: none; + border-radius: 10px; + background-color: transparent; + } + + #entry { + border: none; + /*border-radius: 10px; + margin-right: 15px; + margin-left: 15px;*/ + padding-right: 10px; + padding-left: 10px; + color: #${config.colorScheme.palette.text}; + background-color: #${config.colorScheme.palette.background}; + } + #entry:selected { + border: none; + background-color: #${config.colorScheme.palette.info}; + } + + #text:selected { + border: none; + color: #${config.colorScheme.palette.textMuted}; + } + + #img { + background-color: transparent; + margin-right: 6px; + } + ''; + }; + }; +} From 5f5dadd2924cb43ee0a573941f5abb06ee1eb84b Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Wed, 3 Apr 2024 23:41:37 +0200 Subject: [PATCH 03/22] start migrating waybar to modularity --- hosts/default/root.nix | 6 - modules/hyprland.nix | 12 +- modules/waybar.nix | 431 --------------------------------- modules/waybar/addname.nix | 12 + modules/waybar/clock.nix | 29 +++ modules/waybar/default.nix | 438 ++++++++++++++++++++++++++++++++++ modules/waybar/workspaces.nix | 17 ++ 7 files changed, 506 insertions(+), 439 deletions(-) delete mode 100644 modules/waybar.nix create mode 100644 modules/waybar/addname.nix create mode 100644 modules/waybar/clock.nix create mode 100644 modules/waybar/default.nix create mode 100644 modules/waybar/workspaces.nix diff --git a/hosts/default/root.nix b/hosts/default/root.nix index 5c4b6a5..091d60c 100644 --- a/hosts/default/root.nix +++ b/hosts/default/root.nix @@ -4,12 +4,6 @@ imports = [ inputs.nixvim.homeManagerModules.nixvim - ../../common/wofi.nix - ../../common/zsh.nix - ../../common/hyprland.nix - ../../common/waybar.nix - ../../common/git.nix - ../../common/nvim/nvim.nix ]; # Home Manager needs a bit of information about you and the paths it should # manage. diff --git a/modules/hyprland.nix b/modules/hyprland.nix index 0d18fe7..1754f6a 100644 --- a/modules/hyprland.nix +++ b/modules/hyprland.nix @@ -18,13 +18,21 @@ in }; imports = [ - ./waybar.nix + ./waybar/default.nix ./wofi.nix ./dunst.nix ]; config = lib.mkIf cfg.enable { modules = { - waybar.enable = lib.mkDefault true; + waybar = { + enable = lib.mkDefault true; + modules = { + # left = [ "hyprland/workspaces" "tray" "hyprland/window" ]; + # center = [ "clock" ]; + # right = [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "temperature" "custom/poweroff" ]; + center = [ "clock" ]; + }; + }; wofi.enable = lib.mkDefault true; dunst.enable = lib.mkDefault true; }; diff --git a/modules/waybar.nix b/modules/waybar.nix deleted file mode 100644 index cb91d7c..0000000 --- a/modules/waybar.nix +++ /dev/null @@ -1,431 +0,0 @@ -{ config, pkgs, lib, ... }: -let - cfg = config.modules.waybar; -in -{ - options.modules.waybar = { - enable = lib.mkEnableOption "enable waybar"; - package = lib.mkOption { - type = lib.types.package; - default = pkgs.waybar; - }; - }; - config = lib.mkIf cfg.enable { - home.packages = with pkgs; [ - font-awesome - ]; - programs.waybar = { - enable = true; - package = cfg.package; - settings = { - mainBar = { - layer = "top"; - position = "top"; - height = 39; - margin-top = 8; - margin-left = 10; - margin-right = 10; - output = [ - "DP-3" - "DP-2" - ]; - modules-left = [ "hyprland/workspaces" "tray" "custom/pronouns" "hyprland/window" ]; - modules-center = [ "clock" ]; - modules-right = [ "custom/vpn" "wireplumber" "battery" "network" "cpu" "memory" "temperature" "custom/poweroff" ]; - "clock" = { - tooltip-format = "{:%Y %B}\n\n{calendar}"; - interval = 1; - format = "{:%H:%M:%S}"; - format-alt = ":%Y-%m-%d %H:%M:%S}"; - on-click-middle = "gnome-clocks"; - calendar = { - weeks-pos = "left"; - format = { - today = "{}"; # TODO: use nix-colors - weeks = "{}"; # TODO: use nix-colors - }; - }; - }; - "tray".spacing = 10; - "cpu" = { - format = "cpu: {usage}%"; - tooltip = false; - }; - "memory" = { - format = "mem: {}%"; - tooltip = false; - }; - "wireplumber" = { - format = "{volume}% {icon}"; - format-muted = ""; - on-click = "helvum"; - format-icons = ["" "" ""]; - }; - "custom/vpn" = { - format = "VPN"; - exec = "echo '{\"class\": \"connected\"}'"; - exec-if = "test -d /proc/sys/net/ipv4/conf/tun0"; - return-type = "json"; - interval = 5; - }; - "temperature" = { - thermal-zone = 2; - hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input"; - critical-threshold = 80; - format = "{temperatureC}°C {icon}"; - format-icons = ["" "" ""]; - }; - "custom/poweroff" = { - format = ""; - on-click = "wofi-power"; - on-click-right = "swaylock"; - }; - "battery" = { - bat = "hidpp_battery_2"; - states = { - full = 100; - good = 50; - warning = 30; - critical = 30; - }; - format = "mouse: {capacity}% {icon}"; - format-charging = "mouse: {capacity}% {icon}"; - format-plugged = "mouse: {capacity}% {icon}"; - format-alt = "mouse: {time} {icon}"; - interval = 1; - format-icons = [ - "󰂎" - "󰁻" - "󰁾" - "󰂀" - "󰁹" - ]; - }; - "hyprland/window" = { - max-length = 36; - }; - "network" = { - format-wifi = "{essid} ({signalStrength}%) 󰖩"; - format-ethernet = "{ipaddr}/{cidr} 󰛳"; - tooltip-format = "{ifname} via {gwaddr} 󰛳"; - format-linked = "{ifname} (No IP) 󰛳"; - format-disconnected = "Disconnected "; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - }; - "custom/pronouns" = { - format = "{}"; - # exec = "${config.xdg.configHome}/waybar/pronouns"; # TODO: install pronouns - interval = 5; - }; - "hyprland/workspaces" = { - format = "{name}"; - on-click = "activate"; - sort-by = "id"; - }; - }; - }; - style = '' - * { - /* `otf-font-awesome` is required to be installed for icons */ - font-family: "Maple Mono NF"; - font-size: 14px; - } - - window#waybar { - background-color: transparent; - - border-radius: 999px; - color: #${config.colorScheme.palette.text}; - transition-property: background-color; - transition-duration: .5s; - } - window#waybar.hidden { - opacity: 0.2; - } - - window#waybar.termite { - background-color: transparent; - } - - window#waybar.chromium { - background-color: transparent; - } - - button { - /* Use box-shadow instead of border so the text isn't offset */ - box-shadow: inset 0 -1px transparent; - /* Avoid rounded borders under each button name */ - border: none; - border-radius: 0; - } - - /* https://githbackground: #000000ub.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ - button:hover { - background: inherit; - border-radius: 999px; - } - - #workspaces button { - transition: all 0.2s; - padding: 3px 3px 3px 5px; - margin: 3px; - min-width: 15px; - min-height: 15px; - background-color: transparent; - color: #${config.colorScheme.palette.textMuted}; - border-radius: 999px; - } - - #workspaces button:hover { - background-color: #${config.colorScheme.palette.highlight}; - } - - #workspaces button.active { - color: #${config.colorScheme.palette.text}; - font-weight: bold; - background-color: #${config.colorScheme.palette.highlight}; - } - - #workspaces button.urgent { - background-color: #${config.colorScheme.palette.danger}; - } - - #clock, - #battery, - #cpu, - #memory, - #disk, - #temperature, - #backlight, - #network, - #pulseaudio, - #wireplumber, - #custom-media, - #mode, - #idle_inhibitor, - #custom-vpn, - #scratchpad, - #tray, - #custom-updates, - #custom-poweroff, - #mpd { - color: #${config.colorScheme.palette.textMuted}; - margin: 0px 2px; - padding: 0 15px; - - border-radius: 999px; - box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.backgroundMuted}; - } - - .modules-right > widget:last-child > #battery { - margin-right: 0px; - } - - #tray { - padding: 4px 10px; - border-radius: 999px 999px 999px 999px; - box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.backgroundMuted}; - } - - #window { - margin-left: 6px; - color: #${config.colorScheme.palette.textMuted}; - } - - #workspaces { - margin: 0 4px; - padding: 4px 4px; - border-radius: 999px; - box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.backgroundMuted}; - } - - #cpu { - border-radius: 999px 0px 0px 999px; - margin-right: 0px; - } - - #memory { - border-radius: 0px; - padding: 0 10px; - margin: 0px; - box-shadow: inset 0px 2px 0 -1px #${config.colorScheme.palette.backgroundMuted}, - inset 0px -2px 0 -1px #${config.colorScheme.palette.backgroundMuted}; - } - - #clock { - box-shadow: none; - } - - - #battery { - min-width: 50px; - border-radius: 999px; - box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.backgroundMuted}; - background-color: #${config.colorScheme.palette.backgroundMuted}; - transition: all 0.3s; - } - - #battery.charging, #battery.plugged { - color: #${config.colorScheme.palette.succes}; - background-color: transparent; - animation: batteryCharging 1.2s linear 0s infinite normal forwards, - } - #battery.full { - animation: batteryFull 7.0s linear 0s infinite normal forwards; - } - #battery.critical:not(.charging) { - background-color: #${config.colorScheme.palette.background}; - animation: batteryCritical 1.2s linear 0s infinite normal forwards; - } - - #network { - - } - - #network.disconnected, - #pulseaudio.muted { - transition: all 0.2s; - color: #${config.colorScheme.palette.backgroundMuted}; - } - - .custom-spotify { - color: #${config.colorScheme.palette.spotifyGreen}; - margin-right: 10px; - } - - #temperature { - margin-left: 0px; - border-radius: 0px 999px 999px 0px; - } - - #temperature.critical { - background-color: transparent; - color: #${config.colorScheme.palette.danger}; - } - - #tray { - background-color: transparent; - } - - - #tray > .passive { - -gtk-icon-effect: dim; - } - - #tray > .needs-attention { - background-color: #${config.colorScheme.palette.danger}; - border-radius: 999px; - } - - #scratchpad { - background: rgba(0, 0, 0, 0.1); - } - #scratchpad.empty { - background-color: transparent; - } - - #custom-updates { - box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.backgroundMuted}; - color: #${config.colorScheme.palette.textMuted}; - transition: all 0.5s; - } - - #custom-updates.pending { - box-shadow: inset 0 0 0 2px #${config.colorScheme.palette.highlight}; - color: #${config.colorScheme.palette.highlight}; - font-weight: bold; - transition: all 0.5s; - } - - tooltip { - background-color: #${config.colorScheme.palette.background}; - border: 1px solid; - border-color: #${config.colorScheme.palette.border}; - border-radius: 10px; - color: #${config.colorScheme.palette.text}; - } - tooltip label { - padding: 5px; - } - - /* Keyframes ---------------------------------------------------------------- */ - - @keyframes batteryCritical { - 0% { - box-shadow: inset 0px 20px 8px -16px #${config.colorScheme.palette.danger}, - inset 0px -20px 8px -16px #${config.colorScheme.palette.danger}; - color: #${config.colorScheme.palette.danger}; - } - 50% { - box-shadow: inset 0px 12px 8px -16px #${config.colorScheme.palette.danger}, - inset 0px -12px 8px -16px #${config.colorScheme.palette.danger}; - color: #${config.colorScheme.palette.textMuted}; - } - 100% { - box-shadow: inset 0px 20px 8px -16px #${config.colorScheme.palette.danger}, - inset 0px -20px 8px -16px #${config.colorScheme.palette.danger}; - color: #${config.colorScheme.palette.danger}; - } - } - - @keyframes batteryCharging { - 0% { - box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, - inset 0px 20px 8px -18px #${config.colorScheme.palette.ok}, - inset 0px -20px 8px -18px #${config.colorScheme.palette.ok}; - } - 25% { - box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, - inset 14px 14px 8px -18px #${config.colorScheme.palette.ok}, - inset -14px -14px 8px -18px #${config.colorScheme.palette.ok}; - } - 50% { - box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, - inset 20px 0px 8px -18px #${config.colorScheme.palette.ok}, - inset -20px 0px 8px -18px #${config.colorScheme.palette.ok}; - } - 75% { - box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, - inset 14px -14px 8px -18px #${config.colorScheme.palette.ok}, - inset -14px 14px 8px -18px #${config.colorScheme.palette.ok}; - } - 100% { - box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, - inset 0px -20px 8px -18px #${config.colorScheme.palette.ok}, - inset 0px 20px 8px -18px #${config.colorScheme.palette.ok}; - } - } - - - - @keyframes batteryFull { - 0% { - box-shadow: inset 0px 20px 8px -16px #${config.colorScheme.palette.warn}, - inset 0px -20px 8px -16px #${config.colorScheme.palette.warn}; - color: #${config.colorScheme.palette.warn}; - } - 25% { - box-shadow: inset 0px 19px 8px -16px #${config.colorScheme.palette.warn}, - inset 0px -19px 8px -16px #${config.colorScheme.palette.warn}; - color: #${config.colorScheme.palette.warn}; - } - 50% { - box-shadow: inset 0px 15px 8px -16px #${config.colorScheme.palette.warn}, - inset 0px -15px 8px -16px #${config.colorScheme.palette.warn}; - color: #${config.colorScheme.palette.warn}; - } - 75% { - box-shadow: inset 0px 19px 8px -16px #${config.colorScheme.palette.warn}, - inset 0px -19px 8px -16px #${config.colorScheme.palette.warn}; - color: #${config.colorScheme.palette.warn}; - } - 100% { - box-shadow: inset 0px 20px 8px -16px #${config.colorScheme.palette.warn}, - inset 0px -20px 8px -16px #${config.colorScheme.palette.warn}; - color: #${config.colorScheme.palette.warn}; - } - } - ''; - }; - }; -} diff --git a/modules/waybar/addname.nix b/modules/waybar/addname.nix new file mode 100644 index 0000000..4d6ca8b --- /dev/null +++ b/modules/waybar/addname.nix @@ -0,0 +1,12 @@ +lib: name: +{ + left = lib.mkOption { + type = with lib.types; listOf (enum [ name ]); + }; + center = lib.mkOption { + type = with lib.types; listOf (enum [ name ]); + }; + right = lib.mkOption { + type = with lib.types; listOf (enum [ name ]); + }; +} diff --git a/modules/waybar/clock.nix b/modules/waybar/clock.nix new file mode 100644 index 0000000..51a3ea7 --- /dev/null +++ b/modules/waybar/clock.nix @@ -0,0 +1,29 @@ +{ lib, config, pkgs, ... }: +let + name = "clock"; +in +{ + options.modules.waybar.modules = import ./addname.nix lib name; + options.modules.waybar.${name} = { + enable = lib.mkEnableOption "enable ${name} waybar module"; + }; + config = lib.mkIf config.modules.waybar.${name}.enable { + programs.waybar.settings.mainbar.${name} = { + tooltip-format = "{:%Y %B}\n\n{calendar}"; + interval = 1; + format = "{:%H:%M:%S}"; + format-alt = "{:%Y-%m-%d %H:%M:%S}"; + on-click-middle = "gnome-clocks"; + calendar = { + weeks-pos = "left"; + format = { + today = "{}"; # TODO: use nix-colors + weeks = "{}"; # TODO: use nix-colors + }; + }; + home.packages = [ + pkgs.gnome.gnome-clocks + ]; + }; + }; +} diff --git a/modules/waybar/default.nix b/modules/waybar/default.nix new file mode 100644 index 0000000..81ee6f1 --- /dev/null +++ b/modules/waybar/default.nix @@ -0,0 +1,438 @@ +{ config, pkgs, lib, ... }: +let + cfg = config.modules.waybar; + + ifIsDef = name: builtins.any (row: builtins.any (x: x == name) row) (with cfg.modules; [left center right]); +in +{ + options.modules.waybar = { + enable = lib.mkEnableOption "enable waybar"; + package = lib.mkOption { + type = lib.types.package; + default = pkgs.waybar; + }; + modules = { + left = lib.mkOption { + type = with lib.types; listOf (enum [ ]); + default = []; + }; + center = lib.mkOption { + type = with lib.types; listOf (enum [ ]); + default = []; + }; + right = lib.mkOption { + type = with lib.types; listOf (enum [ ]); + default = []; + }; + }; + }; + + imports = [ + ./clock.nix + ./workspaces.nix + ]; + + config = lib.mkIf cfg.enable { + modules.waybar = { + clock.enable = ifIsDef "clock"; + "hyprland/workspaces".enable = ifIsDef "hyprland/workspaces"; + }; + home.packages = with pkgs; [ + font-awesome + ]; + programs.waybar = { + enable = true; + package = cfg.package; + settings = { + mainBar = { + layer = "top"; + position = "top"; + height = 39; + margin-top = 8; + margin-left = 10; + margin-right = 10; + output = [ + "DP-3" + "DP-2" + ]; + modules-left = cfg.modules.left; + modules-center = cfg.modules.center; + modules-right = cfg.modules.right; + "tray".spacing = 10; + "cpu" = { + format = "cpu: {usage}%"; + tooltip = false; + }; + "memory" = { + format = "mem: {}%"; + tooltip = false; + }; + "wireplumber" = { + format = "{volume}% {icon}"; + format-muted = ""; + on-click = "helvum"; + format-icons = ["" "" ""]; + }; + "custom/vpn" = { + format = "VPN"; + exec = "echo '{\"class\": \"connected\"}'"; + exec-if = "test -d /proc/sys/net/ipv4/conf/tun0"; + return-type = "json"; + interval = 5; + }; + "temperature" = { + thermal-zone = 2; + hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input"; + critical-threshold = 80; + format = "{temperatureC}°C {icon}"; + format-icons = ["" "" ""]; + }; + "custom/poweroff" = { + format = ""; + on-click = "wofi-power"; + on-click-right = "swaylock"; + }; + "battery" = { + bat = "hidpp_battery_2"; + states = { + full = 100; + good = 50; + warning = 30; + critical = 30; + }; + format = "mouse: {capacity}% {icon}"; + format-charging = "mouse: {capacity}% {icon}"; + format-plugged = "mouse: {capacity}% {icon}"; + format-alt = "mouse: {time} {icon}"; + interval = 1; + format-icons = [ + "󰂎" + "󰁻" + "󰁾" + "󰂀" + "󰁹" + ]; + }; + "hyprland/window" = { + max-length = 36; + }; + "network" = { + format-wifi = "{essid} ({signalStrength}%) 󰖩"; + format-ethernet = "{ipaddr}/{cidr} 󰛳"; + tooltip-format = "{ifname} via {gwaddr} 󰛳"; + format-linked = "{ifname} (No IP) 󰛳"; + format-disconnected = "Disconnected "; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + }; + "custom/pronouns" = { + format = "{}"; + # exec = "${config.xdg.configHome}/waybar/pronouns"; # TODO: install pronouns + interval = 5; + }; + }; + }; + style = '' + * { + /* `otf-font-awesome` is required to be installed for icons */ + font-family: "Maple Mono NF"; + font-size: 14px; + } + + window#waybar { + background-color: transparent; + + border-radius: 999px; + color: #${config.colorScheme.palette.text}; + transition-property: background-color; + transition-duration: .5s; + } + window#waybar.hidden { + opacity: 0.2; + } + + window#waybar.termite { + background-color: transparent; + } + + window#waybar.chromium { + background-color: transparent; + } + + button { + /* Use box-shadow instead of border so the text isn't offset */ + box-shadow: inset 0 -1px transparent; + /* Avoid rounded borders under each button name */ + border: none; + border-radius: 0; + } + + /* https://githbackground: #000000ub.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */ + button:hover { + background: inherit; + border-radius: 999px; + } + + #workspaces button { + transition: all 0.2s; + padding: 3px 3px 3px 5px; + margin: 3px; + min-width: 15px; + min-height: 15px; + background-color: transparent; + color: #${config.colorScheme.palette.textMuted}; + border-radius: 999px; + } + + #workspaces button:hover { + background-color: #${config.colorScheme.palette.highlight}; + } + + #workspaces button.active { + color: #${config.colorScheme.palette.text}; + font-weight: bold; + background-color: #${config.colorScheme.palette.highlight}; + } + + #workspaces button.urgent { + background-color: #${config.colorScheme.palette.danger}; + } + + #clock, + #battery, + #cpu, + #memory, + #disk, + #temperature, + #backlight, + #network, + #pulseaudio, + #wireplumber, + #custom-media, + #mode, + #idle_inhibitor, + #custom-vpn, + #scratchpad, + #tray, + #custom-updates, + #custom-poweroff, + #mpd { + color: #${config.colorScheme.palette.textMuted}; + margin: 0px 2px; + padding: 0 15px; + + border-radius: 999px; + box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.backgroundMuted}; + } + + .modules-right > widget:last-child > #battery { + margin-right: 0px; + } + + #tray { + padding: 4px 10px; + border-radius: 999px 999px 999px 999px; + box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.backgroundMuted}; + } + + #window { + margin-left: 6px; + color: #${config.colorScheme.palette.textMuted}; + } + + #workspaces { + margin: 0 4px; + padding: 4px 4px; + border-radius: 999px; + box-shadow: inset 0px 0px 0 1px #${config.colorScheme.palette.backgroundMuted}; + } + + #cpu { + border-radius: 999px 0px 0px 999px; + margin-right: 0px; + } + + #memory { + border-radius: 0px; + padding: 0 10px; + margin: 0px; + box-shadow: inset 0px 2px 0 -1px #${config.colorScheme.palette.backgroundMuted}, + inset 0px -2px 0 -1px #${config.colorScheme.palette.backgroundMuted}; + } + + #clock { + box-shadow: none; + } + + + #battery { + min-width: 50px; + border-radius: 999px; + box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.backgroundMuted}; + background-color: #${config.colorScheme.palette.backgroundMuted}; + transition: all 0.3s; + } + + #battery.charging, #battery.plugged { + color: #${config.colorScheme.palette.succes}; + background-color: transparent; + animation: batteryCharging 1.2s linear 0s infinite normal forwards, + } + #battery.full { + animation: batteryFull 7.0s linear 0s infinite normal forwards; + } + #battery.critical:not(.charging) { + background-color: #${config.colorScheme.palette.background}; + animation: batteryCritical 1.2s linear 0s infinite normal forwards; + } + + #network { + + } + + #network.disconnected, + #pulseaudio.muted { + transition: all 0.2s; + color: #${config.colorScheme.palette.backgroundMuted}; + } + + .custom-spotify { + color: #${config.colorScheme.palette.spotifyGreen}; + margin-right: 10px; + } + + #temperature { + margin-left: 0px; + border-radius: 0px 999px 999px 0px; + } + + #temperature.critical { + background-color: transparent; + color: #${config.colorScheme.palette.danger}; + } + + #tray { + background-color: transparent; + } + + + #tray > .passive { + -gtk-icon-effect: dim; + } + + #tray > .needs-attention { + background-color: #${config.colorScheme.palette.danger}; + border-radius: 999px; + } + + #scratchpad { + background: rgba(0, 0, 0, 0.1); + } + #scratchpad.empty { + background-color: transparent; + } + + #custom-updates { + box-shadow: inset 0 0 0 1px #${config.colorScheme.palette.backgroundMuted}; + color: #${config.colorScheme.palette.textMuted}; + transition: all 0.5s; + } + + #custom-updates.pending { + box-shadow: inset 0 0 0 2px #${config.colorScheme.palette.highlight}; + color: #${config.colorScheme.palette.highlight}; + font-weight: bold; + transition: all 0.5s; + } + + tooltip { + background-color: #${config.colorScheme.palette.background}; + border: 1px solid; + border-color: #${config.colorScheme.palette.border}; + border-radius: 10px; + color: #${config.colorScheme.palette.text}; + } + tooltip label { + padding: 5px; + } + + /* Keyframes ---------------------------------------------------------------- */ + + @keyframes batteryCritical { + 0% { + box-shadow: inset 0px 20px 8px -16px #${config.colorScheme.palette.danger}, + inset 0px -20px 8px -16px #${config.colorScheme.palette.danger}; + color: #${config.colorScheme.palette.danger}; + } + 50% { + box-shadow: inset 0px 12px 8px -16px #${config.colorScheme.palette.danger}, + inset 0px -12px 8px -16px #${config.colorScheme.palette.danger}; + color: #${config.colorScheme.palette.textMuted}; + } + 100% { + box-shadow: inset 0px 20px 8px -16px #${config.colorScheme.palette.danger}, + inset 0px -20px 8px -16px #${config.colorScheme.palette.danger}; + color: #${config.colorScheme.palette.danger}; + } + } + + @keyframes batteryCharging { + 0% { + box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, + inset 0px 20px 8px -18px #${config.colorScheme.palette.ok}, + inset 0px -20px 8px -18px #${config.colorScheme.palette.ok}; + } + 25% { + box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, + inset 14px 14px 8px -18px #${config.colorScheme.palette.ok}, + inset -14px -14px 8px -18px #${config.colorScheme.palette.ok}; + } + 50% { + box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, + inset 20px 0px 8px -18px #${config.colorScheme.palette.ok}, + inset -20px 0px 8px -18px #${config.colorScheme.palette.ok}; + } + 75% { + box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, + inset 14px -14px 8px -18px #${config.colorScheme.palette.ok}, + inset -14px 14px 8px -18px #${config.colorScheme.palette.ok}; + } + 100% { + box-shadow: inset 0px 0px 8px 0px #${config.colorScheme.palette.info}, + inset 0px -20px 8px -18px #${config.colorScheme.palette.ok}, + inset 0px 20px 8px -18px #${config.colorScheme.palette.ok}; + } + } + + + + @keyframes batteryFull { + 0% { + box-shadow: inset 0px 20px 8px -16px #${config.colorScheme.palette.warn}, + inset 0px -20px 8px -16px #${config.colorScheme.palette.warn}; + color: #${config.colorScheme.palette.warn}; + } + 25% { + box-shadow: inset 0px 19px 8px -16px #${config.colorScheme.palette.warn}, + inset 0px -19px 8px -16px #${config.colorScheme.palette.warn}; + color: #${config.colorScheme.palette.warn}; + } + 50% { + box-shadow: inset 0px 15px 8px -16px #${config.colorScheme.palette.warn}, + inset 0px -15px 8px -16px #${config.colorScheme.palette.warn}; + color: #${config.colorScheme.palette.warn}; + } + 75% { + box-shadow: inset 0px 19px 8px -16px #${config.colorScheme.palette.warn}, + inset 0px -19px 8px -16px #${config.colorScheme.palette.warn}; + color: #${config.colorScheme.palette.warn}; + } + 100% { + box-shadow: inset 0px 20px 8px -16px #${config.colorScheme.palette.warn}, + inset 0px -20px 8px -16px #${config.colorScheme.palette.warn}; + color: #${config.colorScheme.palette.warn}; + } + } + ''; + }; + }; +} diff --git a/modules/waybar/workspaces.nix b/modules/waybar/workspaces.nix new file mode 100644 index 0000000..50051ce --- /dev/null +++ b/modules/waybar/workspaces.nix @@ -0,0 +1,17 @@ +{ lib, config, ... }: +let + name = "hyprland/workspaces"; +in +{ + options.modules.waybar.modules = import ./addname.nix lib name; + options.modules.waybar.${name} = { + enable = lib.mkEnableOption "enable ${name} waybar module"; + }; + config = lib.mkIf config.modules.waybar.${name}.enable { + programs.waybar.settings.mainbar."${name}" = { + format = "{name}"; + on-click = "activate"; + sort-by = "id"; + }; + }; +} From 9b7b35a686468cc86a8227fc7c86d102a4d19713 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 4 Apr 2024 00:04:41 +0200 Subject: [PATCH 04/22] modularize waybar config, TODO: styles --- modules/hyprland.nix | 5 +-- modules/waybar/cpu.nix | 16 +++++++ modules/waybar/default.nix | 81 ++++------------------------------ modules/waybar/memory.nix | 16 +++++++ modules/waybar/network.nix | 20 +++++++++ modules/waybar/power.nix | 21 +++++++++ modules/waybar/temperature.nix | 19 ++++++++ modules/waybar/tray.nix | 15 +++++++ modules/waybar/vpn.nix | 19 ++++++++ modules/waybar/window.nix | 15 +++++++ modules/waybar/wireplumber.nix | 18 ++++++++ 11 files changed, 170 insertions(+), 75 deletions(-) create mode 100644 modules/waybar/cpu.nix create mode 100644 modules/waybar/memory.nix create mode 100644 modules/waybar/network.nix create mode 100644 modules/waybar/power.nix create mode 100644 modules/waybar/temperature.nix create mode 100644 modules/waybar/tray.nix create mode 100644 modules/waybar/vpn.nix create mode 100644 modules/waybar/window.nix create mode 100644 modules/waybar/wireplumber.nix diff --git a/modules/hyprland.nix b/modules/hyprland.nix index 1754f6a..af39b3b 100644 --- a/modules/hyprland.nix +++ b/modules/hyprland.nix @@ -27,10 +27,9 @@ in waybar = { enable = lib.mkDefault true; modules = { - # left = [ "hyprland/workspaces" "tray" "hyprland/window" ]; - # center = [ "clock" ]; - # right = [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "temperature" "custom/poweroff" ]; + left = [ "hyprland/workspaces" "tray" "hyprland/window" ]; center = [ "clock" ]; + right = [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "temperature" "custom/poweroff" ]; }; }; wofi.enable = lib.mkDefault true; diff --git a/modules/waybar/cpu.nix b/modules/waybar/cpu.nix new file mode 100644 index 0000000..f0e53b2 --- /dev/null +++ b/modules/waybar/cpu.nix @@ -0,0 +1,16 @@ +{ lib, config, ... }: +let + name = "cpu"; +in +{ + options.modules.waybar.modules = import ./addname.nix lib name; + options.modules.waybar.${name} = { + enable = lib.mkEnableOption "enable ${name} waybar module"; + }; + config = lib.mkIf config.modules.waybar.${name}.enable { + programs.waybar.settings.mainbar."${name}" = { + format = "cpu: {usage}%"; + tooltip = false; + }; + }; +} diff --git a/modules/waybar/default.nix b/modules/waybar/default.nix index 81ee6f1..a8fa83f 100644 --- a/modules/waybar/default.nix +++ b/modules/waybar/default.nix @@ -28,8 +28,17 @@ in }; imports = [ + ./cpu.nix + ./vpn.nix + ./tray.nix ./clock.nix + ./power.nix + ./memory.nix + ./window.nix + ./network.nix ./workspaces.nix + ./temperature.nix + ./wireplumber.nix ]; config = lib.mkIf cfg.enable { @@ -58,77 +67,6 @@ in modules-left = cfg.modules.left; modules-center = cfg.modules.center; modules-right = cfg.modules.right; - "tray".spacing = 10; - "cpu" = { - format = "cpu: {usage}%"; - tooltip = false; - }; - "memory" = { - format = "mem: {}%"; - tooltip = false; - }; - "wireplumber" = { - format = "{volume}% {icon}"; - format-muted = ""; - on-click = "helvum"; - format-icons = ["" "" ""]; - }; - "custom/vpn" = { - format = "VPN"; - exec = "echo '{\"class\": \"connected\"}'"; - exec-if = "test -d /proc/sys/net/ipv4/conf/tun0"; - return-type = "json"; - interval = 5; - }; - "temperature" = { - thermal-zone = 2; - hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input"; - critical-threshold = 80; - format = "{temperatureC}°C {icon}"; - format-icons = ["" "" ""]; - }; - "custom/poweroff" = { - format = ""; - on-click = "wofi-power"; - on-click-right = "swaylock"; - }; - "battery" = { - bat = "hidpp_battery_2"; - states = { - full = 100; - good = 50; - warning = 30; - critical = 30; - }; - format = "mouse: {capacity}% {icon}"; - format-charging = "mouse: {capacity}% {icon}"; - format-plugged = "mouse: {capacity}% {icon}"; - format-alt = "mouse: {time} {icon}"; - interval = 1; - format-icons = [ - "󰂎" - "󰁻" - "󰁾" - "󰂀" - "󰁹" - ]; - }; - "hyprland/window" = { - max-length = 36; - }; - "network" = { - format-wifi = "{essid} ({signalStrength}%) 󰖩"; - format-ethernet = "{ipaddr}/{cidr} 󰛳"; - tooltip-format = "{ifname} via {gwaddr} 󰛳"; - format-linked = "{ifname} (No IP) 󰛳"; - format-disconnected = "Disconnected "; - format-alt = "{ifname}: {ipaddr}/{cidr}"; - }; - "custom/pronouns" = { - format = "{}"; - # exec = "${config.xdg.configHome}/waybar/pronouns"; # TODO: install pronouns - interval = 5; - }; }; }; style = '' @@ -140,7 +78,6 @@ in window#waybar { background-color: transparent; - border-radius: 999px; color: #${config.colorScheme.palette.text}; transition-property: background-color; diff --git a/modules/waybar/memory.nix b/modules/waybar/memory.nix new file mode 100644 index 0000000..134431c --- /dev/null +++ b/modules/waybar/memory.nix @@ -0,0 +1,16 @@ +{ lib, config, ... }: +let + name = "memory"; +in +{ + options.modules.waybar.modules = import ./addname.nix lib name; + options.modules.waybar.${name} = { + enable = lib.mkEnableOption "enable ${name} waybar module"; + }; + config = lib.mkIf config.modules.waybar.${name}.enable { + programs.waybar.settings.mainbar."${name}" = { + format = "mem: {}%"; + tooltip = false; + }; + }; +} diff --git a/modules/waybar/network.nix b/modules/waybar/network.nix new file mode 100644 index 0000000..8fd8fa2 --- /dev/null +++ b/modules/waybar/network.nix @@ -0,0 +1,20 @@ +{ lib, config, ... }: +let + name = "network"; +in +{ + options.modules.waybar.modules = import ./addname.nix lib name; + options.modules.waybar.${name} = { + enable = lib.mkEnableOption "enable ${name} waybar module"; + }; + config = lib.mkIf config.modules.waybar.${name}.enable { + programs.waybar.settings.mainbar."${name}" = { + format-wifi = "{essid} ({signalStrength}%) 󰖩"; + format-ethernet = "{ipaddr}/{cidr} 󰛳"; + tooltip-format = "{ifname} via {gwaddr} 󰛳"; + format-linked = "{ifname} (No IP) 󰛳"; + format-disconnected = "Disconnected "; + format-alt = "{ifname}: {ipaddr}/{cidr}"; + }; + }; +} diff --git a/modules/waybar/power.nix b/modules/waybar/power.nix new file mode 100644 index 0000000..d6c40e9 --- /dev/null +++ b/modules/waybar/power.nix @@ -0,0 +1,21 @@ +{ lib, config, ... }: +let + name = "custom/poweroff"; +in +{ + options.modules.waybar.modules = import ./addname.nix lib name; + options.modules.waybar.${name} = { + enable = lib.mkEnableOption "enable ${name} waybar module"; + }; + imports = [ + ../wofi.nix + ]; + config = lib.mkIf config.modules.waybar.${name}.enable { + modules.wofi.enable = true; + programs.waybar.settings.mainbar."${name}" = { + format = ""; + on-click = "wofi-power"; + # on-click-right = "swaylock"; # TODO: change to whatever lock screen i want + }; + }; +} diff --git a/modules/waybar/temperature.nix b/modules/waybar/temperature.nix new file mode 100644 index 0000000..3d10984 --- /dev/null +++ b/modules/waybar/temperature.nix @@ -0,0 +1,19 @@ +{ lib, config, ... }: +let + name = "temperature"; +in +{ + options.modules.waybar.modules = import ./addname.nix lib name; + options.modules.waybar.${name} = { + enable = lib.mkEnableOption "enable ${name} waybar module"; + }; + config = lib.mkIf config.modules.waybar.${name}.enable { + programs.waybar.settings.mainbar."${name}" = { + thermal-zone = 2; + hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input"; + critical-threshold = 80; + format = "{temperatureC}°C {icon}"; + format-icons = ["" "" ""]; + }; + }; +} diff --git a/modules/waybar/tray.nix b/modules/waybar/tray.nix new file mode 100644 index 0000000..279265a --- /dev/null +++ b/modules/waybar/tray.nix @@ -0,0 +1,15 @@ +{ lib, config, ... }: +let + name = "tray"; +in +{ + options.modules.waybar.modules = import ./addname.nix lib name; + options.modules.waybar.${name} = { + enable = lib.mkEnableOption "enable ${name} waybar module"; + }; + config = lib.mkIf config.modules.waybar.${name}.enable { + programs.waybar.settings.mainbar."${name}" = { + spacing = 10; + }; + }; +} diff --git a/modules/waybar/vpn.nix b/modules/waybar/vpn.nix new file mode 100644 index 0000000..da226b3 --- /dev/null +++ b/modules/waybar/vpn.nix @@ -0,0 +1,19 @@ +{ lib, config, ... }: +let + name = "custom/vpn"; +in +{ + options.modules.waybar.modules = import ./addname.nix lib name; + options.modules.waybar.${name} = { + enable = lib.mkEnableOption "enable ${name} waybar module"; + }; + config = lib.mkIf config.modules.waybar.${name}.enable { + programs.waybar.settings.mainbar."${name}" = { + format = "VPN"; + exec = "echo '{\"class\": \"connected\"}'"; + exec-if = "test -d /proc/sys/net/ipv4/conf/tun0"; + return-type = "json"; + interval = 5; + }; + }; +} diff --git a/modules/waybar/window.nix b/modules/waybar/window.nix new file mode 100644 index 0000000..b2739bb --- /dev/null +++ b/modules/waybar/window.nix @@ -0,0 +1,15 @@ +{ lib, config, ... }: +let + name = "hyprland/window"; +in +{ + options.modules.waybar.modules = import ./addname.nix lib name; + options.modules.waybar.${name} = { + enable = lib.mkEnableOption "enable ${name} waybar module"; + }; + config = lib.mkIf config.modules.waybar.${name}.enable { + programs.waybar.settings.mainbar."${name}" = { + max-length = 36; + }; + }; +} diff --git a/modules/waybar/wireplumber.nix b/modules/waybar/wireplumber.nix new file mode 100644 index 0000000..bdf5f19 --- /dev/null +++ b/modules/waybar/wireplumber.nix @@ -0,0 +1,18 @@ +{ lib, config, ... }: +let + name = "wireplumber"; +in +{ + options.modules.waybar.modules = import ./addname.nix lib name; + options.modules.waybar.${name} = { + enable = lib.mkEnableOption "enable ${name} waybar module"; + }; + config = lib.mkIf config.modules.waybar.${name}.enable { + programs.waybar.settings.mainbar."${name}" = { + format = "{volume}% {icon}"; + format-muted = ""; + on-click = "helvum"; + format-icons = ["" "" ""]; + }; + }; +} From 872eeda44739827d5ff6288dca1b223b127d8e27 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 4 Apr 2024 00:10:06 +0200 Subject: [PATCH 05/22] fix mainBar typo --- modules/waybar/clock.nix | 2 +- modules/waybar/cpu.nix | 2 +- modules/waybar/memory.nix | 2 +- modules/waybar/network.nix | 2 +- modules/waybar/power.nix | 2 +- modules/waybar/temperature.nix | 2 +- modules/waybar/tray.nix | 2 +- modules/waybar/vpn.nix | 2 +- modules/waybar/window.nix | 2 +- modules/waybar/wireplumber.nix | 2 +- modules/waybar/workspaces.nix | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/modules/waybar/clock.nix b/modules/waybar/clock.nix index 51a3ea7..157c320 100644 --- a/modules/waybar/clock.nix +++ b/modules/waybar/clock.nix @@ -8,7 +8,7 @@ in enable = lib.mkEnableOption "enable ${name} waybar module"; }; config = lib.mkIf config.modules.waybar.${name}.enable { - programs.waybar.settings.mainbar.${name} = { + programs.waybar.settings.mainBar.${name} = { tooltip-format = "{:%Y %B}\n\n{calendar}"; interval = 1; format = "{:%H:%M:%S}"; diff --git a/modules/waybar/cpu.nix b/modules/waybar/cpu.nix index f0e53b2..cf20ba2 100644 --- a/modules/waybar/cpu.nix +++ b/modules/waybar/cpu.nix @@ -8,7 +8,7 @@ in enable = lib.mkEnableOption "enable ${name} waybar module"; }; config = lib.mkIf config.modules.waybar.${name}.enable { - programs.waybar.settings.mainbar."${name}" = { + programs.waybar.settings.mainBar."${name}" = { format = "cpu: {usage}%"; tooltip = false; }; diff --git a/modules/waybar/memory.nix b/modules/waybar/memory.nix index 134431c..e5171bc 100644 --- a/modules/waybar/memory.nix +++ b/modules/waybar/memory.nix @@ -8,7 +8,7 @@ in enable = lib.mkEnableOption "enable ${name} waybar module"; }; config = lib.mkIf config.modules.waybar.${name}.enable { - programs.waybar.settings.mainbar."${name}" = { + programs.waybar.settings.mainBar."${name}" = { format = "mem: {}%"; tooltip = false; }; diff --git a/modules/waybar/network.nix b/modules/waybar/network.nix index 8fd8fa2..1c10421 100644 --- a/modules/waybar/network.nix +++ b/modules/waybar/network.nix @@ -8,7 +8,7 @@ in enable = lib.mkEnableOption "enable ${name} waybar module"; }; config = lib.mkIf config.modules.waybar.${name}.enable { - programs.waybar.settings.mainbar."${name}" = { + programs.waybar.settings.mainBar."${name}" = { format-wifi = "{essid} ({signalStrength}%) 󰖩"; format-ethernet = "{ipaddr}/{cidr} 󰛳"; tooltip-format = "{ifname} via {gwaddr} 󰛳"; diff --git a/modules/waybar/power.nix b/modules/waybar/power.nix index d6c40e9..3b3e2c1 100644 --- a/modules/waybar/power.nix +++ b/modules/waybar/power.nix @@ -12,7 +12,7 @@ in ]; config = lib.mkIf config.modules.waybar.${name}.enable { modules.wofi.enable = true; - programs.waybar.settings.mainbar."${name}" = { + programs.waybar.settings.mainBar."${name}" = { format = ""; on-click = "wofi-power"; # on-click-right = "swaylock"; # TODO: change to whatever lock screen i want diff --git a/modules/waybar/temperature.nix b/modules/waybar/temperature.nix index 3d10984..0534414 100644 --- a/modules/waybar/temperature.nix +++ b/modules/waybar/temperature.nix @@ -8,7 +8,7 @@ in enable = lib.mkEnableOption "enable ${name} waybar module"; }; config = lib.mkIf config.modules.waybar.${name}.enable { - programs.waybar.settings.mainbar."${name}" = { + programs.waybar.settings.mainBar."${name}" = { thermal-zone = 2; hwmon-path = "/sys/class/hwmon/hwmon3/temp1_input"; critical-threshold = 80; diff --git a/modules/waybar/tray.nix b/modules/waybar/tray.nix index 279265a..f87c976 100644 --- a/modules/waybar/tray.nix +++ b/modules/waybar/tray.nix @@ -8,7 +8,7 @@ in enable = lib.mkEnableOption "enable ${name} waybar module"; }; config = lib.mkIf config.modules.waybar.${name}.enable { - programs.waybar.settings.mainbar."${name}" = { + programs.waybar.settings.mainBar."${name}" = { spacing = 10; }; }; diff --git a/modules/waybar/vpn.nix b/modules/waybar/vpn.nix index da226b3..3991fd3 100644 --- a/modules/waybar/vpn.nix +++ b/modules/waybar/vpn.nix @@ -8,7 +8,7 @@ in enable = lib.mkEnableOption "enable ${name} waybar module"; }; config = lib.mkIf config.modules.waybar.${name}.enable { - programs.waybar.settings.mainbar."${name}" = { + programs.waybar.settings.mainBar."${name}" = { format = "VPN"; exec = "echo '{\"class\": \"connected\"}'"; exec-if = "test -d /proc/sys/net/ipv4/conf/tun0"; diff --git a/modules/waybar/window.nix b/modules/waybar/window.nix index b2739bb..86c3e49 100644 --- a/modules/waybar/window.nix +++ b/modules/waybar/window.nix @@ -8,7 +8,7 @@ in enable = lib.mkEnableOption "enable ${name} waybar module"; }; config = lib.mkIf config.modules.waybar.${name}.enable { - programs.waybar.settings.mainbar."${name}" = { + programs.waybar.settings.mainBar."${name}" = { max-length = 36; }; }; diff --git a/modules/waybar/wireplumber.nix b/modules/waybar/wireplumber.nix index bdf5f19..4c6e1bc 100644 --- a/modules/waybar/wireplumber.nix +++ b/modules/waybar/wireplumber.nix @@ -8,7 +8,7 @@ in enable = lib.mkEnableOption "enable ${name} waybar module"; }; config = lib.mkIf config.modules.waybar.${name}.enable { - programs.waybar.settings.mainbar."${name}" = { + programs.waybar.settings.mainBar."${name}" = { format = "{volume}% {icon}"; format-muted = ""; on-click = "helvum"; diff --git a/modules/waybar/workspaces.nix b/modules/waybar/workspaces.nix index 50051ce..8901bcc 100644 --- a/modules/waybar/workspaces.nix +++ b/modules/waybar/workspaces.nix @@ -8,7 +8,7 @@ in enable = lib.mkEnableOption "enable ${name} waybar module"; }; config = lib.mkIf config.modules.waybar.${name}.enable { - programs.waybar.settings.mainbar."${name}" = { + programs.waybar.settings.mainBar."${name}" = { format = "{name}"; on-click = "activate"; sort-by = "id"; From ea6ac4e31c8585c8e34b551342dcfc334d39a7bd Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 4 Apr 2024 14:40:01 +0200 Subject: [PATCH 06/22] some small fixes --- common/discord/discord.nix | 2 +- common/zsh.nix | 7 - flake.lock | 500 +++++++++++++++++++++++++++++++++++-- hosts/default/home.nix | 1 + 4 files changed, 476 insertions(+), 34 deletions(-) diff --git a/common/discord/discord.nix b/common/discord/discord.nix index 536120d..95329bf 100644 --- a/common/discord/discord.nix +++ b/common/discord/discord.nix @@ -1,4 +1,4 @@ -{ config, pkgs, inputs, ... }: +{ pkgs, ... }: { home.packages = with pkgs; [ diff --git a/common/zsh.nix b/common/zsh.nix index 34dcdcf..fbba399 100644 --- a/common/zsh.nix +++ b/common/zsh.nix @@ -18,13 +18,6 @@ utest = "sudo nixos-rebuild test --flake $HOME/nixos#default"; update = "sudo nixos-rebuild switch --flake $HOME/nixos#default"; }; - initExtra = '' -nrun() { - NIXPKGS_ALLOW_UNFREE=1 nix run --impure "nixpkgs#$1" -} - -[ "$TERM" = "xterm-kitty" ] && alias ssh="kitty +kitten ssh" - ''; history = { path = "${config.xdg.dataHome}/zsh/history"; size = 10000; diff --git a/flake.lock b/flake.lock index 43623ed..a9531d1 100644 --- a/flake.lock +++ b/flake.lock @@ -36,9 +36,31 @@ "type": "github" } }, + "crane": { + "inputs": { + "nixpkgs": [ + "lazy", + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1710003968, + "narHash": "sha256-g8+K+mLiNG5uch35Oy9oDQBAmGSkCcqrd0Jjme7xiG0=", + "owner": "ipetkov", + "repo": "crane", + "rev": "10484f86201bb94bd61ecc5335b1496794fedb78", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "devshell": { "inputs": { - "flake-utils": "flake-utils", + "flake-utils": "flake-utils_4", "nixpkgs": [ "nixvim", "nixpkgs" @@ -79,17 +101,19 @@ } }, "flake-compat": { + "flake": false, "locked": { "lastModified": 1696426674, "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", - "revCount": 57, - "type": "tarball", - "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + "type": "github" }, "original": { - "type": "tarball", - "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" } }, "flake-compat_2": { @@ -108,7 +132,59 @@ "type": "github" } }, + "flake-compat_3": { + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "revCount": 57, + "type": "tarball", + "url": "https://api.flakehub.com/f/pinned/edolstra/flake-compat/1.0.1/018afb31-abd1-7bff-a5e4-cff7e18efb7a/source.tar.gz" + }, + "original": { + "type": "tarball", + "url": "https://flakehub.com/f/edolstra/flake-compat/1.tar.gz" + } + }, + "flake-compat_4": { + "flake": false, + "locked": { + "lastModified": 1696426674, + "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "lazy", + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1709336216, + "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { "inputs": { "nixpkgs-lib": [ "nixvim", @@ -133,6 +209,60 @@ "inputs": { "systems": "systems_3" }, + "locked": { + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_4" + }, + "locked": { + "lastModified": 1709126324, + "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_3": { + "inputs": { + "systems": "systems_5" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_4": { + "inputs": { + "systems": "systems_6" + }, "locked": { "lastModified": 1701680307, "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=", @@ -147,9 +277,9 @@ "type": "github" } }, - "flake-utils_2": { + "flake-utils_5": { "inputs": { - "systems": "systems_4" + "systems": "systems_7" }, "locked": { "lastModified": 1710146030, @@ -166,6 +296,29 @@ } }, "gitignore": { + "inputs": { + "nixpkgs": [ + "lazy", + "lanzaboote", + "pre-commit-hooks-nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1703887061, + "narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "gitignore_2": { "inputs": { "nixpkgs": [ "nixvim", @@ -208,6 +361,27 @@ } }, "home-manager_2": { + "inputs": { + "nixpkgs": [ + "lazy", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1710532761, + "narHash": "sha256-SUXGZNrXX05YA9G6EmgupxhOr3swI1gcxLUeDMUhrEY=", + "owner": "nix-community", + "repo": "home-manager", + "rev": "206f457fffdb9a73596a4cb2211a471bd305243d", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "home-manager", + "type": "github" + } + }, + "home-manager_3": { "inputs": { "nixpkgs": [ "nixvim", @@ -267,11 +441,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1712160491, - "narHash": "sha256-OQmbZnMPex/66HmyD7SKN5eKcyLR6ZCzHn/i/YF61qE=", + "lastModified": 1712177839, + "narHash": "sha256-RaHzysRIdkbOpkKwnjq349DbVcl4eyu2P4D0ber+ngk=", "owner": "hyprwm", "repo": "hyprland", - "rev": "93915502d2677b70382b7cba09620b445f6b832e", + "rev": "36a8ae9bda4c2e150707e7ee0cb13ef3e8841728", "type": "github" }, "original": { @@ -353,6 +527,56 @@ "type": "github" } }, + "lanzaboote": { + "inputs": { + "crane": "crane", + "flake-compat": "flake-compat", + "flake-parts": "flake-parts", + "flake-utils": "flake-utils_2", + "nixpkgs": "nixpkgs", + "pre-commit-hooks-nix": "pre-commit-hooks-nix", + "rust-overlay": "rust-overlay" + }, + "locked": { + "lastModified": 1710171982, + "narHash": "sha256-WFMB+Yohcvego1/vOtaq+MJ8Wvp5meOANfNifg26Ie4=", + "owner": "nix-community", + "repo": "lanzaboote", + "rev": "19ad7fd5724f30868748b8156ff25be838cd2bc5", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "lanzaboote", + "type": "github" + } + }, + "lazy": { + "inputs": { + "flake-utils": "flake-utils", + "home-manager": "home-manager_2", + "lanzaboote": "lanzaboote", + "nix-index-database": "nix-index-database", + "nixos-hardware": "nixos-hardware", + "nixpkgs": [ + "nixpkgs" + ], + "nixpkgs-ruby": "nixpkgs-ruby" + }, + "locked": { + "lastModified": 1710540097, + "narHash": "sha256-QxSNnvmdQJHCw+xfIC9UQuSFTQyaa+ArZSLJ5Oeks1I=", + "owner": "bobvanderlinden", + "repo": "nixos-config", + "rev": "ccb15cbd521acafecbc5163835ae7df90041da36", + "type": "github" + }, + "original": { + "owner": "bobvanderlinden", + "repo": "nixos-config", + "type": "github" + } + }, "nix-colors": { "inputs": { "base16-schemes": "base16-schemes", @@ -393,18 +617,51 @@ "type": "github" } }, - "nixpkgs": { + "nix-index-database": { + "inputs": { + "nixpkgs": "nixpkgs_2" + }, "locked": { - "lastModified": 1711703276, - "narHash": "sha256-iMUFArF0WCatKK6RzfUJknjem0H9m4KgorO/p3Dopkk=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "d8fe5e6c92d0d190646fb9f1056741a229980089", + "lastModified": 1710120787, + "narHash": "sha256-tlLuB73OCOKtU2j83bQzSYFyzjJo3rjpITZE5MoofG8=", + "owner": "nix-community", + "repo": "nix-index-database", + "rev": "e76ff2df6bfd2abe06abd8e7b9f217df941c1b07", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable", + "owner": "nix-community", + "repo": "nix-index-database", + "type": "github" + } + }, + "nixos-hardware": { + "locked": { + "lastModified": 1710123225, + "narHash": "sha256-j3oWlxRZxB7cFsgEntpH3rosjFHRkAo/dhX9H3OfxtY=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "ad2fd7b978d5e462048729a6c635c45d3d33c9ba", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1710078301, + "narHash": "sha256-BQ3v+XPPz5dLiw2AqUEga++yfKRhqJANUqzqNL518pk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "73d699a6ff1e83df3fd6c1e60931e13667b8ae14", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable-small", "repo": "nixpkgs", "type": "github" } @@ -424,12 +681,96 @@ "type": "github" } }, + "nixpkgs-ruby": { + "inputs": { + "flake-compat": "flake-compat_2", + "flake-utils": "flake-utils_3", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1710016297, + "narHash": "sha256-LzjkrpUD1TwuLqN5ICMssQFG1k5hRIDuoocUaUOx7Nc=", + "owner": "bobvanderlinden", + "repo": "nixpkgs-ruby", + "rev": "f0b1f991ac0950ce9952c76f5a261b2d902114ee", + "type": "github" + }, + "original": { + "owner": "bobvanderlinden", + "repo": "nixpkgs-ruby", + "type": "github" + } + }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1704874635, + "narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_2": { + "locked": { + "lastModified": 1709703039, + "narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { + "locked": { + "lastModified": 1700787330, + "narHash": "sha256-4VIBCyfqnEsdVP/SgKZ3rudwzxGdEqpKfgoWETs/I6k=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "7f7851dfc570812c305d89438681b715a4f7beba", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.11", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_4": { + "locked": { + "lastModified": 1712122226, + "narHash": "sha256-pmgwKs8Thu1WETMqCrWUm0CkN1nmCKX3b51+EXsAZyY=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "08b9151ed40350725eb40b1fe96b0b86304a654b", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixvim": { "inputs": { "devshell": "devshell", - "flake-compat": "flake-compat", - "flake-parts": "flake-parts", - "home-manager": "home-manager_2", + "flake-compat": "flake-compat_3", + "flake-parts": "flake-parts_2", + "home-manager": "home-manager_3", "nix-darwin": "nix-darwin", "nixpkgs": [ "nixpkgs" @@ -452,9 +793,9 @@ }, "pre-commit-hooks": { "inputs": { - "flake-compat": "flake-compat_2", - "flake-utils": "flake-utils_2", - "gitignore": "gitignore", + "flake-compat": "flake-compat_4", + "flake-utils": "flake-utils_5", + "gitignore": "gitignore_2", "nixpkgs": [ "nixvim", "nixpkgs" @@ -478,17 +819,79 @@ "type": "github" } }, + "pre-commit-hooks-nix": { + "inputs": { + "flake-compat": [ + "lazy", + "lanzaboote", + "flake-compat" + ], + "flake-utils": [ + "lazy", + "lanzaboote", + "flake-utils" + ], + "gitignore": "gitignore", + "nixpkgs": [ + "lazy", + "lanzaboote", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1708018599, + "narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "root": { "inputs": { "automapaper": "automapaper", "disko": "disko", "home-manager": "home-manager", "hyprland": "hyprland", + "lazy": "lazy", "nix-colors": "nix-colors", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_4", "nixvim": "nixvim" } }, + "rust-overlay": { + "inputs": { + "flake-utils": [ + "lazy", + "lanzaboote", + "flake-utils" + ], + "nixpkgs": [ + "lazy", + "lanzaboote", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1710036830, + "narHash": "sha256-pnV4gO3N/7/GzyRSKTRlSfS/19KJiPSvYcL4apnSkoQ=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "d09dac6a63a2ac4b74ac2ecdc19acd8c46c2da2c", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "systems": { "locked": { "lastModified": 1689347949, @@ -549,6 +952,51 @@ "type": "github" } }, + "systems_5": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_6": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_7": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "wlroots": { "flake": false, "locked": { diff --git a/hosts/default/home.nix b/hosts/default/home.nix index f98be27..dae6874 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -6,6 +6,7 @@ inputs.nixvim.homeManagerModules.nixvim ../../common/zsh.nix ../../modules/hyprland.nix + ../../common/kitty.nix ../../common/git.nix ../../common/nvim/nvim.nix ../../common/discord/discord.nix From 14c475debdace8cf3922df1b48693392dac3c249 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 4 Apr 2024 14:40:35 +0200 Subject: [PATCH 07/22] add wofi lazy (WIP!!) --- flake.nix | 7 ++++++- hosts/default/home.nix | 32 +++++++++++++++++++++----------- modules/wofi.nix | 17 ++++++++++++++++- 3 files changed, 43 insertions(+), 13 deletions(-) diff --git a/flake.nix b/flake.nix index 5a7c802..cc24339 100644 --- a/flake.nix +++ b/flake.nix @@ -35,9 +35,14 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + lazy = { + url = "github:bobvanderlinden/nixos-config"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; - outputs = { self, nixpkgs, nix-colors, automapaper, disko, home-manager, hyprland, ... }@inputs: + outputs = { self, nixpkgs, nix-colors, automapaper, disko, home-manager, hyprland, lazy, ... }@inputs: { nixosConfigurations = { default = nixpkgs.lib.nixosSystem { diff --git a/hosts/default/home.nix b/hosts/default/home.nix index dae6874..d6a19ec 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -30,7 +30,10 @@ nixpkgs.config.allowUnfree = true; - modules.hyprland.enable = true; + modules = { + hyprland.enable = true; + wofi.lazy = true; + }; # The home.packages option allows you to install Nix packages into your # environment. @@ -43,8 +46,6 @@ mtr obs-studio - steam-run - steam-tui wayvnc btop @@ -100,17 +101,26 @@ xdg = { enable = true; + userDirs = { + enable = true; + createDirectories = true; + }; + portal = { + enable = true; + extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; + }; + mimeApps = { + enable = true; + associations.added = { + "video/mp4" = [ "mpv.out.desktop" ]; + }; + defaultApplications = { + "video/mp4" = [ "mpv.out.desktop" ]; + }; + }; }; - xdg.userDirs = { - enable = true; - createDirectories = true; - }; - xdg.portal = { - enable = true; - extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; - }; dconf = { enable = true; diff --git a/modules/wofi.nix b/modules/wofi.nix index 41e9681..476b454 100644 --- a/modules/wofi.nix +++ b/modules/wofi.nix @@ -1,16 +1,31 @@ -{ lib, config, pkgs, ... }: +{ lib, config, pkgs, inputs, ... }: let cfg = config.modules.wofi; in { options.modules.wofi = { enable = lib.mkEnableOption "enable wofi app launcher"; + lazy = lib.mkEnableOption "enable lazy desktop entries"; }; imports = [ ../common/colors.nix ]; config = lib.mkIf cfg.enable { home.packages = with pkgs; [ + (lib.mkIf cfg.lazy inputs.lazy.packages.${pkgs.system}.lazy-desktop) + (lib.mkIf cfg.lazy (writeShellApplication { + name = "lo"; + runtimeInputs = [ xdg-utils ]; + text = '' + echo "opening $*" + xdg-open "$*" + ''; + })) + (lib.mkIf cfg.lazy (writeShellApplication { + name = "mt"; + runtimeInputs = [ xdg-utils ]; + text = ''xdg-mime query filetype "$@"''; + })) (writeShellScriptBin "wofi-launch" '' ${wofi}/bin/wofi --show drun '') From aec5ebb2f399a6e602d7c050c35cb1dbf288f98f Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 4 Apr 2024 14:46:40 +0200 Subject: [PATCH 08/22] disable wofi lazy --- hosts/default/home.nix | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/hosts/default/home.nix b/hosts/default/home.nix index d6a19ec..14995f5 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -1,4 +1,4 @@ -{ config, pkgs, inputs, ... }: +{ config, pkgs, inputs, lib, ... }: { imports = @@ -32,7 +32,7 @@ modules = { hyprland.enable = true; - wofi.lazy = true; + wofi.lazy = false; }; # The home.packages option allows you to install Nix packages into your @@ -48,6 +48,8 @@ obs-studio wayvnc + (lib.mkIf (!config.modules.wofi.lazy) steam-run) + btop dconf @@ -109,7 +111,7 @@ enable = true; extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; }; - mimeApps = { + mimeApps = lib.mkIf config.modules.wofi.lazy { enable = true; associations.added = { "video/mp4" = [ "mpv.out.desktop" ]; From 9890562eef5534cfdb036664d36fbf7601238f65 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 4 Apr 2024 14:48:10 +0200 Subject: [PATCH 09/22] disable auto optimise store --- hosts/default/configuration.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index 000e77d..5d46ef1 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -35,7 +35,7 @@ nix = { settings = { # auto optimise every so often - auto-optimise-store = true; + # auto-optimise-store = true; experimental-features = ["nix-command" "flakes"]; substituters = ["https://hyprland.cachix.org" "https://cache.iog.io"]; trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="]; From 69b3f0555b2893d017b9616fada249c9eaa3f2de Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 4 Apr 2024 14:49:26 +0200 Subject: [PATCH 10/22] addon --- hosts/default/configuration.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index 5d46ef1..c04a602 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -40,6 +40,7 @@ substituters = ["https://hyprland.cachix.org" "https://cache.iog.io"]; trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="]; }; + optimise.automatic = true; gc.automatic = true; }; From 1ff64cddc810562523a066fb59251230bb1c8bf7 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 4 Apr 2024 14:52:22 +0200 Subject: [PATCH 11/22] update and setup auto gc --- flake.lock | 18 +++++++++--------- hosts/default/configuration.nix | 6 +++++- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/flake.lock b/flake.lock index a9531d1..069e211 100644 --- a/flake.lock +++ b/flake.lock @@ -347,11 +347,11 @@ ] }, "locked": { - "lastModified": 1712093955, - "narHash": "sha256-94I0sXz6fiVBvUAk2tg6t3UpM5rOImj4JTSTNFbg64s=", + "lastModified": 1712212014, + "narHash": "sha256-s+lbaf3nLRn1++/X2eXwY9mYCA/m9l8AvyG8beeOaXE=", "owner": "nix-community", "repo": "home-manager", - "rev": "80546b220e95a575c66c213af1b09fe255299438", + "rev": "7e91f2a0ba4b62b88591279d54f741a13e36245b", "type": "github" }, "original": { @@ -441,11 +441,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1712177839, - "narHash": "sha256-RaHzysRIdkbOpkKwnjq349DbVcl4eyu2P4D0ber+ngk=", + "lastModified": 1712216965, + "narHash": "sha256-U1cFbnIrzyf+1IUrVBLH8U5r1vVcQ07lVVukwuFbgZU=", "owner": "hyprwm", "repo": "hyprland", - "rev": "36a8ae9bda4c2e150707e7ee0cb13ef3e8841728", + "rev": "81766647f2dc34013a62066edd191426b8f16a42", "type": "github" }, "original": { @@ -778,11 +778,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1712057047, - "narHash": "sha256-o5KSQO82/sCgaaSsZONTeb+P47MXo0bbp+eID9I0CwI=", + "lastModified": 1712234256, + "narHash": "sha256-UKt7HrwYc9xab+gDb5C24V75MVKfHW2VsZ6qL28my6Q=", "owner": "nix-community", "repo": "nixvim", - "rev": "7baefc8aa587931827797db7fbd55a733179dc79", + "rev": "2c99cefa913c8afb8fa08e53608c6f8bd5a2e5c4", "type": "github" }, "original": { diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index c04a602..f34f952 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -41,7 +41,11 @@ trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="]; }; optimise.automatic = true; - gc.automatic = true; + gc = { + automatic = true; + interval = "weekly"; + options = "--delete-older-than 7d"; + }; }; # Set your time zone. From 0ccf17edf3e67820a909082adb6201a235405f6b Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 4 Apr 2024 14:53:44 +0200 Subject: [PATCH 12/22] fix typo --- hosts/default/configuration.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index f34f952..9b0dbdd 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -43,7 +43,7 @@ optimise.automatic = true; gc = { automatic = true; - interval = "weekly"; + dates = "weekly"; options = "--delete-older-than 7d"; }; }; From dfd670732624f1a963505403d8507839102ab49e Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 4 Apr 2024 15:55:44 +0200 Subject: [PATCH 13/22] update flake --- flake.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flake.lock b/flake.lock index 069e211..fccce20 100644 --- a/flake.lock +++ b/flake.lock @@ -751,11 +751,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1712122226, - "narHash": "sha256-pmgwKs8Thu1WETMqCrWUm0CkN1nmCKX3b51+EXsAZyY=", + "lastModified": 1712163089, + "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "08b9151ed40350725eb40b1fe96b0b86304a654b", + "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", "type": "github" }, "original": { From ab61e6fc037ace60027b668e88901689d1f5c965 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Fri, 5 Apr 2024 12:39:55 +0200 Subject: [PATCH 14/22] open default http ports --- common/nvim/init.lua | 1 + hosts/default/configuration.nix | 11 ++++++++--- hosts/default/home.nix | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/common/nvim/init.lua b/common/nvim/init.lua index 858c11b..cf5783c 100644 --- a/common/nvim/init.lua +++ b/common/nvim/init.lua @@ -489,6 +489,7 @@ require("lazy").setup({ html = { filetypes = { "html", "twig", "hbs" } }, templ = { filetypes = { "templ" } }, nil_ls = {}, + ocamllsp = {}, -- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs -- -- Some languages (like typescript) have entire language plugins that can be useful: diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index 9b0dbdd..59478a4 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -20,7 +20,12 @@ hardware.enableRedistributableFirmware = true; hardware.enableAllFirmware = true; - networking.hostName = "lambdaOS"; # Define your hostname. + networking = { + hostName = "lambdaOS"; # Define your hostname. + extraHosts = '' + ::1 noa.voorwaarts.nl + ''; + }; # networking.wireless.enable = true; # Enables wireless support via wpa_supplicant. # Configure network proxy if necessary @@ -219,8 +224,8 @@ }; # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ 2000 ]; - networking.firewall.allowedUDPPorts = [ 2000 ]; + networking.firewall.allowedTCPPorts = [ 80 443 ]; + networking.firewall.allowedUDPPorts = [ 80 443 ]; # Or disable the firewall altogether. # networking.firewall.enable = false; diff --git a/hosts/default/home.nix b/hosts/default/home.nix index 14995f5..9e71ba8 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -61,6 +61,7 @@ # Programming langs go nodejs + opam ]; From e7608a6c3d943b32ec05fc3636fde83fccf08e2e Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Fri, 5 Apr 2024 12:42:49 +0200 Subject: [PATCH 15/22] update flake --- flake.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/flake.lock b/flake.lock index fccce20..c8f18d3 100644 --- a/flake.lock +++ b/flake.lock @@ -347,11 +347,11 @@ ] }, "locked": { - "lastModified": 1712212014, - "narHash": "sha256-s+lbaf3nLRn1++/X2eXwY9mYCA/m9l8AvyG8beeOaXE=", + "lastModified": 1712266167, + "narHash": "sha256-gr2CBgT8t+utDqzWSp2vSjX/c39Q0BNtrWE6/cDhhEE=", "owner": "nix-community", "repo": "home-manager", - "rev": "7e91f2a0ba4b62b88591279d54f741a13e36245b", + "rev": "0c73c1b8da28a24c4fe842ced3f2548d5828b550", "type": "github" }, "original": { @@ -441,11 +441,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1712216965, - "narHash": "sha256-U1cFbnIrzyf+1IUrVBLH8U5r1vVcQ07lVVukwuFbgZU=", + "lastModified": 1712288444, + "narHash": "sha256-UzfzS/4vGyeowWW9gYvAq3mj4MOzC2I7a9XRqsCKED4=", "owner": "hyprwm", "repo": "hyprland", - "rev": "81766647f2dc34013a62066edd191426b8f16a42", + "rev": "baad44b4ca28d62fb9d86ed1f83650b6695b501d", "type": "github" }, "original": { @@ -778,11 +778,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1712234256, - "narHash": "sha256-UKt7HrwYc9xab+gDb5C24V75MVKfHW2VsZ6qL28my6Q=", + "lastModified": 1712299511, + "narHash": "sha256-yrBK6Jq0UuJjP+nc01OFNoKRRJgPNkbmwPpE4mD2Bis=", "owner": "nix-community", "repo": "nixvim", - "rev": "2c99cefa913c8afb8fa08e53608c6f8bd5a2e5c4", + "rev": "f285a958c089ccbca9c5710d4a075683fa1af654", "type": "github" }, "original": { From 578cb7f3a9329f39c91ed8d494c398a4105e6926 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Fri, 5 Apr 2024 13:58:29 +0200 Subject: [PATCH 16/22] If I can find out how to make it work without the double definition i'll be happy --- modules/hyprland.nix | 4 ++-- modules/waybar/allmodules.nix | 4 ++++ modules/waybar/createmodules.nix | 1 + modules/waybar/default.nix | 7 +------ modules/waybar/namedmodules.nix | 4 ++++ modules/waybar/power.nix | 2 +- 6 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 modules/waybar/allmodules.nix create mode 100644 modules/waybar/createmodules.nix create mode 100644 modules/waybar/namedmodules.nix diff --git a/modules/hyprland.nix b/modules/hyprland.nix index af39b3b..2f4b93d 100644 --- a/modules/hyprland.nix +++ b/modules/hyprland.nix @@ -25,12 +25,12 @@ in config = lib.mkIf cfg.enable { modules = { waybar = { - enable = lib.mkDefault true; modules = { left = [ "hyprland/workspaces" "tray" "hyprland/window" ]; center = [ "clock" ]; - right = [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "temperature" "custom/poweroff" ]; + right = [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "custom/poweroff" ]; }; + enable = lib.mkDefault true; }; wofi.enable = lib.mkDefault true; dunst.enable = lib.mkDefault true; diff --git a/modules/waybar/allmodules.nix b/modules/waybar/allmodules.nix new file mode 100644 index 0000000..ebe8b5a --- /dev/null +++ b/modules/waybar/allmodules.nix @@ -0,0 +1,4 @@ +config: + [ "hyprland/workspaces" "tray" "hyprland/window" ] ++ + [ "clock" ] ++ + [ "custom/vpn" "wireplumber" "network" "cpu" "memory" "custom/poweroff" ] diff --git a/modules/waybar/createmodules.nix b/modules/waybar/createmodules.nix new file mode 100644 index 0000000..ed2e6d5 --- /dev/null +++ b/modules/waybar/createmodules.nix @@ -0,0 +1 @@ +config: builtins.listToAttrs (import ./namedmodules.nix config) diff --git a/modules/waybar/default.nix b/modules/waybar/default.nix index a8fa83f..757f380 100644 --- a/modules/waybar/default.nix +++ b/modules/waybar/default.nix @@ -1,8 +1,6 @@ { config, pkgs, lib, ... }: let cfg = config.modules.waybar; - - ifIsDef = name: builtins.any (row: builtins.any (x: x == name) row) (with cfg.modules; [left center right]); in { options.modules.waybar = { @@ -42,10 +40,7 @@ in ]; config = lib.mkIf cfg.enable { - modules.waybar = { - clock.enable = ifIsDef "clock"; - "hyprland/workspaces".enable = ifIsDef "hyprland/workspaces"; - }; + modules.waybar = import ./createmodules.nix cfg.modules; home.packages = with pkgs; [ font-awesome ]; diff --git a/modules/waybar/namedmodules.nix b/modules/waybar/namedmodules.nix new file mode 100644 index 0000000..6d8b7fa --- /dev/null +++ b/modules/waybar/namedmodules.nix @@ -0,0 +1,4 @@ +config: + builtins.map + (n: {name = n; value = {enable = true;}; }) + (import ./allmodules.nix config) diff --git a/modules/waybar/power.nix b/modules/waybar/power.nix index 3b3e2c1..67d571e 100644 --- a/modules/waybar/power.nix +++ b/modules/waybar/power.nix @@ -15,7 +15,7 @@ in programs.waybar.settings.mainBar."${name}" = { format = ""; on-click = "wofi-power"; - # on-click-right = "swaylock"; # TODO: change to whatever lock screen i want + on-click-right = "swaylock"; # TODO: change to whatever lock screen i want }; }; } From a3ce0049a0f63c87fb2dac479aa640a0082f4e75 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Fri, 5 Apr 2024 16:23:19 +0200 Subject: [PATCH 17/22] remove mimetypes, maybe this fixes wl-paste types --- hosts/default/home.nix | 9 --------- 1 file changed, 9 deletions(-) diff --git a/hosts/default/home.nix b/hosts/default/home.nix index 9e71ba8..711646c 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -112,15 +112,6 @@ enable = true; extraPortals = [ pkgs.xdg-desktop-portal-hyprland ]; }; - mimeApps = lib.mkIf config.modules.wofi.lazy { - enable = true; - associations.added = { - "video/mp4" = [ "mpv.out.desktop" ]; - }; - defaultApplications = { - "video/mp4" = [ "mpv.out.desktop" ]; - }; - }; }; From ac6892bcd2ed83a666958cb45d878fcdf827033b Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Tue, 9 Apr 2024 14:23:08 +0200 Subject: [PATCH 18/22] make screenshots hyprshot --- flake.lock | 21 +++++++++++++++++++++ flake.nix | 5 +++++ modules/hyprland.nix | 7 +++---- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/flake.lock b/flake.lock index c8f18d3..3d6b6cc 100644 --- a/flake.lock +++ b/flake.lock @@ -527,6 +527,26 @@ "type": "github" } }, + "hyprpicker": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1711283076, + "narHash": "sha256-Cda+XbHpvyz3HhdJ7FlXFoaazOWtdBoOWmEaj4ZFwRM=", + "owner": "hyprwm", + "repo": "hyprpicker", + "rev": "0eb49192a5cdd5e6e8e6c2c82c33857d78d6cd56", + "type": "github" + }, + "original": { + "owner": "hyprwm", + "repo": "hyprpicker", + "type": "github" + } + }, "lanzaboote": { "inputs": { "crane": "crane", @@ -859,6 +879,7 @@ "disko": "disko", "home-manager": "home-manager", "hyprland": "hyprland", + "hyprpicker": "hyprpicker", "lazy": "lazy", "nix-colors": "nix-colors", "nixpkgs": "nixpkgs_4", diff --git a/flake.nix b/flake.nix index cc24339..266ba00 100644 --- a/flake.nix +++ b/flake.nix @@ -30,6 +30,11 @@ inputs.nixpkgs.follows = "nixpkgs"; }; + hyprpicker = { + url = "github:hyprwm/hyprpicker"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + disko = { url = "github:nix-community/disko"; inputs.nixpkgs.follows = "nixpkgs"; diff --git a/modules/hyprland.nix b/modules/hyprland.nix index 2f4b93d..c2696a2 100644 --- a/modules/hyprland.nix +++ b/modules/hyprland.nix @@ -41,8 +41,8 @@ in libnotify # to enable the notify-send command wl-clipboard - slurp - grim + inputs.hyprpicker + hyprshot hypridle # TODO: remove when fixed with config playerctl @@ -123,8 +123,7 @@ in "$mod,F,togglefloating" "$mod,X,togglespecialworkspace" "SUPERSHIFT,X,movetoworkspace,special" - "$mod,Print,exec,grim - | wl-copy && notify-send 'Screenshot Copied to Clipboard'" - "SUPERSHIFT,S,exec,slurp | grim -g - /tmp/photo && wl-copy < /tmp/photo && notify-send 'Screenshot Copied to Clipboard'" + "SUPERSHIFT,S,exec,hyprshot -m region --clipboard-only" "$mod,f11,fullscreen,0" ",XF86AudioLowerVolume,exec,wpctl set-volume @DEFAULT_SINK@ 1%-" ",XF86AudioRaiseVolume,exec,wpctl set-volume @DEFAULT_SINK@ 1%+" From d7ff7490fdd77744f957f33006e1fbd480b924c6 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Tue, 9 Apr 2024 14:24:14 +0200 Subject: [PATCH 19/22] update flake --- flake.lock | 211 ++++++++++++++++++++++------------------------------- 1 file changed, 88 insertions(+), 123 deletions(-) diff --git a/flake.lock b/flake.lock index 3d6b6cc..8026895 100644 --- a/flake.lock +++ b/flake.lock @@ -45,11 +45,11 @@ ] }, "locked": { - "lastModified": 1710003968, - "narHash": "sha256-g8+K+mLiNG5uch35Oy9oDQBAmGSkCcqrd0Jjme7xiG0=", + "lastModified": 1711299236, + "narHash": "sha256-6/JsyozOMKN8LUGqWMopKTSiK8N79T8Q+hcxu2KkTXg=", "owner": "ipetkov", "repo": "crane", - "rev": "10484f86201bb94bd61ecc5335b1496794fedb78", + "rev": "880573f80d09e18a11713f402b9e6172a085449f", "type": "github" }, "original": { @@ -87,11 +87,11 @@ ] }, "locked": { - "lastModified": 1711934712, - "narHash": "sha256-sBDe+QmX/QohlnKeSEzrftcXyZL5FY09OMjZ59Rpyy4=", + "lastModified": 1712612224, + "narHash": "sha256-Tv4C8OSPVmm4LbpJGLFSODyvJy6DqrisEGPCQdNVOeY=", "owner": "nix-community", "repo": "disko", - "rev": "611c9ea53250f7bb22286b3d26872280a0e608f9", + "rev": "79eab0e82cb126bf4ac170f44af82479f0895ab5", "type": "github" }, "original": { @@ -192,11 +192,11 @@ ] }, "locked": { - "lastModified": 1709336216, - "narHash": "sha256-Dt/wOWeW6Sqm11Yh+2+t0dfEWxoMxGBvv3JpIocFl9E=", + "lastModified": 1712014858, + "narHash": "sha256-sB4SWl2lX95bExY2gMFG5HIzvva5AVMJd4Igm+GpZNw=", "owner": "hercules-ci", "repo": "flake-parts", - "rev": "f7b3c975cf067e56e7cda6cb098ebe3fb4d74ca2", + "rev": "9126214d0a59633752a136528f5f3b9aa8565b7d", "type": "github" }, "original": { @@ -207,7 +207,7 @@ }, "flake-utils": { "inputs": { - "systems": "systems_3" + "systems": "systems_2" }, "locked": { "lastModified": 1710146030, @@ -225,14 +225,14 @@ }, "flake-utils_2": { "inputs": { - "systems": "systems_4" + "systems": "systems_3" }, "locked": { - "lastModified": 1709126324, - "narHash": "sha256-q6EQdSeUZOG26WelxqkmR7kArjgWCdw5sfJVHPH/7j8=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "d465f4819400de7c8d874d50b982301f28a84605", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -243,7 +243,7 @@ }, "flake-utils_3": { "inputs": { - "systems": "systems_5" + "systems": "systems_4" }, "locked": { "lastModified": 1694529238, @@ -261,7 +261,7 @@ }, "flake-utils_4": { "inputs": { - "systems": "systems_6" + "systems": "systems_5" }, "locked": { "lastModified": 1701680307, @@ -279,7 +279,7 @@ }, "flake-utils_5": { "inputs": { - "systems": "systems_7" + "systems": "systems_6" }, "locked": { "lastModified": 1710146030, @@ -305,11 +305,11 @@ ] }, "locked": { - "lastModified": 1703887061, - "narHash": "sha256-gGPa9qWNc6eCXT/+Z5/zMkyYOuRZqeFZBDbopNZQkuY=", + "lastModified": 1709087332, + "narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=", "owner": "hercules-ci", "repo": "gitignore.nix", - "rev": "43e1aa1308018f37118e34d3a9cb4f5e75dc11d5", + "rev": "637db329424fd7e46cf4185293b9cc8c88c95394", "type": "github" }, "original": { @@ -347,11 +347,11 @@ ] }, "locked": { - "lastModified": 1712266167, - "narHash": "sha256-gr2CBgT8t+utDqzWSp2vSjX/c39Q0BNtrWE6/cDhhEE=", + "lastModified": 1712645849, + "narHash": "sha256-67v20E0gH7nvAaMsah2oRIocnxGO25fATUyzQHIywxQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "0c73c1b8da28a24c4fe842ced3f2548d5828b550", + "rev": "40a99619da804a78a0b166e5c6911108c059c3a8", "type": "github" }, "original": { @@ -368,11 +368,11 @@ ] }, "locked": { - "lastModified": 1710532761, - "narHash": "sha256-SUXGZNrXX05YA9G6EmgupxhOr3swI1gcxLUeDMUhrEY=", + "lastModified": 1712462372, + "narHash": "sha256-WA3bbBWhd3o1wAgyHZNypjb/LG4oq+IWxFq8ey8yNPU=", "owner": "nix-community", "repo": "home-manager", - "rev": "206f457fffdb9a73596a4cb2211a471bd305243d", + "rev": "a561ad6ab38578c812cc9af3b04f2cc60ebf48c9", "type": "github" }, "original": { @@ -389,11 +389,11 @@ ] }, "locked": { - "lastModified": 1711625603, - "narHash": "sha256-W+9dfqA9bqUIBV5u7jaIARAzMe3kTq/Hp2SpSVXKRQw=", + "lastModified": 1712645849, + "narHash": "sha256-67v20E0gH7nvAaMsah2oRIocnxGO25fATUyzQHIywxQ=", "owner": "nix-community", "repo": "home-manager", - "rev": "c0ef0dab55611c676ad7539bf4e41b3ec6fa87d2", + "rev": "40a99619da804a78a0b166e5c6911108c059c3a8", "type": "github" }, "original": { @@ -404,7 +404,10 @@ }, "hyprcursor": { "inputs": { - "hyprlang": "hyprlang", + "hyprlang": [ + "hyprland", + "hyprlang" + ], "nixpkgs": [ "hyprland", "nixpkgs" @@ -415,11 +418,11 @@ ] }, "locked": { - "lastModified": 1711466786, - "narHash": "sha256-sArxGyUBiCA1in+q6t0QqT+ZJiZ1PyBp7cNPKLmREM0=", + "lastModified": 1712434681, + "narHash": "sha256-qwmR2p1oc48Bj7gUDvb1oGL19Rjs2PmEmk4ChV01A5o=", "owner": "hyprwm", "repo": "hyprcursor", - "rev": "d3876f34779cc03ee51e4aafc0d00a4f187c7544", + "rev": "818d8c4b69e0997483d60b75f701fe14b561a7a3", "type": "github" }, "original": { @@ -432,20 +435,20 @@ "inputs": { "hyprcursor": "hyprcursor", "hyprland-protocols": "hyprland-protocols", - "hyprlang": "hyprlang_2", + "hyprlang": "hyprlang", "nixpkgs": [ "nixpkgs" ], - "systems": "systems_2", + "systems": "systems", "wlroots": "wlroots", "xdph": "xdph" }, "locked": { - "lastModified": 1712288444, - "narHash": "sha256-UzfzS/4vGyeowWW9gYvAq3mj4MOzC2I7a9XRqsCKED4=", + "lastModified": 1712660918, + "narHash": "sha256-SAr0nHfbcIsgesCubKXUy+L19tyZBW1SM8tDWImg9Ck=", "owner": "hyprwm", "repo": "hyprland", - "rev": "baad44b4ca28d62fb9d86ed1f83650b6695b501d", + "rev": "fcac25bcc2496dc248e9ee912d95ec38b5397acd", "type": "github" }, "original": { @@ -480,29 +483,6 @@ } }, "hyprlang": { - "inputs": { - "nixpkgs": [ - "hyprland", - "hyprcursor", - "nixpkgs" - ], - "systems": "systems" - }, - "locked": { - "lastModified": 1709914708, - "narHash": "sha256-bR4o3mynoTa1Wi4ZTjbnsZ6iqVcPGriXp56bZh5UFTk=", - "owner": "hyprwm", - "repo": "hyprlang", - "rev": "a685493fdbeec01ca8ccdf1f3655c044a8ce2fe2", - "type": "github" - }, - "original": { - "owner": "hyprwm", - "repo": "hyprlang", - "type": "github" - } - }, - "hyprlang_2": { "inputs": { "nixpkgs": [ "hyprland", @@ -514,11 +494,11 @@ ] }, "locked": { - "lastModified": 1711250455, - "narHash": "sha256-LSq1ZsTpeD7xsqvlsepDEelWRDtAhqwetp6PusHXJRo=", + "lastModified": 1711671891, + "narHash": "sha256-C/Wwsy/RLxHP1axFFl+AnwJRWfd8gxDKKoa8nt8Qk3c=", "owner": "hyprwm", "repo": "hyprlang", - "rev": "b3e430f81f3364c5dd1a3cc9995706a4799eb3fa", + "rev": "c1402612146ba06606ebf64963a02bc1efe11e74", "type": "github" }, "original": { @@ -558,11 +538,11 @@ "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1710171982, - "narHash": "sha256-WFMB+Yohcvego1/vOtaq+MJ8Wvp5meOANfNifg26Ie4=", + "lastModified": 1712261512, + "narHash": "sha256-qsBZ3tJj/3LR8jNYyCKjyCe0ePj4cMynSWBMC1OEDtc=", "owner": "nix-community", "repo": "lanzaboote", - "rev": "19ad7fd5724f30868748b8156ff25be838cd2bc5", + "rev": "999c0cb03f748fe311bca78961dbf0562dc91659", "type": "github" }, "original": { @@ -584,11 +564,11 @@ "nixpkgs-ruby": "nixpkgs-ruby" }, "locked": { - "lastModified": 1710540097, - "narHash": "sha256-QxSNnvmdQJHCw+xfIC9UQuSFTQyaa+ArZSLJ5Oeks1I=", + "lastModified": 1712648847, + "narHash": "sha256-auZu5WiFWOu+yEFYB7v5lgeXLSmAk3EeXHzp85epG+U=", "owner": "bobvanderlinden", "repo": "nixos-config", - "rev": "ccb15cbd521acafecbc5163835ae7df90041da36", + "rev": "6fe28f644466a767c9793692f8f79885184a8e64", "type": "github" }, "original": { @@ -642,11 +622,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1710120787, - "narHash": "sha256-tlLuB73OCOKtU2j83bQzSYFyzjJo3rjpITZE5MoofG8=", + "lastModified": 1712459390, + "narHash": "sha256-e12bNDottaGoBgd0AdH/bQvk854xunlWAdZwr/oHO1c=", "owner": "nix-community", "repo": "nix-index-database", - "rev": "e76ff2df6bfd2abe06abd8e7b9f217df941c1b07", + "rev": "4676d72d872459e1e3a248d049609f110c570e9a", "type": "github" }, "original": { @@ -657,11 +637,11 @@ }, "nixos-hardware": { "locked": { - "lastModified": 1710123225, - "narHash": "sha256-j3oWlxRZxB7cFsgEntpH3rosjFHRkAo/dhX9H3OfxtY=", + "lastModified": 1712566108, + "narHash": "sha256-c9nT2ZODGqobISP41kUwCQ84Srwg7a/1TmPFQuol2/8=", "owner": "NixOS", "repo": "nixos-hardware", - "rev": "ad2fd7b978d5e462048729a6c635c45d3d33c9ba", + "rev": "1e3b3a35b7083f4152f5a516798cf9b21e686465", "type": "github" }, "original": { @@ -672,11 +652,11 @@ }, "nixpkgs": { "locked": { - "lastModified": 1710078301, - "narHash": "sha256-BQ3v+XPPz5dLiw2AqUEga++yfKRhqJANUqzqNL518pk=", + "lastModified": 1711297276, + "narHash": "sha256-KtHBr73Z729krfueBV6pUsEyq/4vILGP77DPmrKOTrI=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "73d699a6ff1e83df3fd6c1e60931e13667b8ae14", + "rev": "3d41d1087707826b3a90685ab69147f8dc8145d5", "type": "github" }, "original": { @@ -708,11 +688,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1710016297, - "narHash": "sha256-LzjkrpUD1TwuLqN5ICMssQFG1k5hRIDuoocUaUOx7Nc=", + "lastModified": 1711172350, + "narHash": "sha256-J4fLRjKRNkOUoELPUQ7wknAmYWKkBYGpNprTivcj2HA=", "owner": "bobvanderlinden", "repo": "nixpkgs-ruby", - "rev": "f0b1f991ac0950ce9952c76f5a261b2d902114ee", + "rev": "d6cc5a9e7f9480ff37e9b598c9898530b4391f93", "type": "github" }, "original": { @@ -723,11 +703,11 @@ }, "nixpkgs-stable": { "locked": { - "lastModified": 1704874635, - "narHash": "sha256-YWuCrtsty5vVZvu+7BchAxmcYzTMfolSPP5io8+WYCg=", + "lastModified": 1710695816, + "narHash": "sha256-3Eh7fhEID17pv9ZxrPwCLfqXnYP006RKzSs0JptsN84=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "3dc440faeee9e889fe2d1b4d25ad0f430d449356", + "rev": "614b4613980a522ba49f0d194531beddbb7220d3", "type": "github" }, "original": { @@ -739,11 +719,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1709703039, - "narHash": "sha256-6hqgQ8OK6gsMu1VtcGKBxKQInRLHtzulDo9Z5jxHEFY=", + "lastModified": 1712163089, + "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "9df3e30ce24fd28c7b3e2de0d986769db5d6225d", + "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", "type": "github" }, "original": { @@ -771,11 +751,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1712163089, - "narHash": "sha256-Um+8kTIrC19vD4/lUCN9/cU9kcOsD1O1m+axJqQPyMM=", + "lastModified": 1712439257, + "narHash": "sha256-aSpiNepFOMk9932HOax0XwNxbA38GOUVOiXfUVPOrck=", "owner": "nixos", "repo": "nixpkgs", - "rev": "fd281bd6b7d3e32ddfa399853946f782553163b5", + "rev": "ff0dbd94265ac470dda06a657d5fe49de93b4599", "type": "github" }, "original": { @@ -798,11 +778,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1712299511, - "narHash": "sha256-yrBK6Jq0UuJjP+nc01OFNoKRRJgPNkbmwPpE4mD2Bis=", + "lastModified": 1712655539, + "narHash": "sha256-Wpr4lWndkYRgs27Yl5ALJQ7n4PdDjT+Mq+8xAz2q1CY=", "owner": "nix-community", "repo": "nixvim", - "rev": "f285a958c089ccbca9c5710d4a075683fa1af654", + "rev": "512ac70ec96ee774867f5a6ae494b12f0d4ddcb9", "type": "github" }, "original": { @@ -826,11 +806,11 @@ ] }, "locked": { - "lastModified": 1711760932, - "narHash": "sha256-DqUTQ2iAAqSDwMhKBqvi24v0Oc7pD3LCK/0FCG//TdA=", + "lastModified": 1712579741, + "narHash": "sha256-igpsH+pa6yFwYOdah3cFciCk8gw+ytniG9quf5f/q84=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "c11e43aed6f17336c25cd120eac886b96c455731", + "rev": "70f504012f0a132ac33e56988e1028d88a48855c", "type": "github" }, "original": { @@ -860,11 +840,11 @@ "nixpkgs-stable": "nixpkgs-stable" }, "locked": { - "lastModified": 1708018599, - "narHash": "sha256-M+Ng6+SePmA8g06CmUZWi1AjG2tFBX9WCXElBHEKnyM=", + "lastModified": 1710923068, + "narHash": "sha256-6hOpUiuxuwpXXc/xfJsBUJeqqgGI+JMJuLo45aG3cKc=", "owner": "cachix", "repo": "pre-commit-hooks.nix", - "rev": "5df5a70ad7575f6601d91f0efec95dd9bc619431", + "rev": "e611897ddfdde3ed3eaac4758635d7177ff78673", "type": "github" }, "original": { @@ -900,11 +880,11 @@ ] }, "locked": { - "lastModified": 1710036830, - "narHash": "sha256-pnV4gO3N/7/GzyRSKTRlSfS/19KJiPSvYcL4apnSkoQ=", + "lastModified": 1711246447, + "narHash": "sha256-g9TOluObcOEKewFo2fR4cn51Y/jSKhRRo4QZckHLop0=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "d09dac6a63a2ac4b74ac2ecdc19acd8c46c2da2c", + "rev": "dcc802a6ec4e9cc6a1c8c393327f0c42666f22e4", "type": "github" }, "original": { @@ -930,16 +910,16 @@ }, "systems_2": { "locked": { - "lastModified": 1689347949, - "narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=", + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", "owner": "nix-systems", - "repo": "default-linux", - "rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", "type": "github" }, "original": { "owner": "nix-systems", - "repo": "default-linux", + "repo": "default", "type": "github" } }, @@ -1003,21 +983,6 @@ "type": "github" } }, - "systems_7": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } - }, "wlroots": { "flake": false, "locked": { From d64ce5b799e922a1dd5ad39ef173ad88a59074d1 Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Tue, 9 Apr 2024 14:37:32 +0200 Subject: [PATCH 20/22] remove lazy launching --- hosts/default/home.nix | 3 --- modules/wofi.nix | 15 --------------- 2 files changed, 18 deletions(-) diff --git a/hosts/default/home.nix b/hosts/default/home.nix index 711646c..c31de10 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -32,7 +32,6 @@ modules = { hyprland.enable = true; - wofi.lazy = false; }; # The home.packages option allows you to install Nix packages into your @@ -48,8 +47,6 @@ obs-studio wayvnc - (lib.mkIf (!config.modules.wofi.lazy) steam-run) - btop dconf diff --git a/modules/wofi.nix b/modules/wofi.nix index 476b454..42a5247 100644 --- a/modules/wofi.nix +++ b/modules/wofi.nix @@ -5,27 +5,12 @@ in { options.modules.wofi = { enable = lib.mkEnableOption "enable wofi app launcher"; - lazy = lib.mkEnableOption "enable lazy desktop entries"; }; imports = [ ../common/colors.nix ]; config = lib.mkIf cfg.enable { home.packages = with pkgs; [ - (lib.mkIf cfg.lazy inputs.lazy.packages.${pkgs.system}.lazy-desktop) - (lib.mkIf cfg.lazy (writeShellApplication { - name = "lo"; - runtimeInputs = [ xdg-utils ]; - text = '' - echo "opening $*" - xdg-open "$*" - ''; - })) - (lib.mkIf cfg.lazy (writeShellApplication { - name = "mt"; - runtimeInputs = [ xdg-utils ]; - text = ''xdg-mime query filetype "$@"''; - })) (writeShellScriptBin "wofi-launch" '' ${wofi}/bin/wofi --show drun '') From f8ddc641defaa09e4517b628696fb4a5fcd3beae Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Thu, 11 Apr 2024 21:05:24 +0200 Subject: [PATCH 21/22] update flake --- flake.lock | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/flake.lock b/flake.lock index 8026895..a38daaa 100644 --- a/flake.lock +++ b/flake.lock @@ -87,11 +87,11 @@ ] }, "locked": { - "lastModified": 1712612224, - "narHash": "sha256-Tv4C8OSPVmm4LbpJGLFSODyvJy6DqrisEGPCQdNVOeY=", + "lastModified": 1712798444, + "narHash": "sha256-aAksVB7zMfBQTz0q2Lw3o78HM3Bg2FRziX2D6qnh+sk=", "owner": "nix-community", "repo": "disko", - "rev": "79eab0e82cb126bf4ac170f44af82479f0895ab5", + "rev": "a297cb1cb0337ee10a7a0f9517954501d8f6f74d", "type": "github" }, "original": { @@ -347,11 +347,11 @@ ] }, "locked": { - "lastModified": 1712645849, - "narHash": "sha256-67v20E0gH7nvAaMsah2oRIocnxGO25fATUyzQHIywxQ=", + "lastModified": 1712759992, + "narHash": "sha256-2APpO3ZW4idlgtlb8hB04u/rmIcKA8O7pYqxF66xbNY=", "owner": "nix-community", "repo": "home-manager", - "rev": "40a99619da804a78a0b166e5c6911108c059c3a8", + "rev": "31357486b0ef6f4e161e002b6893eeb4fafc3ca9", "type": "github" }, "original": { @@ -444,11 +444,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1712660918, - "narHash": "sha256-SAr0nHfbcIsgesCubKXUy+L19tyZBW1SM8tDWImg9Ck=", + "lastModified": 1712835979, + "narHash": "sha256-m44SvLfwPc8qPpBQa5ObOtTe6RbVNfQLpn+bCdlHFxQ=", "owner": "hyprwm", "repo": "hyprland", - "rev": "fcac25bcc2496dc248e9ee912d95ec38b5397acd", + "rev": "185a3b48814cc4a1afbf32a69792a6161c4038cd", "type": "github" }, "original": { @@ -751,11 +751,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1712439257, - "narHash": "sha256-aSpiNepFOMk9932HOax0XwNxbA38GOUVOiXfUVPOrck=", + "lastModified": 1712608508, + "narHash": "sha256-vMZ5603yU0wxgyQeHJryOI+O61yrX2AHwY6LOFyV1gM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "ff0dbd94265ac470dda06a657d5fe49de93b4599", + "rev": "4cba8b53da471aea2ab2b0c1f30a81e7c451f4b6", "type": "github" }, "original": { @@ -778,11 +778,11 @@ "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1712655539, - "narHash": "sha256-Wpr4lWndkYRgs27Yl5ALJQ7n4PdDjT+Mq+8xAz2q1CY=", + "lastModified": 1712741888, + "narHash": "sha256-G4HDgs27bwy6/snFHIhU4OZKWdFBHFuxDyCkYj2L9bw=", "owner": "nix-community", "repo": "nixvim", - "rev": "512ac70ec96ee774867f5a6ae494b12f0d4ddcb9", + "rev": "ffa3020522e210fcae934f10440c24ea1d46f6ea", "type": "github" }, "original": { From 1aabb38ad83262d5eb358bec378206a41672d33c Mon Sep 17 00:00:00 2001 From: Noa Aarts Date: Fri, 12 Apr 2024 10:11:46 +0200 Subject: [PATCH 22/22] update and fix localsend --- flake.lock | 18 +++++++++--------- hosts/default/configuration.nix | 8 ++++---- hosts/default/home.nix | 1 + 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/flake.lock b/flake.lock index a38daaa..1ff464c 100644 --- a/flake.lock +++ b/flake.lock @@ -444,11 +444,11 @@ "xdph": "xdph" }, "locked": { - "lastModified": 1712835979, - "narHash": "sha256-m44SvLfwPc8qPpBQa5ObOtTe6RbVNfQLpn+bCdlHFxQ=", + "lastModified": 1712877538, + "narHash": "sha256-FK4Rhq9mEf8wpS3/K/ueB5Sql2XOeCQX/SzCe/QySNk=", "owner": "hyprwm", "repo": "hyprland", - "rev": "185a3b48814cc4a1afbf32a69792a6161c4038cd", + "rev": "b1a94302897ae559c877471f7d365651bcd24ad4", "type": "github" }, "original": { @@ -514,11 +514,11 @@ ] }, "locked": { - "lastModified": 1711283076, - "narHash": "sha256-Cda+XbHpvyz3HhdJ7FlXFoaazOWtdBoOWmEaj4ZFwRM=", + "lastModified": 1712878696, + "narHash": "sha256-pFr52cCOHVmoBe50cYGzyFX8OTwjPB6E9YMAkynd2FQ=", "owner": "hyprwm", "repo": "hyprpicker", - "rev": "0eb49192a5cdd5e6e8e6c2c82c33857d78d6cd56", + "rev": "be7a0e82c4ea3fa04eca4f941a2983256955c1d3", "type": "github" }, "original": { @@ -751,11 +751,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1712608508, - "narHash": "sha256-vMZ5603yU0wxgyQeHJryOI+O61yrX2AHwY6LOFyV1gM=", + "lastModified": 1712791164, + "narHash": "sha256-3sbWO1mbpWsLepZGbWaMovSO7ndZeFqDSdX0hZ9nVyw=", "owner": "nixos", "repo": "nixpkgs", - "rev": "4cba8b53da471aea2ab2b0c1f30a81e7c451f4b6", + "rev": "1042fd8b148a9105f3c0aca3a6177fd1d9360ba5", "type": "github" }, "original": { diff --git a/hosts/default/configuration.nix b/hosts/default/configuration.nix index 59478a4..8b7188d 100644 --- a/hosts/default/configuration.nix +++ b/hosts/default/configuration.nix @@ -42,8 +42,8 @@ # auto optimise every so often # auto-optimise-store = true; experimental-features = ["nix-command" "flakes"]; - substituters = ["https://hyprland.cachix.org" "https://cache.iog.io"]; - trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ="]; + substituters = ["https://hyprland.cachix.org" "https://cache.iog.io" "https://cuda-maintainers.cachix.org" ]; + trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc=" "hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=" "cuda-maintainers.cachix.org-1:0dq3bujKpuEPMCX6U4WylrUDZ9JyUG0VpVZa7CNfq5E=" ]; }; optimise.automatic = true; gc = { @@ -224,8 +224,8 @@ }; # Open ports in the firewall. - networking.firewall.allowedTCPPorts = [ 80 443 ]; - networking.firewall.allowedUDPPorts = [ 80 443 ]; + networking.firewall.allowedTCPPorts = [ 80 443 53317 ]; + networking.firewall.allowedUDPPorts = [ 80 443 53317 ]; # Or disable the firewall altogether. # networking.firewall.enable = false; diff --git a/hosts/default/home.nix b/hosts/default/home.nix index c31de10..1f3be89 100644 --- a/hosts/default/home.nix +++ b/hosts/default/home.nix @@ -59,6 +59,7 @@ go nodejs opam + localsend ];