From f2222f56d82ce033bd4a99ad6938c76284286aeb Mon Sep 17 00:00:00 2001 From: Jurn Wubben Date: Mon, 17 Feb 2025 14:17:57 +0100 Subject: [PATCH] Natural progress. Finished status notification and added some temporary programs (vms) --- flake.lock | 114 +++++++++-- flake.nix | 5 + home/wayland/default.nix | 2 +- home/wayland/hyprland/binds.nix | 4 + home/wayland/hyprland/status.nix | 13 ++ home/wayland/ironbar.nix | 257 ++++++++++++++++++++++++ home/wayland/waybar.nix | 328 ------------------------------- home/wayland/waybar/config.nix | 257 ++++++++++++++++++++++++ home/wayland/waybar/default.nix | 22 +++ home/wayland/waybar/style.nix | 214 ++++++++++++++++++++ hosts/laptop/default.nix | 1 + hosts/laptop/virt.nix | 9 + system/nix/nixpkgs.nix | 21 +- system/nix/substituters.nix | 2 + todo | 2 + 15 files changed, 910 insertions(+), 341 deletions(-) create mode 100644 home/wayland/hyprland/status.nix create mode 100644 home/wayland/ironbar.nix delete mode 100644 home/wayland/waybar.nix create mode 100644 home/wayland/waybar/config.nix create mode 100644 home/wayland/waybar/default.nix create mode 100644 home/wayland/waybar/style.nix create mode 100644 hosts/laptop/virt.nix create mode 100644 todo diff --git a/flake.lock b/flake.lock index a10d2fb..3d23df8 100644 --- a/flake.lock +++ b/flake.lock @@ -67,6 +67,21 @@ "type": "github" } }, + "crane": { + "locked": { + "lastModified": 1737689766, + "narHash": "sha256-ivVXYaYlShxYoKfSo5+y5930qMKKJ8CLcAoIBPQfJ6s=", + "owner": "ipetkov", + "repo": "crane", + "rev": "6fe74265bbb6d016d663b1091f015e2976c4a527", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "firefox-gnome-theme": { "flake": false, "locked": { @@ -261,22 +276,61 @@ "type": "github" } }, - "nixpkgs": { + "ironbar": { + "inputs": { + "crane": "crane", + "naersk": "naersk", + "nixpkgs": [ + "nixpkgs" + ], + "rust-overlay": "rust-overlay" + }, "locked": { - "lastModified": 1739478914, - "narHash": "sha256-qljqSeAWOFbd6HNg8Ey28RdZYdVN8bMb6HJK7uqCKZ0=", - "owner": "nixos", - "repo": "nixpkgs", - "rev": "6f9b8ea84c04411c48ab5aab4620ab204936d9fc", + "lastModified": 1739360499, + "narHash": "sha256-f04my7eNvG4HwMWag9R08IVgddkopKXsypym88Oe9L4=", + "owner": "JakeStanger", + "repo": "ironbar", + "rev": "39153e04b38e675c02df98316b2be039517fd407", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable-small", - "repo": "nixpkgs", + "owner": "JakeStanger", + "repo": "ironbar", "type": "github" } }, + "naersk": { + "inputs": { + "nixpkgs": "nixpkgs" + }, + "locked": { + "lastModified": 1736429655, + "narHash": "sha256-BwMekRuVlSB9C0QgwKMICiJ5EVbLGjfe4qyueyNQyGI=", + "owner": "nix-community", + "repo": "naersk", + "rev": "0621e47bd95542b8e1ce2ee2d65d6a1f887a13ce", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "naersk", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1738297584, + "narHash": "sha256-AYvaFBzt8dU0fcSK2jKD0Vg23K2eIRxfsVXIPCW9a0E=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "9189ac18287c599860e878e905da550aa6dec1cd", + "type": "github" + }, + "original": { + "id": "nixpkgs", + "type": "indirect" + } + }, "nixpkgs-lib": { "locked": { "lastModified": 1738452942, @@ -290,6 +344,22 @@ } }, "nixpkgs_2": { + "locked": { + "lastModified": 1739478914, + "narHash": "sha256-qljqSeAWOFbd6HNg8Ey28RdZYdVN8bMb6HJK7uqCKZ0=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "6f9b8ea84c04411c48ab5aab4620ab204936d9fc", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable-small", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_3": { "locked": { "lastModified": 1736798957, "narHash": "sha256-qwpCtZhSsSNQtK4xYGzMiyEDhkNzOCz/Vfu4oL2ETsQ=", @@ -309,10 +379,32 @@ "inputs": { "flake-parts": "flake-parts", "hm": "hm", - "nixpkgs": "nixpkgs", + "ironbar": "ironbar", + "nixpkgs": "nixpkgs_2", "stylix": "stylix" } }, + "rust-overlay": { + "inputs": { + "nixpkgs": [ + "ironbar", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1738290352, + "narHash": "sha256-YKOHUmc0Clm4tMV8grnxYL4IIwtjTayoq/3nqk0QM7k=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "b031b584125d33d23a0182f91ddbaf3ab4880236", + "type": "github" + }, + "original": { + "owner": "oxalica", + "repo": "rust-overlay", + "type": "github" + } + }, "stylix": { "inputs": { "base16": "base16", @@ -325,7 +417,7 @@ "git-hooks": "git-hooks", "gnome-shell": "gnome-shell", "home-manager": "home-manager", - "nixpkgs": "nixpkgs_2", + "nixpkgs": "nixpkgs_3", "systems": "systems", "tinted-foot": "tinted-foot", "tinted-kitty": "tinted-kitty", diff --git a/flake.nix b/flake.nix index dd80b50..0af31e8 100644 --- a/flake.nix +++ b/flake.nix @@ -38,5 +38,10 @@ # Ricing stylix.url = "github:danth/stylix"; + + ironbar = { + url = "github:JakeStanger/ironbar"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; } diff --git a/home/wayland/default.nix b/home/wayland/default.nix index 19458c3..73711b7 100644 --- a/home/wayland/default.nix +++ b/home/wayland/default.nix @@ -3,7 +3,7 @@ ./fuzzel.nix ./hyprlock.nix ./hyprland - ./waybar.nix + ./waybar ]; home.packages = with pkgs; [ diff --git a/home/wayland/hyprland/binds.nix b/home/wayland/hyprland/binds.nix index 2069904..6b9b4d6 100644 --- a/home/wayland/hyprland/binds.nix +++ b/home/wayland/hyprland/binds.nix @@ -5,6 +5,7 @@ ... }: let inherit (lib) getExe; + inherit (config.lib.stylix.colors) base0D; runOnce = program: "pgrep ${program} || uwsm app -- ${program}"; uwsm = getExe pkgs.uwsm; @@ -72,6 +73,9 @@ in { "$mod, A, exec, ${pulsemixer}" "$mod, B, exec, ${bluetui}" "$mod, N, exec, ${nmtui}" + '' + $mod, S, exec, bash -c 'hyprctl notify -1 5000 "rgb(${base0D})" "$(${getExe (import ./status.nix {inherit pkgs;}).script})"' + '' "$mod, h, movefocus, l" "$mod, l, movefocus, r" diff --git a/home/wayland/hyprland/status.nix b/home/wayland/hyprland/status.nix new file mode 100644 index 0000000..dc263f7 --- /dev/null +++ b/home/wayland/hyprland/status.nix @@ -0,0 +1,13 @@ +{pkgs, ...}: { + script = pkgs.writeShellScriptBin "statusnotify" '' + DATE=$(date +%R) + + upower -e | grep 'BAT' 2>&1 > /dev/null + if [ $? -eq 0 ]; then + BAT=$(upower -i $(upower -e | grep 'BAT') | sed -n -e 's/.*time [a-z \s]*: *\([0-9.]* \w*\).*/\1/p' -e 's/.*per\w*: *\([0-9]*%\).*/\1/p' | sed 'N;s/\n/ - /') + echo "$DATE - $BAT" + else + echo $DATE + fi + ''; +} diff --git a/home/wayland/ironbar.nix b/home/wayland/ironbar.nix new file mode 100644 index 0000000..33db171 --- /dev/null +++ b/home/wayland/ironbar.nix @@ -0,0 +1,257 @@ +{ + config, + pkgs, + lib, + osConfig, + ... +}: let +in { + mainBar = { + layer = "top"; + position = "left"; + # monitor configuration, kind of dirty since it assumes DP-1 is my main monitor + # output = primaryMonitor osConfig; #builtins.elemAt monitors 0; + width = 55; + spacing = 6; + margin-left = null; + margin-top = 6; + margin-bottom = 6; + margin-right = null; + fixed-center = true; + exclusive = true; + modules-left = [ + "custom/search" + "group/info" + ]; + modules-center = ["river/tags"]; + modules-right = [ + "group/info-right" + "battery" + "group/network" + "clock" + "custom/lock" + ]; + + ##### LEFT MODULES ##### + "custom/search" = { + format = " "; + tooltip = false; + on-click = "${lib.getExe pkgs.killall} rofi || run-as-service $(rofi -show drun)"; + }; + + #### INFO MODULE - START #### + "group/info" = { + orientation = "inherit"; + drawer = { + "transition-duration" = 500; + "transition-left-to-right" = false; + }; + modules = [ + "custom/dmark" + "group/gcpu" + "memory" + "disk" + ]; + }; + + "custom/dmark" = { + format = ""; + tooltip = false; + }; + + #### CPU MODULE - START #### + "group/gcpu" = { + orientation = "inherit"; + modules = [ + "custom/cpu-icon" + "cpu" + ]; + }; + + "custom/cpu-icon" = { + format = "󰻠"; + tooltip = false; + }; + + cpu = { + format = "{usage}󱉸"; + "on-click" = "foot btop"; + }; + ##### CPU MODULE - END ##### + + memory = { + format = "  \n{:2}󱉸"; + }; + + disk = { + interval = 600; + format = " 󰋊 \n{percentage_used}󱉸"; + path = "/"; + }; + #### INFO MODULE - END #### + + ##### CENTER MODULES ##### + "river/tags" = { + num-tags = 9; + tag-labels = ["一" "二" "三" "四" "五" "六" "七" "八" "九" "十"]; + }; + + ##### RIGHT MODULES ##### + ##### RIGHT INFO MODULE - START #### + "group/info-right" = { + orientation = "inherit"; + drawer = { + "transition-duration" = 500; + "transition-left-to-right" = false; + }; + modules = [ + "custom/dmark-up" + "pulseaudio" + "backlight" + "bluetooth" + "tray" + ]; + }; + + "custom/dmark-up" = { + format = ""; + tooltip = false; + }; + + pulseaudio = { + scroll-step = 5; + tooltip = true; + tooltip-format = "{volume}"; + on-click = "${pkgs.killall}/bin/killall pavucontrol || ${pkgs.pavucontrol}/bin/pavucontrol"; + format = "{icon}"; + format-muted = "󰝟"; + format-icons = { + default = ["" "" ""]; + }; + }; + + backlight = let + brightnessctl = lib.getExe pkgs.brightnessctl; + in { + format = "{icon}"; + format-icons = ["󰋙" "󰫃" "󰫄" "󰫅" "󰫆" "󰫇" "󰫈"]; + on-scroll-up = "${brightnessctl} s 5%-"; + on-scroll-down = "${brightnessctl} s +5%"; + tooltip = true; + tooltip-format = "Brightness: {percent}% "; + smooth-scrolling-threshold = 1; + }; + + bluetooth = { + # controller = "controller1", // specify the alias of the controller if there are more than 1 on the system + format = ""; + format-disabled = "󰂲"; # an empty format will hide the module + format-connected = "󰂱"; + tooltip-format = "{controller_alias}\t{controller_address}"; + tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{device_enumerate}"; + tooltip-format-disabled = ""; + tooltip-format-enumerate-connected = "{device_alias}\t{device_address}"; + }; + + "tray" = { + spacing = 10; + }; + + ##### RIGHT INFO MODULE - END #### + + battery = { + rotate = 270; + states = { + good = 80; + warning = 30; + critical = 15; + }; + format = "{icon}"; + format-charging = "{icon} "; + format-full = "{icon}"; + format-plugged = "󰂄"; + format-icons = ["󰂃" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; + tooltip-format = "{timeTo} {capacity} % | {power} W"; + }; + + #### NETWORK MODULE - START #### + "group/network" = { + orientation = "inherit"; + drawer = { + "transition-duration" = 500; + "transition-left-to-right" = true; + }; + modules = [ + "network" + "network#speed" + ]; + }; + + network = { + format-wifi = "󰤨"; + format-ethernet = "󰈀"; + format-alt = "󱛇"; + format-disconnected = "󰤭"; + }; + + "network#speed" = let + nm-editor = "${pkgs.networkmanagerapplet}/bin/nm-connection-editor"; + in { + format = " {bandwidthDownBits} "; + rotate = 90; + interval = 5; + tooltip-format = "{ipaddr}"; + tooltip-format-wifi = "{essid} ({signalStrength}%)  \n{ipaddr} | {frequency} MHz{icon} "; + tooltip-format-ethernet = "{ifname} 󰈀 \n{ipaddr} | {frequency} MHz{icon} "; + tooltip-format-disconnected = "Not Connected to any type of Network"; + tooltip = true; + on-click = "${nm-editor}"; + }; + + #### NETWORK MODULE - END #### + + clock = { + format = '' + {:%H + %M}''; + tooltip-format = '' + {:%Y %B} + {calendar} + ''; + }; + + "custom/lock" = { + tooltip = false; + on-click = "${pkgs.bash}/bin/bash -c '(sleep 0.5s; ${lib.getExe pkgs.swaylock-effects} --grace 0)' & disown"; + format = ""; + }; + + "custom/power" = { + tooltip = false; + on-click = let + sudo = pkgs.sudo + "/bin/sudo"; + rofi = config.programs.rofi.package + "/bin/rofi"; + poweroff = pkgs.systemd + "/bin/poweroff"; + reboot = pkgs.systemd + "/bin/reboot"; + in + pkgs.writeShellScript "shutdown-waybar" '' + + #!/bin/sh + + off=" Shutdown" + reboot=" Reboot" + cancel="󰅖 Cancel" + + sure="$(printf '%s\n%s\n%s' "$off" "$reboot" "$cancel" | + ${rofi} -dmenu -p ' Are you sure?')" + + if [ "$sure" = "$off" ]; then + ${sudo} ${poweroff} + elif [ "$sure" = "$reboot" ]; then + ${sudo} ${reboot} + fi + ''; + format = "󰐥"; + }; + }; +} diff --git a/home/wayland/waybar.nix b/home/wayland/waybar.nix deleted file mode 100644 index 313eceb..0000000 --- a/home/wayland/waybar.nix +++ /dev/null @@ -1,328 +0,0 @@ -{ - config, - lib, - pkgs, - ... -}: let - inherit (lib) getExe; - - #TODO: UWSM library mentioned in binds.nix. - hyprctl = "${config.wayland.windowManager.hyprland.package}/bin/hyprctl"; - fuzzel = getExe pkgs.fuzzel; - kitty = getExe pkgs.kitty; - - pulsemixer = "${kitty} ${getExe pkgs.pulsemixer}"; - nmtui = "${kitty} ${pkgs.networkmanager}/bin/nmtui"; -in { - programs.waybar = { - enable = true; - systemd.enable = true; - settings = { - mainBar = { - layer = "bottom"; - position = "bottom"; - mod = "dock"; - exclusive = true; - gtk-layer-shell = true; - margin-bottom = -1; - passthrough = false; - height = 41; - modules-left = [ - "custom/os_button" - "hyprland/workspaces" - "wlr/taskbar" - ]; - modules-center = [ - ]; - modules-right = [ - "cpu" - "memory" - "disk" - "tray" - "pulseaudio" - "network" - "battery" - "clock" - ]; - "hyprland/language" = { - format = "{}"; - format-en = "ENG"; - format-ru = "РУС"; - }; - "hyprland/workspaces" = { - icon-size = 32; - spacing = 14; - align = "center"; - justify = "center"; - on-scroll-up = "${hyprctl} dispatch workspace r+1"; - on-scroll-down = "${hyprctl} dispatch workspace r-1"; - }; - "custom/os_button" = { - format = ""; - on-click = fuzzel; - tooltip = false; - }; - cpu = { - interval = 5; - format = " {usage}%"; - max-length = 10; - }; - disk = { - interval = 30; - format = "󰋊 {percentage_used}%"; - path = "/"; - tooltip = true; - unit = "GB"; - tooltip-format = "Available {free} of {total}"; - }; - memory = { - interval = 10; - format = " {percentage}%"; - max-length = 10; - tooltip = true; - tooltip-format = "RAM - {used:0.1f}GiB used"; - }; - "wlr/taskbar" = { - format = "{icon} {title:.17}"; - icon-size = 28; - spacing = 3; - on-click-middle = "close"; - tooltip-format = "{title}"; - ignore-list = [ - ]; - on-click = "activate"; - }; - tray = { - icon-size = 18; - spacing = 3; - }; - clock = { - format = " {:%R\n %d.%m.%Y}"; - tooltip-format = "{calendar}"; - calendar = { - mode = "year"; - mode-mon-col = 3; - weeks-pos = "right"; - on-scroll = 1; - on-click-right = "mode"; - format = { - months = "{}"; - days = "{}"; - weeks = "W{}"; - weekdays = "{}"; - today = "{}"; - }; - }; - actions = { - on-click-right = "mode"; - on-click-forward = "tz_up"; - on-click-backward = "tz_down"; - on-scroll-up = "shift_up"; - on-scroll-down = "shift_down"; - }; - }; - network = { - format-wifi = " {icon}"; - format-ethernet = " "; - format-disconnected = "󰌙"; - format-icons = [ - "󰤯 " - "󰤟 " - "󰤢 " - "󰤢 " - "󰤨 " - ]; - on-click = nmtui; - }; - battery = { - states = { - good = 95; - warning = 30; - critical = 20; - }; - format = "{icon} {capacity}%"; - format-charging = " {capacity}%"; - format-plugged = " {capacity}%"; - format-alt = "{time} {icon}"; - format-icons = [ - "󰂎" - "󰁺" - "󰁻" - "󰁼" - "󰁽" - "󰁾" - "󰁿" - "󰂀" - "󰂁" - "󰂂" - "󰁹" - ]; - }; - pulseaudio = { - max-volume = 150; - scroll-step = 10; - format = "{icon}"; - tooltip-format = "{volume}%"; - format-muted = " "; - format-icons = { - default = [ - " " - " " - " " - ]; - }; - on-click = pulsemixer; - }; - }; - }; - style = '' - * { - text-shadow: none; - box-shadow: none; - border: none; - border-radius: 0; - font-family: "DejaVuSansM Nerd Font:style=Regular"; - font-weight: 600; - font-size: 12.7px; - } - - window#waybar { - background: @base00; - border-top: 1px solid @base01; - color: @base05; - } - - tooltip { - background: @base01; - border-radius: 5px; - border-width: 1px; - border-style: solid; - border-color: @base01; - } - tooltip label{ - color: @base05; - } - - #custom-os_button { - font-size: 24px; - padding-left: 12px; - padding-right: 20px; - transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1); - } - #custom-os_button:hover { - background: @base03; - color: @base05; - } - - #workspaces { - color: transparent; - margin-right: 1.5px; - margin-left: 1.5px; - } - #workspaces button { - padding: 3px; - color: @base04; - transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1); - } - #workspaces button.active { - color: @base05; - border-bottom: 3px solid white; - } - #workspaces button.focused { - color: @base02; - } - #workspaces button.urgent { - background: rgba(255, 200, 0, 0.35); - border-bottom: 3px dashed @warning_color; - color: @warning_color; - } - #workspaces button:hover { - background: @base03; - color: @base05; - } - - - #taskbar button { - min-width: 130px; - border-bottom: 3px solid rgba(255, 255, 255, 0.3); - margin-left: 2px; - margin-right: 2px; - padding-left: 8px; - padding-right: 8px; - color: white; - transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1); - } - - #taskbar button.active { - border-bottom: 3px solid white; - background: @base02; - } - - #taskbar button:hover { - border-bottom: 3px solid white; - background: @base03; - color: @base05; - } - - #cpu, #disk, #memory { - padding:3px; - } - - - #window { - border-radius: 10px; - margin-left: 20px; - margin-right: 20px; - } - - #tray{ - margin-left: 5px; - margin-right: 5px; - } - #tray > .passive { - border-bottom: none; - } - #tray > .active { - border-bottom: 3px solid white; - } - #tray > .needs-attention { - border-bottom: 3px solid @warning_color; - } - #tray > widget { - transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1); - } - #tray > widget:hover { - background: @base03; - } - - #pulseaudio { - font-family: "JetBrainsMono Nerd Font"; - padding-left: 3px; - padding-right: 3px; - transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1); - } - #pulseaudio:hover { - background: @base03; - } - - #network { - padding-left: 3px; - padding-right: 3px; - } - - #language { - padding-left: 5px; - padding-right: 5px; - } - - #clock { - padding-right: 5px; - padding-left: 5px; - transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1); - } - #clock:hover { - background: @base03; - } - ''; - }; -} diff --git a/home/wayland/waybar/config.nix b/home/wayland/waybar/config.nix new file mode 100644 index 0000000..1c201b4 --- /dev/null +++ b/home/wayland/waybar/config.nix @@ -0,0 +1,257 @@ +{ + config, + pkgs, + lib, + osConfig, + ... +}: { + mainBar = { + layer = "top"; + position = "left"; + # monitor configuration, kind of dirty since it assumes DP-1 is my main monitor + # output = primaryMonitor osConfig; #builtins.elemAt monitors 0; + width = 25; + spacing = 6; + margin-left = null; + margin-top = 6; + margin-bottom = 6; + margin-right = null; + fixed-center = true; + exclusive = true; + modules-left = [ + "custom/search" + "group/info" + ]; + modules-center = ["hyprland/workspaces"]; + modules-right = [ + "group/info-right" + "battery" + "group/network" + "clock" + "custom/lock" + ]; + + ##### LEFT MODULES ##### + "custom/search" = { + format = " "; + tooltip = false; + on-click = "${lib.getExe pkgs.killall} rofi || run-as-service $(rofi -show drun)"; + }; + + #### INFO MODULE - START #### + "group/info" = { + orientation = "inherit"; + drawer = { + "transition-duration" = 500; + "transition-left-to-right" = false; + }; + modules = [ + "custom/dmark" + "group/gcpu" + "memory" + "disk" + ]; + }; + + "custom/dmark" = { + format = ""; + tooltip = false; + }; + + #### CPU MODULE - START #### + "group/gcpu" = { + orientation = "inherit"; + modules = [ + "custom/cpu-icon" + "cpu" + ]; + }; + + "custom/cpu-icon" = { + format = "󰻠"; + tooltip = false; + }; + + cpu = { + format = "{usage}󱉸"; + "on-click" = "foot btop"; + }; + ##### CPU MODULE - END ##### + + memory = { + format = "  \n{:2}󱉸"; + }; + + disk = { + interval = 600; + format = " 󰋊 \n{percentage_used}󱉸"; + path = "/"; + }; + #### INFO MODULE - END #### + + ##### CENTER MODULES ##### + "river/tags" = { + num-tags = 9; + tag-labels = ["一" "二" "三" "四" "五" "六" "七" "八" "九" "十"]; + }; + + ##### RIGHT MODULES ##### + ##### RIGHT INFO MODULE - START #### + "group/info-right" = { + orientation = "inherit"; + drawer = { + "transition-duration" = 500; + "transition-left-to-right" = false; + }; + modules = [ + "custom/dmark-up" + "pulseaudio" + "backlight" + "bluetooth" + "tray" + ]; + }; + + "custom/dmark-up" = { + format = ""; + tooltip = false; + }; + + pulseaudio = { + scroll-step = 5; + tooltip = true; + tooltip-format = "{volume}"; + on-click = "${pkgs.killall}/bin/killall pavucontrol || ${pkgs.pavucontrol}/bin/pavucontrol"; + format = "{icon}"; + format-muted = "󰝟"; + format-icons = { + default = ["" "" ""]; + }; + }; + + backlight = let + brightnessctl = lib.getExe pkgs.brightnessctl; + in { + format = "{icon}"; + format-icons = ["󰋙" "󰫃" "󰫄" "󰫅" "󰫆" "󰫇" "󰫈"]; + on-scroll-up = "${brightnessctl} s 5%-"; + on-scroll-down = "${brightnessctl} s +5%"; + tooltip = true; + tooltip-format = "Brightness: {percent}% "; + smooth-scrolling-threshold = 1; + }; + + bluetooth = { + # controller = "controller1", // specify the alias of the controller if there are more than 1 on the system + format = ""; + format-disabled = "󰂲"; # an empty format will hide the module + format-connected = "󰂱"; + tooltip-format = "{controller_alias}\t{controller_address}"; + tooltip-format-connected = "{controller_alias}\t{controller_address}\n\n{device_enumerate}"; + tooltip-format-disabled = ""; + tooltip-format-enumerate-connected = "{device_alias}\t{device_address}"; + }; + + "tray" = { + spacing = 10; + }; + + ##### RIGHT INFO MODULE - END #### + + battery = { + rotate = 270; + states = { + good = 80; + warning = 30; + critical = 15; + }; + format = "{icon}"; + format-charging = "{icon} "; + format-full = "{icon}"; + format-plugged = "󰂄"; + format-icons = ["󰂃" "󰁺" "󰁻" "󰁼" "󰁽" "󰁾" "󰁾" "󰁿" "󰂀" "󰂁" "󰂂" "󰁹"]; + tooltip-format = "{timeTo} {capacity} % | {power} W"; + }; + + #### NETWORK MODULE - START #### + "group/network" = { + orientation = "inherit"; + drawer = { + "transition-duration" = 500; + "transition-left-to-right" = true; + }; + modules = [ + "network" + "network#speed" + ]; + }; + + network = { + format-wifi = "󰤨"; + format-ethernet = "󰈀"; + format-alt = "󱛇"; + format-disconnected = "󰤭"; + }; + + "network#speed" = let + nm-editor = "${pkgs.networkmanagerapplet}/bin/nm-connection-editor"; + in { + format = " {bandwidthDownBits} "; + rotate = 90; + interval = 5; + tooltip-format = "{ipaddr}"; + tooltip-format-wifi = "{essid} ({signalStrength}%)  \n{ipaddr} | {frequency} MHz{icon} "; + tooltip-format-ethernet = "{ifname} 󰈀 \n{ipaddr} | {frequency} MHz{icon} "; + tooltip-format-disconnected = "Not Connected to any type of Network"; + tooltip = true; + on-click = "${nm-editor}"; + }; + + #### NETWORK MODULE - END #### + + clock = { + format = '' + {:%H + %M}''; + tooltip-format = '' + {:%Y %B} + {calendar} + ''; + }; + + "custom/lock" = { + tooltip = false; + on-click = "${pkgs.bash}/bin/bash -c '(sleep 0.5s; ${lib.getExe pkgs.swaylock-effects} --grace 0)' & disown"; + format = ""; + }; + + "custom/power" = { + tooltip = false; + on-click = let + sudo = pkgs.sudo + "/bin/sudo"; + rofi = config.programs.rofi.package + "/bin/rofi"; + poweroff = pkgs.systemd + "/bin/poweroff"; + reboot = pkgs.systemd + "/bin/reboot"; + in + pkgs.writeShellScript "shutdown-waybar" '' + + #!/bin/sh + + off=" Shutdown" + reboot=" Reboot" + cancel="󰅖 Cancel" + + sure="$(printf '%s\n%s\n%s' "$off" "$reboot" "$cancel" | + ${rofi} -dmenu -p ' Are you sure?')" + + if [ "$sure" = "$off" ]; then + ${sudo} ${poweroff} + elif [ "$sure" = "$reboot" ]; then + ${sudo} ${reboot} + fi + ''; + format = "󰐥"; + }; + }; +} + diff --git a/home/wayland/waybar/default.nix b/home/wayland/waybar/default.nix new file mode 100644 index 0000000..9e9543d --- /dev/null +++ b/home/wayland/waybar/default.nix @@ -0,0 +1,22 @@ +{ + pkgs, + lib, + config, + osConfig, + ... +}: let + inherit (config.lib.stylix) colors; + + waybar_config = import ./config.nix {inherit osConfig config lib pkgs;}; + waybar_style_content = import ./style.nix {inherit colors;}; + waybar_style = pkgs.writeText "waybar-style.css" waybar_style_content; +in { + home.packages = with pkgs.python3Packages; [requests]; + programs.waybar = { + enable = true; + systemd.enable = true; + package = pkgs.waybar; + settings = waybar_config; + # style = waybar_style; + }; +} diff --git a/home/wayland/waybar/style.nix b/home/wayland/waybar/style.nix new file mode 100644 index 0000000..4595067 --- /dev/null +++ b/home/wayland/waybar/style.nix @@ -0,0 +1,214 @@ +{colors}: +with colors; let + OSLogo = builtins.fetchurl rec { + name = "OSLogo-${sha256}.png"; + sha256 = "1cifj774r4z4m856fva1mamnpnhsjl44kw3asklrc57824f5lyz3"; + url = "https://raw.githubusercontent.com/NixOS/nixos-artwork/master/logo/nix-snowflake-colours.svg"; + }; +in '' + * { + font-family: Material Design Icons, Iosevka Nerd Font Mono; + font-size: 19px; + } + + window#waybar { + background-color: #${base00}; + border: .5px solid #${base01}; + border-radius: 0px; + color: #${base05}; + margin: 8px 8px; + transition-property: background-color; + transition-duration: .5s; + } + + window#waybar.hidden { + opacity: 0.2; + } + + .modules-left { + margin: 7px 7px 7px 7px; + background-color: #${base02}; + border: .5px solid #${base01}; + border-radius: 15px; + padding: 2px 2px; + } + + .modules-center { + margin: 7px 7px 7px 7px; + background-color: #${base02}; + border: .5px solid #${base01}; + border-radius: 15px; + padding: 2px 0px 2px 0px; + } + + .modules-right { + margin: 7px 7px 7px 7px; + background-color: #${base02}; + border: .5px solid #${base01}; + border-radius: 15px; + padding: 2px 0px 2px 0px; + } + + #custom-weather, + #clock, + #network, + #custom-swallow, + #custom-power, + #cpu, + #battery, + #backlight, + #memory, + #tags, + #custom-search, + #custom-power, + #custom-todo, + #custom-lock, + #custom-weather, + #volume, + #cpu, + #bluetooth, + #gamemode, + #gcpu, + #memory, + #disk, + #submap, + #pulseaudio { + padding: 4px 0px 4px 0px; + margin: 0px 0px; + border-radius: 15px; + } + + #tags button { + background-color: transparent; + /* Use box-shadow instead of border so the text isn't offset */ + color: #${base07}; + font-size: 21px; + /* padding-left: 6px; */ + box-shadow: inset 0 -3px transparent; + } + + #tags button:hover { + color: #${base05}; + background-color: #${base03}; + } + + #tags button.focused { + border-radius: 20px; + border-color: #${base0E}; + } + + #tags button.occupied { + color: #${base0E}; + } + + #tags button.urgent { + color: #${base08}; + } + + #custom-power { + color: #${base08}; + margin-bottom: 7px; + } + + #tags { + background-color: #${base02}; + } + + #network { + color: #${base07}; + + } + + #gamemode { + color: #${base07}; + } + + #custom-weather { + color: #${base05}; + background-color: #${base02}; + } + + #bluetooth { + color: #${base0E}; + } + + #bluetooth.off, + #bluetooth.pairable, + #bluetooth.discovering, + #bluetooth.disabled { + color: rgba(0, 0, 0, 0.0); + background-color: rgba(0, 0, 0, 0.0); + margin: -50; + } + + #clock { + color: #${base05}; + background-color: #${base02}; + font-weight: 700; + font-size: 20px; + font-family: "Iosevka Term"; + } + + #pulseaudio { + color: #${base0B}; + } + + #pulseaudio.source-muted, + #pulseaudio.muted { + color: #${base08}; + } + + #custom-swallow { + color: #${base0E}; + + } + + #custom-lock { + color: #${base07}; + + } + + #custom-todo { + color: #${base05}; + } + + #custom-cpu { + color: #${base0B}; + } + + #custom-search { + background-image: url("${OSLogo}"); + background-size: 65%; + background-position: center; + background-repeat: no-repeat; + margin-top: 7px; + } + + #backlight { + color: #${base0A}; + } + + #battery { + color: #${base0C}; + } + + #battery.warning { + color: #${base09}; + } + + #battery.critical:not(.charging) { + color: #${base08}; + } + + tooltip { + font-family: 'Lato', sans-serif; + border-radius: 15px; + padding: 20px; + margin: 30px; + } + + tooltip label { + font-family: 'Lato', sans-serif; + padding: 20px; + } +'' diff --git a/hosts/laptop/default.nix b/hosts/laptop/default.nix index 2fecfd8..5bd566f 100644 --- a/hosts/laptop/default.nix +++ b/hosts/laptop/default.nix @@ -1,6 +1,7 @@ { imports = [ ./hardware-configuration.nix + ./virt.nix ]; services = { diff --git a/hosts/laptop/virt.nix b/hosts/laptop/virt.nix new file mode 100644 index 0000000..fef0c84 --- /dev/null +++ b/hosts/laptop/virt.nix @@ -0,0 +1,9 @@ +{ + programs.virt-manager.enable = true; + + users.groups.libvirtd.members = ["jsw"]; + + virtualisation.libvirtd.enable = true; + + virtualisation.spiceUSBRedirection.enable = true; +} diff --git a/system/nix/nixpkgs.nix b/system/nix/nixpkgs.nix index d3422e6..f455d0b 100644 --- a/system/nix/nixpkgs.nix +++ b/system/nix/nixpkgs.nix @@ -1,5 +1,24 @@ -{self, ...}: { +{ + config, + pkgs, + lib, + ... +}: { nixpkgs = { config.allowUnfree = true; }; + environment.etc."current-system-packages".text = let + packages = builtins.map (p: "${p.name}") config.environment.systemPackages; + sortedUnique = builtins.sort builtins.lessThan (pkgs.lib.lists.unique packages); + formatted = builtins.concatStringsSep "\n" sortedUnique; + in + formatted; + + environment.etc."current-user-packages".text = let + inherit (config.home-manager) users; + packages = lib.lists.flatten (builtins.map (u: builtins.map (p: "${u}: ${p.name}") users.${u}.home.packages) (builtins.attrNames users)); + sortedUnique = builtins.sort builtins.lessThan (pkgs.lib.lists.unique packages); + formatted = builtins.concatStringsSep "\n" sortedUnique; + in + formatted; } diff --git a/system/nix/substituters.nix b/system/nix/substituters.nix index f9d38ef..69845fa 100644 --- a/system/nix/substituters.nix +++ b/system/nix/substituters.nix @@ -3,6 +3,7 @@ substituters = [ # high priority since it's almost always used "https://cache.nixos.org?priority=10" + "https://cache.garnix.io" # "https://anyrun.cachix.org" # "https://fufexan.cachix.org" @@ -15,6 +16,7 @@ trusted-public-keys = [ "cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY=" + "cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= " # "anyrun.cachix.org-1:pqBobmOjI7nKlsUMV25u9QHa9btJK65/C8vnO3p346s=" # "fufexan.cachix.org-1:LwCDjCJNJQf5XD2BV+yamQIMZfcKWR9ISIFy5curUsY=" diff --git a/todo b/todo new file mode 100644 index 0000000..2854a70 --- /dev/null +++ b/todo @@ -0,0 +1,2 @@ +Networkmanager permissions +Remove bar