diff --git a/hosts/dragyx/common/cli/alacritty.nix b/hosts/dragyx/common/cli/alacritty.nix new file mode 100644 index 0000000..9a7a95a --- /dev/null +++ b/hosts/dragyx/common/cli/alacritty.nix @@ -0,0 +1,91 @@ +{ config, lib, pkgs, ... }: +let + username = config.modules.other.system.username; +in +{ + home-manager.users.${username} = { + programs = { + alacritty = { + enable = true; + }; + alacritty.settings = { + shell = { + program = "zsh"; + }; + font.normal.family = "JetBrainsMono Nerd Font"; + font.bold.family = "JetBrainsMono Nerd Font"; + font.italic.family = "JetBrainsMono Nerd Font"; + font.bold_italic.family = "JetBrainsMono Nerd Font"; + window.opacity = 0.8; + # TODO: maybe use a different way to manage the theme + colors = { + primary = { + background = "#282a36"; + foreground = "#f8f8f2"; + bright_foreground = "#ffffff"; + }; + cursor = { + text = "CellBackground"; + cursor = "CellForeground"; + }; + vi_mode_cursor = { + text = "CellBackground"; + cursor = "CellForeground"; + }; + search = { + matches = { + foreground = "#44475a"; + background = "#50fa7b"; + }; + focused_match = { + foreground = "#44475a"; + background = "#ffb86c"; + }; + }; + footer_bar = { + background = "#282a36"; + foreground = "#f8f8f2"; + }; + hints = { + start = { + foreground = "#282a36"; + background = "#f1fa8c"; + }; + end = { + foreground = "#f1fa8c"; + background = "#282a36"; + }; + }; + line_indicator = { + foreground = "None"; + background = "None"; + }; + selection = { + text = "CellForeground"; + background = "#44475a"; + }; + normal = { + black = "#21222c"; + red = "#ff5555"; + green = "#50fa7b"; + yellow = "#f1fa8c"; + blue = "#bd93f9"; + magenta = "#ff79c6"; + cyan = "#8be9fd"; + white = "#f8f8f2"; + }; + bright = { + black = "#6272a4"; + red = "#ff6e6e"; + green = "#69ff94"; + yellow = "#ffffa5"; + blue = "#d6acff"; + magenta = "#ff92df"; + cyan = "#a4ffff"; + white = "#ffffff"; + }; + }; + }; + }; + }; +} diff --git a/hosts/dragyx/common/cli/default.nix b/hosts/dragyx/common/cli/default.nix new file mode 100644 index 0000000..673f745 --- /dev/null +++ b/hosts/dragyx/common/cli/default.nix @@ -0,0 +1,6 @@ +_: { + imports = [ + ./alacritty.nix + ]; + +} diff --git a/hosts/dragyx/common/default.nix b/hosts/dragyx/common/default.nix index 1bbad98..5708dcc 100644 --- a/hosts/dragyx/common/default.nix +++ b/hosts/dragyx/common/default.nix @@ -3,6 +3,9 @@ _: { ./configuration.nix ./packages.nix ./hyprland.nix + ./waybar.nix + ./theming + ./cli ]; diff --git a/hosts/dragyx/common/hyprland.nix b/hosts/dragyx/common/hyprland.nix index 74253af..ebd2405 100644 --- a/hosts/dragyx/common/hyprland.nix +++ b/hosts/dragyx/common/hyprland.nix @@ -1,12 +1,11 @@ -{ config, pkgs, ... }: +{ config, lib, pkgs, ... }: with lib; let username = config.modules.other.system.username; cfg = config.modules.WM.hyprland; - +in { - config = mkIf cfg.enable { environment.systemPackages = with pkgs; [ rofi-wayland @@ -27,9 +26,8 @@ let # hyprland settings home-manager.users.${username} = { - - - programs.hyprland.settings = { + programs.waybar.enable = true; + wayland.windowManager.hyprland.settings = { input = { kb_layout = "us"; natural_scroll = true; diff --git a/hosts/dragyx/common/theming/default.nix b/hosts/dragyx/common/theming/default.nix new file mode 100644 index 0000000..c26ca3d --- /dev/null +++ b/hosts/dragyx/common/theming/default.nix @@ -0,0 +1,48 @@ +{ config, pkgs, ... }: + +# TODO: Make this more generic / reusable +let + username = config.modules.other.system.username; + gitPath = config.modules.other.system.gitPath; + + + catpuccin-rofi = pkgs.stdenv.mkDerivation { + pname = "catppuccin-rofi"; + version = "0"; + src = pkgs.fetchFromGitHub { + owner = "catppuccin"; + repo = "rofi"; + rev = "5350da41a11814f950c3354f090b90d4674a95ce"; + sha256 = "sha256-DNorfyl3C4RBclF2KDgwvQQwixpTwSRu7fIvihPN8JY="; + }; + installPhase = '' + mkdir -p $out/share/ + mkdir -p $out/.config/ + + cp -r $src/basic/.config/rofi/* $out/.config/ + cp -r $src/basic/.local/share/rofi/themes/* $out/share/ + ''; + }; +in +{ + home-manager.users.${username} = { + xdg.configFile."rofi".source = "${catpuccin-rofi}/.config"; + xdg.dataFile."rofi/themes".source = "${catpuccin-rofi}/share"; + + programs.waybar.style = ./waybar-style.css; + + wayland.windowManager.hyprland.settings.exec-once = [ + "hyprshade auto" + "dunst" + "hyprpaper" + ]; + + xdg.configFile."hypr/hyprpaper.conf" = { #TODO: generic path + text = '' + preload = ${gitPath}/hosts/dragyx/common/theming/wallpaper/default.jpg + wallpaper = ,${gitPath}/hosts/dragyx/common/theming/wallpaper/default.jpg + ''; + }; + }; + +} diff --git a/hosts/dragyx/common/theming/wallpapers/default.jpg b/hosts/dragyx/common/theming/wallpapers/default.jpg new file mode 100644 index 0000000..8d664ec Binary files /dev/null and b/hosts/dragyx/common/theming/wallpapers/default.jpg differ diff --git a/hosts/dragyx/common/theming/waybar-style.css b/hosts/dragyx/common/theming/waybar-style.css new file mode 100644 index 0000000..d9472c4 --- /dev/null +++ b/hosts/dragyx/common/theming/waybar-style.css @@ -0,0 +1,136 @@ +/* Styles */ + +@define-color bar-back rgba(40, 40, 40, 0.2); +@define-color widget rgba(40, 40, 40, 0.8); +@define-color warning @bryellow; +@define-color critical red; +@define-color mode black; +@define-color unfocused @widget; +@define-color active rgba(100, 40, 40, 0.7); +@define-color focused red;/*rgba(100, 40, 40, 0.7);*/ +@define-color inactive purple; +@define-color fg1 rgba(0, 0, 255, 1); +@define-color fg2 rgba(255, 0, 0, 1); + +/* Reset all styles */ +* { + border: none; + border-radius: 0; + min-height: 0; + margin: 0; + padding: 0; + box-shadow: none; + text-shadow: none; + -gtk-icon-shadow: none; +} + +/* The whole bar */ +#waybar { + background: @bar-back; + /* + background: rgba(0, 0, 0, 0); + */ + /*background-image: linear-gradient(to left, rgba(255, 100, 100, 100), rgba(255, 100, 100, 0));*/ + background: linear-gradient(90deg, rgba(0,212,255,0.19089642693014708) 0%, rgba(255,255,255,0) 25%, rgba(255,255,255,0) 75%, rgba(248,0,255,0.2105042700674019) 100%); + color: @white; + font-family: JetBrains Mono; + font-size: 13pt; +} + +/* Each module */ +#battery, +#clock, +#cpu, +#language, +#memory, +#mode, +#network, +#pulseaudio-slider, +#temperature, +#tray, +#backlight, +#wireplumber, +#idle_inhibitor, +#disk, +#user, +#keyboard-state, +#workspaces button, +#custom-os-icon, +#mpris { + background: @widget; + margin: 0 0.2em 0 0.2em; + padding: 0em 0.3em 0em 0.3em; + border-radius: 0.35em; +} + +#custom-os-icon { + min-width: 0.8em; + padding: 0 0.5em 0 0.1em; /*Otherwise the icon is not centered properly*/ +} + +#tray { + min-width: 0.8em; +} + +#keyboard-state { + min-width: 2em; + color: white; +} + +#workspaces button { + opacity: 100; + color: white; +} + +/* Inactive (on unfocused output) */ +#workspaces button.inactive { + background: @inactive; +} + +#workspaces button.active { + background: @active; +} + +#custom-os-icon { + color: rgba(150, 150, 255, 1); + margin: 0 1em 0 0.2em; +} + +#wireplumber { + /*color: @fg1;*/ + border-radius: 0 0.3em 0.3em 0; +} + +#backlight { + /*color: @fg2;*/ + border-radius: 0.3em 0 0 0.3em; +} + + +/* Active (on focused output) */ +#workspaces button.focused { + opacity: 100; + background: @focused; +} + +/* Contains an urgent window */ +#workspaces button.urgent { + background: @warning; + +} + +/* Style when cursor is on the button */ +#workspaces button:hover { + opacity: 110; + background: @focused; +} + +#clock.date { + border-radius: 0.3em 0 0 0.3em; + min-width: 7em; +} +#clock.time{ + /*border-radius: 0 0.3em 0.3em 0;*/ + border-radius: 0; + min-width: 4em; +} diff --git a/hosts/dragyx/common/waybar.nix b/hosts/dragyx/common/waybar.nix new file mode 100644 index 0000000..b2e7369 --- /dev/null +++ b/hosts/dragyx/common/waybar.nix @@ -0,0 +1,197 @@ +{ config, lib, pkgs, ... }: + +with lib; +let + username = config.modules.other.system.username; +in +{ + environment.systemPackages = with pkgs; [ waybar ]; + home-manager.users.${username} = { + programs.waybar = { + systemd.enable = true; + settings = { + main = { + layer = "top"; + position = "top"; + modules-left = [ + "custom/os-icon" + "hyprland/workspaces" + ]; + modules-center = [ + "backlight" + "clock#time" + "wireplumber" + ]; + modules-right = [ + "tray" + "network" + "battery" + ]; + # Modules + "custom/os-icon" = { + format = "\uf313"; #NixOS logo + }; + battery = { + interval = 10; + states = { + warning = 30; + critical = 15; + }; + format-time = "{H}:{M:02}"; + format = "{icon} {capacity}%"; + format-charging = " {capacity}%"; + format-charging-full = " {capacity}%"; + format-full = "{icon} {capacity}%"; + format-icons = [ + "" + "" + "" + "" + "" + ]; + tooltip = false; + }; + "clock#time" = { + interval = 10; + format = "{:%H:%M}"; + tooltip = false; + }; + "clock#date" = { + interval = 20; + format = "{:%d.%m.%Y}"; + tooltip = false; + }; + memory = { + interval = 5; + format = " {used:0.1f}G/{total:0.1f}G"; + states = { + warning = 70; + critical = 90; + }; + tooltip = false; + }; + network = { + interval = 5; + format-wifi = "{icon} {essid}"; + format-ethernet = "\udb80\ude01 {ifname}"; + format-disconnected = "\uf0202 Offline"; + format-alt = "\udb80\uddda {bandwidthDownBytes} \udb81\udd52 {bandwidthUpBytes} \udb82\ude5f {ipaddr}/{cidr}"; + format-icons = [ + "\udb82\udd28 " + "\udb82\udd25 " + "\udb82\udd22 " + "\udb82\udd1f " + "\udb82\udd2f " + ]; + tooltip = false; + }; + "hyprland/mode" = { + format = "test{}"; + tooltip = false; + }; + "hyprland/window" = { + format = "{}"; + max-length = 30; + tooltip = false; + rewrite = { + "([Aa]lacritty|kitty)" = "\ue795 $1"; + "(.*) .{15} Mozilla Firefox" = "\ue745 $1"; + "(^Spotify.*)" = "\uf1bc $1"; + }; + }; + "hyprland/workspaces" = { + disable-scroll-wraparound = true; + smooth-scrolling-threshold = 4; + enable-bar-scroll = true; + format = "{icon}"; + format-icons = { + "1" = "Ⅰ"; + "2" = "Ⅱ"; + "3" = "Ⅲ"; + "4" = "Ⅳ"; + "5" = "Ⅴ"; + "6" = "Ⅵ"; + "7" = "Ⅶ"; + "8" = "Ⅷ"; + "9" = "Ⅸ"; + "10" = "Ⅹ"; + "11" = "Ⅺ"; + "12" = "Ⅻ"; + }; + }; + "pulseaudio/slider" = { + min = 0; + max = 100; + orientation = "horizontal"; + }; + pulseaudio = { + format = "{icon} {volume}%"; + format-bluetooth = "{icon} {volume}%"; + format-muted = ""; + format-icons = { + headphone = ""; + hands-free = ""; + headset = ""; + phone = ""; + portable = ""; + car = ""; + default = [ + "" + "" + ]; + }; + scroll-step = 1; + on-click = "pactl set-sink-mute @DEFAULT_SINK@ toggle"; + tooltip = false; + }; + user = {}; + temperature = { + critical-threshold = 90; + interval = 5; + format = " {icon} {temperatureC}°"; + format-icons = [ + "" + "" + "" + "" + "" + ]; + tooltip = false; + }; + backlight = { + format = "{percent}% {icon} "; + format-icons = [ + "\udb80\udf36" + "\udb86\ude4e" + "\udb86\ude4f" + "\udb86\ude50" + "\udb86\ude51" + "\udb86\ude52" + "\udb86\ude53" + "\udb86\ude54" + "\udb86\ude55" + "\udb86\ude56" + "\udb81\udee8" + ]; + }; + wireplumber = { + format = "{icon} {volume}%"; + format-muted = "\udb81\udd81"; + format-icons = [ + "\uf026" + "\uf027" + "\udb81\udd7e" + ]; + }; + tray = { + icon-size = 18; + }; + }; + }; + + }; + + + + }; +} diff --git a/hosts/dragyx/flocke/configuration.nix b/hosts/dragyx/flocke/configuration.nix index f898d40..d7981ec 100644 --- a/hosts/dragyx/flocke/configuration.nix +++ b/hosts/dragyx/flocke/configuration.nix @@ -2,7 +2,7 @@ { imports = [ - ../configuration.nix + ../common/default.nix ../../../options/common/pin-registry.nix ../../../options/common/preserve-system.nix ../../../options/desktop/fonts.nix @@ -127,6 +127,7 @@ refresh_rate = 60; } ]; + wayland = true; }; home-manager = { enable = true; @@ -137,9 +138,10 @@ vesktop.enable = false; btop.enable = true; mpv.enable = true; - schizofox.enable = true; + schizofox.enable = false; obs.enable = true; - vivado.enable = true; + # vivado.enable = true; + rofi.enable = true; # neovim.enable = true; git = { enable = true; diff --git a/modules/gui/WM/hyprland.nix b/modules/gui/WM/hyprland.nix index 8bcbc06..0d1e3ae 100644 --- a/modules/gui/WM/hyprland.nix +++ b/modules/gui/WM/hyprland.nix @@ -41,18 +41,19 @@ in wl-clipboard ]; - wayland.windowManager.hyprland = { - enable = true; - systemd.enable = true; - xwayland.enable = true; - settings = { - exec-once = if cfg.gnome-keyring then ["${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"] + wayland.windowManager.hyprland = { + enable = true; + systemd.enable = true; + xwayland.enable = true; + settings = { + exec-once = (if cfg.gnome-keyring then + ["${pkgs.polkit_gnome}/libexec/polkit-gnome-authentication-agent-1"] else []); - monitor = map ( - m: "${m.device},${builtins.toString m.resolution.x}x${builtins.toString m.resolution.y}@${builtins.toString m.refresh_rate},${builtins.toString m.position.x}x${builtins.toString m.position.y},${builtins.toString m.scale},transform,${builtins.toString m.transform}" - ) monitors; #TODO: default value + monitor = map ( + m: "${m.device},${builtins.toString m.resolution.x}x${builtins.toString m.resolution.y}@${builtins.toString m.refresh_rate},${builtins.toString m.position.x}x${builtins.toString m.position.y},${builtins.toString m.scale},transform,${builtins.toString m.transform}" + ) monitors; #TODO: default value + }; }; }; }; - }; } diff --git a/modules/gui/default.nix b/modules/gui/default.nix index 95868e4..a584a6a 100644 --- a/modules/gui/default.nix +++ b/modules/gui/default.nix @@ -9,7 +9,8 @@ _: { ./zathura.nix ./obs.nix ./foot.nix -# ./vivado.nix + ./rofi.nix + ./vivado2.nix ./WM ./alacritty.nix ./firefox.nix diff --git a/modules/gui/rofi.nix b/modules/gui/rofi.nix index e69de29..70fce84 100644 --- a/modules/gui/rofi.nix +++ b/modules/gui/rofi.nix @@ -0,0 +1,22 @@ +{ config, pkgs, lib, ... }: + +with lib; +let + username = config.modules.other.system.username; + cfg = config.modules.programs.rofi; +in +{ + options.modules.programs.rofi.enable = mkEnableOption "rofi"; + options.modules.other.system.wayland = mkOption { + type = types.bool; + description = "Does this system use wayland?"; + default = false; + }; #FIXME: move this to the (hopefully then) refactored options directory + + config = mkIf cfg.enable { + environment.systemPackages = with pkgs; [ + (if config.modules.other.system.wayland then rofi-wayland else rofi) + ]; + }; +} + diff --git a/modules/gui/vivado2.nix b/modules/gui/vivado2.nix index 0e5417e..7201008 100644 --- a/modules/gui/vivado2.nix +++ b/modules/gui/vivado2.nix @@ -1,58 +1,57 @@ { config, lib, pkgs, ...}: +with lib; let vivado-desktop-symbol = pkgs.makeDesktopItem { - name = "vivado-2022_2"; - desktopName = "Vivado"; - exec = "${pkgs.nur.repos.lschuermann.vivado-2022_2}/bin/vivado"; + name = "vivado-2022_2"; + desktopName = "Vivado"; + exec = "${pkgs.nur.repos.lschuermann.vivado-2022_2}/bin/vivado"; }; - cfg = with lib; [ config.modules.programs.vivado ]; - username = with lib; [ config.modules.other.system.username ]; + cfg = config.modules.programs.vivado; + username = config.modules.other.system.username; in { options.modules.programs.vivado.enable = mkEnableOption "vivado"; config = mkIf cfg.enable { - home-manager.users.${username} = { - environment.systemPackages = with pkgs; [ - # this propietary software is huge, but I need it for - # university - pkgs.nur.repos.lschuermann.vivado-2022_2 - vivado-desktop-symbol - ]; + environment.systemPackages = with pkgs; [ + # this propietary software is huge, but I need it for + # university + pkgs.nur.repos.lschuermann.vivado-2022_2 + vivado-desktop-symbol + ]; - # Create udev rules. Reference: https://blog.kotatsu.dev/posts/2021-09-14-vivado-on-nixos/ - services.udev.packages = [ - (pkgs.writeTextFile { - name = "xilinx-dilligent-usb-udev"; - destination = "/etc/udev/rules.d/52-xilinx-digilent-usb.rules"; - text = '' - ATTR{idVendor}=="1443", MODE:="666" - ACTION=="add", ATTR{idVendor}=="0403", ATTR{manufacturer}=="Digilent", MODE:="666" - ''; - }) - (pkgs.writeTextFile { - name = "xilinx-pcusb-udev"; - destination = "/etc/udev/rules.d/52-xilinx-pcusb.rules"; - text = '' - ATTR{idVendor}=="03fd", ATTR{idProduct}=="0008", MODE="666" - ATTR{idVendor}=="03fd", ATTR{idProduct}=="0007", MODE="666" - ATTR{idVendor}=="03fd", ATTR{idProduct}=="0009", MODE="666" - ATTR{idVendor}=="03fd", ATTR{idProduct}=="000d", MODE="666" - ATTR{idVendor}=="03fd", ATTR{idProduct}=="000f", MODE="666" - ATTR{idVendor}=="03fd", ATTR{idProduct}=="0013", MODE="666" - ATTR{idVendor}=="03fd", ATTR{idProduct}=="0015", MODE="666" - ''; - }) - (pkgs.writeTextFile { - name = "xilinx-ftdi-usb-udev"; - destination = "/etc/udev/rules.d/52-xilinx-ftdi-usb.rules"; - text = '' - ACTION=="add", ATTR{idVendor}=="0403", ATTR{manufacturer}=="Xilinx", MODE:="666" - ''; - }) - ]; - }; + # Create udev rules. Reference: https://blog.kotatsu.dev/posts/2021-09-14-vivado-on-nixos/ + services.udev.packages = [ + (pkgs.writeTextFile { + name = "xilinx-dilligent-usb-udev"; + destination = "/etc/udev/rules.d/52-xilinx-digilent-usb.rules"; + text = '' + ATTR{idVendor}=="1443", MODE:="666" + ACTION=="add", ATTR{idVendor}=="0403", ATTR{manufacturer}=="Digilent", MODE:="666" + ''; + }) + (pkgs.writeTextFile { + name = "xilinx-pcusb-udev"; + destination = "/etc/udev/rules.d/52-xilinx-pcusb.rules"; + text = '' + ATTR{idVendor}=="03fd", ATTR{idProduct}=="0008", MODE="666" + ATTR{idVendor}=="03fd", ATTR{idProduct}=="0007", MODE="666" + ATTR{idVendor}=="03fd", ATTR{idProduct}=="0009", MODE="666" + ATTR{idVendor}=="03fd", ATTR{idProduct}=="000d", MODE="666" + ATTR{idVendor}=="03fd", ATTR{idProduct}=="000f", MODE="666" + ATTR{idVendor}=="03fd", ATTR{idProduct}=="0013", MODE="666" + ATTR{idVendor}=="03fd", ATTR{idProduct}=="0015", MODE="666" + ''; + }) + (pkgs.writeTextFile { + name = "xilinx-ftdi-usb-udev"; + destination = "/etc/udev/rules.d/52-xilinx-ftdi-usb.rules"; + text = '' + ACTION=="add", ATTR{idVendor}=="0403", ATTR{manufacturer}=="Xilinx", MODE:="666" + ''; + }) + ]; }; }