From e0d9c1c57c98531f1ce17eb04d458b9066ce92fd Mon Sep 17 00:00:00 2001 From: twoneis Date: Tue, 2 Jul 2024 02:35:36 +0200 Subject: [PATCH] move niri setup to one folder --- modules/colors.nix | 67 +++---- modules/default.nix | 3 +- modules/home/default.nix | 19 +- modules/home/niri-setup/default.nix | 136 ------------- modules/niri/default.nix | 196 +++---------------- modules/niri/fuzzel-settings.nix | 11 ++ modules/niri/niri-settings.nix | 164 ++++++++++++++++ modules/niri/swaylock-settings.nix | 32 +++ modules/niri/waybar-settings.nix | 63 ++++++ modules/{home/niri-setup => niri}/waybar.css | 0 10 files changed, 329 insertions(+), 362 deletions(-) delete mode 100644 modules/home/niri-setup/default.nix create mode 100644 modules/niri/fuzzel-settings.nix create mode 100644 modules/niri/niri-settings.nix create mode 100644 modules/niri/swaylock-settings.nix create mode 100644 modules/niri/waybar-settings.nix rename modules/{home/niri-setup => niri}/waybar.css (100%) diff --git a/modules/colors.nix b/modules/colors.nix index 7c579ab..30aef70 100644 --- a/modules/colors.nix +++ b/modules/colors.nix @@ -1,47 +1,24 @@ -{ - base = { - hex = "#191724"; - }; - surface = { - hex = "#1f1d2e"; - }; - overlay = { - hex = "#26233a"; - }; - muted = { - hex = "#6e6a86"; - }; - subtle = { - hex = "#908caa"; - }; - text = { - hex = "#e0def4"; - }; - love = { - hex = "#eb6f92"; - }; - gold = { - hex = "#f6c177"; - }; - rose = { - hex = "#ebbcba"; - }; - pine = { - hex = "#31748f"; - }; - foam = { - hex = "#9ccfd8"; - }; - iris = { - hex = "#c4a7e7"; - }; - highlight-low = { - hex = "#21202e"; - }; - highlight-med = { - hex = "#403d52"; - }; - highlight-high = { - hex = "#524f67"; +{ lib, ... }: { + options = with lib; { + theme = mkOption { + type = with types; attrsOf str; + default = { + base = "#191724"; + surface = "#1f1d2e"; + overlay = "#26233a"; + muted = "#6e6a86"; + subtle = "#908caa"; + text = "#e0def4"; + love = "#eb6f92"; + gold = "#f6c177"; + rose = "#ebbcba"; + pine = "#31748f"; + foam = "#9ccfd8"; + iris = "#c4a7e7"; + highlight-low = "#21202e"; + highlight-med = "#403d52"; + highlight-high = "#524f67"; + }; + }; }; } diff --git a/modules/default.nix b/modules/default.nix index 4bbc870..dbbe28b 100644 --- a/modules/default.nix +++ b/modules/default.nix @@ -1,13 +1,12 @@ { inputs, pkgs, lib, ... }: { imports = [ + ./colors.nix ./audio ./bluetooth ./containers ./games - ./gnome ./home ./niri - ./plasma ./virt ]; diff --git a/modules/home/default.nix b/modules/home/default.nix index 9d2f133..26f0092 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -1,17 +1,4 @@ -{ config, lib, ... }: let - modules = lib.lists.flatten [ - (if config.withNiri then [ - ./niri-setup - ./themes - ] else []) - (if config.withGnome then [ - ./themes - ] else []) - (if config.full then [ - ./programs - ] else []) - ]; -in { +{ ... }: { home-manager = { useGlobalPkgs = true; useUserPackages = true; @@ -19,7 +6,9 @@ in { users.twoneis = { imports = [ ./utils - ] ++ modules; + ./programs + ./themes + ]; home = { username = "twoneis"; diff --git a/modules/home/niri-setup/default.nix b/modules/home/niri-setup/default.nix deleted file mode 100644 index 36fee6f..0000000 --- a/modules/home/niri-setup/default.nix +++ /dev/null @@ -1,136 +0,0 @@ -{ lib, osConfig, pkgs, ... }: let - theme = import ../../colors.nix; -in lib.mkIf (osConfig.withNiri) { - programs.fuzzel= { - enable = true; - settings = { - colors = with lib; with strings; { - background = concatStrings [ theme.base.hex "ee" ]; - text = concatStrings [ theme.text.hex "ff" ]; - match = concatStrings [ theme.gold.hex "ff" ]; - selection = concatStrings [theme.highlight-med.hex "ee" ]; - selection-text = concatStrings [ theme.text.hex "ff" ]; - selection-match = concatStrings [ theme.gold.hex "ff" ]; - border = concatStrings [ theme.overlay.hex "ff" ]; - }; - }; - }; - - programs.waybar = { - enable = true; - settings = { - mainBar = { - layer = "top"; - position = "top"; - modules-left = [ - "memory" - "cpu" - "temperature" - ]; - modules-center = [ - "clock" - ]; - modules-right = [ - "network" - "wireplumber" - "battery" - ]; - "cpu" = { - interval = 10; - format = "{usage}%"; - }; - "temperature" = { - hwmon-path = osConfig.hwmonPath; - format = "{temperatureC}°C "; - interval = 10; - tooltip = false; - }; - "memory" = { - interval = 30; - format = "{percentage}% "; - }; - "clock" = { - format = "{:%H:%M}"; - format-alt = "{:%a, %Y-%m-%d}"; - }; - "battery" = { - states = { - good = 80; - warning = 50; - critical = 20; - }; - format = "{icon}"; - format-alt = "{capacity}%"; - format-icons = ["" "" "" "" ""]; - tooltip = false; - }; - "network" = { - format-wifi = "{icon}"; - format-alt = "{essid}"; - format-ethernet = "󰈁"; - format-disconnected = "󰤭"; - format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"]; - tooltip = false; - }; - "wireplumber" = { - format = "{icon}"; - format-alt = "{volume}%"; - format-muted = ""; - format-icons = ["" "" ""]; - tooltip = false; - }; - }; - }; - style = builtins.readFile(./waybar.css); - }; - - services.mako = { - enable = true; - defaultTimeout = 5000; - maxVisible = 3; - font = "AlegreyaSans"; - backgroundColor = theme.base.hex; - borderColor = theme.muted.hex; - textColor = theme.text.hex; - borderSize = 1; - borderRadius = 8; - icons = false; - }; - - programs.swaylock = { - enable = true; - package = pkgs.swaylock-effects; - settings = with lib; with strings; { - ignore-empty-password = true; - screenshots = true; - clock = true; - submit-on-touch = true; - indicator = true; - indicator-caps-lock = true; - indicator-radius = 100; - indicator-thickness = 4; - inside-color = concatStrings [ theme.overlay.hex "aa" ]; - inside-clear-color = concatStrings [ theme.subtle.hex "aa" ]; - inside-caps-lock-color = concatStrings [ theme.rose.hex "aa" ]; - inside-ver-color = concatStrings [ theme.foam.hex "aa" ]; - inside-wrong-color = concatStrings [ theme.love.hex "aa" ]; - line-uses-inside = true; - ring-color = theme.surface.hex; - ring-clear-color = theme.muted.hex; - ring-caps-lock-color = theme.gold.hex; - ring-ver-color = theme.pine.hex; - ring-wrong-color = theme.love.hex; - seperator-color = theme.base.hex; - key-hl-color = theme.iris.hex; - bs-hl-color = theme.love.hex; - caps-lock-key-hl-color = theme.iris.hex; - caps-lock-bs-hl-color = theme.love.hex; - text-color = theme.text.hex; - text-clear-color = theme.text.hex; - text-caps-lock-color = theme.text.hex; - text-ver-color = theme.text.hex; - text-wrong-color = theme.text.hex; - effect-blur = "30x10"; - }; - }; -} diff --git a/modules/niri/default.nix b/modules/niri/default.nix index 3ac2e9e..5d377d7 100644 --- a/modules/niri/default.nix +++ b/modules/niri/default.nix @@ -1,176 +1,44 @@ { lib, config, pkgs, ... }: lib.mkIf (config.withNiri) { programs.niri.enable = true; - environment.systemPackages = with pkgs; [ - brightnessctl - swaybg - ]; home-manager.users.twoneis = { + home.packages = with pkgs; [ + brightnessctl + swaybg + ]; + programs.niri = { - settings = { - input = { - keyboard = { - xkb = { - layout = "us"; - options = "compose:ralt"; - }; - }; - touchpad = { - tap = true; - natural-scroll = true; - }; - tablet = { - map-to-output = "DP-3"; - }; - touch = { - map-to-output = "eDP-1"; - }; - power-key-handling.enable = false; - }; - outputs."eDP-1" = { - scale = 1.0; - mode = { - width = 2736; - height = 1824; - refresh = 59.959; - }; - position = { - x=0; - y=0; - }; - }; + settings = import ./niri-settings.nix { config = config; }; + }; - outputs."DP-1" = { - scale = 1.0; - mode = { - width = 5120; - height = 2160; - refresh = 59.940; - }; - position = { - x=2736; - y=0; - }; - }; + programs.fuzzel= { + enable = true; + settings = import ./fuzzel-settings.nix { lib = lib; config = config; }; + }; - layout = { - focus-ring = { - width = 4; - active.gradient = { - from="#31748f"; - to="#9ccfd8"; - angle=135; - }; - inactive.color = "#c4a7e7"; - }; + programs.waybar = { + enable = true; + settings = import ./waybar-settings.nix { config = config; }; + style = builtins.readFile(./waybar.css); + }; - preset-column-widths = [ - { proportion = 0.25; } - { proportion = 0.5; } - { proportion = 0.75; } - ]; + services.mako = { + enable = true; + defaultTimeout = 5000; + maxVisible = 3; + font = "AlegreyaSans"; + backgroundColor = config.theme.base; + borderColor = config.theme.muted; + textColor = config.theme.text; + borderSize = 1; + borderRadius = 8; + icons = false; + }; - default-column-width = { proportion = 0.25; }; - gaps = 4; - }; - - window-rules = [ - { - geometry-corner-radius = { - top-left = 8.0; - top-right = 8.0; - bottom-left = 8.0; - bottom-right= 8.0; - }; - clip-to-geometry = true; - } { - matches = [{app-id = "gamescope";}]; - open-fullscreen = true; - } - ]; - - prefer-no-csd = true; - - screenshot-path = "~/Pictures/Screenshots/%Y-%m-%d-%H-%M-%S.png"; - - hotkey-overlay.skip-at-startup = true; - - spawn-at-startup = [ - { command = ["waybar"]; } - { command = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0"]; } - { command = ["brightnessctl" "s" "50%"]; } - { command = ["swaybg" "-c" "1f1d2e"]; } - ]; - - binds = { - "Mod+T".action.spawn = "alacritty"; - "Mod+B".action.spawn = "firefox"; - "Mod+S".action.spawn = ["fuzzel" "-I" "-T" "alacritty" "-p" ""]; - - "XF86AudioRaiseVolume".action.spawn = ["wpctl" "set-volume" "-l" "1" "@DEFAULT_AUDIO_SINK@" "5%+"]; - "XF86AudioLowerVolume".action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "5%-"]; - "XF86MonBrightnessDown".action.spawn = ["brightnessctl" "-n=10%" "s" "5%-"]; - "XF86MonBrightnessUp".action.spawn = ["brightnessctl" "s" "5%+"]; - - "Mod+Backspace".action.close-window = []; - - "Mod+Left".action.focus-column-left = []; - "Mod+Right".action.focus-column-right = []; - "Mod+Up".action.focus-window-up = []; - "Mod+Down".action.focus-window-down = []; - "Mod+Comma".action.focus-column-left = []; - "Mod+Period".action.focus-column-right = []; - "Mod+E".action.focus-window-up = []; - "Mod+O".action.focus-window-down = []; - - "Mod+Shift+Left".action.move-column-left = []; - "Mod+Shift+Right".action.move-column-right = []; - "Mod+Shift+Up".action.move-window-up = []; - "Mod+Shift+Down".action.move-window-down = []; - "Mod+Shift+Comma".action.move-column-left = []; - "Mod+Shift+Period".action.move-column-right = []; - "Mod+Shift+E".action.move-window-up = []; - "Mod+Shift+O".action.move-window-down = []; - - "Mod+Ctrl+Left".action.focus-monitor-left = []; - "Mod+Ctrl+Right".action.focus-monitor-right = []; - "Mod+Ctrl+Up".action.focus-monitor-up = []; - "Mod+Ctrl+Down".action.focus-monitor-down = []; - "Mod+Ctrl+Comma".action.focus-monitor-left = []; - "Mod+Ctrl+Period".action.focus-monitor-right = []; - "Mod+Ctrl+E".action.focus-monitor-up = []; - "Mod+Ctrl+O".action.focus-monitor-down = []; - - "Mod+Shift+Ctrl+Left".action.move-column-to-monitor-left = []; - "Mod+Shift+Ctrl+Right".action.move-column-to-monitor-right = []; - "Mod+Shift+Ctrl+Up".action.move-column-to-monitor-up = []; - "Mod+Shift+Ctrl+Down".action.move-column-to-monitor-down = []; - "Mod+Shift+Ctrl+Comma".action.move-column-to-monitor-left = []; - "Mod+Shift+Ctrl+Period".action.move-column-to-monitor-right = []; - "Mod+Shift+Ctrl+E".action.move-column-to-monitor-up = []; - "Mod+Shift+Ctrl+O".action.move-column-to-monitor-down = []; - - "Mod+P".action.consume-window-into-column = []; - "Mod+Shift+P".action.expel-window-from-column = []; - - "Mod+Z".action.switch-preset-column-width = []; - "Mod+F".action.maximize-column = []; - "Mod+Shift+F".action.fullscreen-window = []; - "Mod+K".action.center-column = []; - - "Mod+Plus".action.set-column-width = "+10%"; - "Mod+Minus".action.set-column-width = "-10%"; - "Mod+Shift+Plus".action.set-window-height = "+10%"; - "Mod+Shift+Minus".action.set-window-height = "-10%"; - - "Mod+Shift+S".action.screenshot = []; - "Mod+Shift+Ctrl+S".action.screenshot-window = []; - "Print".action.screenshot-screen = []; - - "Mod+Shift+L".action.spawn = "swaylock"; - "Mod+Shift+Q".action.quit = []; - }; - }; + programs.swaylock = { + enable = true; + package = pkgs.swaylock-effects; + settings = import ./swaylock-settings.nix { lib = lib; config = config; }; }; }; } diff --git a/modules/niri/fuzzel-settings.nix b/modules/niri/fuzzel-settings.nix new file mode 100644 index 0000000..fe43e4c --- /dev/null +++ b/modules/niri/fuzzel-settings.nix @@ -0,0 +1,11 @@ +{ lib, config, ... }: { + colors = with lib; with strings; { + background = concatStrings [ config.theme.base "ee" ]; + text = concatStrings [ config.theme.text "ff" ]; + match = concatStrings [ config.theme.gold "ff" ]; + selection = concatStrings [ config.theme.highlight-med "ee" ]; + selection-text = concatStrings [ config.theme.text "ff" ]; + selection-match = concatStrings [ config.theme.gold "ff" ]; + border = concatStrings [ config.theme.overlay "ff" ]; + }; +} diff --git a/modules/niri/niri-settings.nix b/modules/niri/niri-settings.nix new file mode 100644 index 0000000..0872222 --- /dev/null +++ b/modules/niri/niri-settings.nix @@ -0,0 +1,164 @@ +{ config, ... }: { + input = { + keyboard = { + xkb = { + layout = "us"; + options = "compose:ralt"; + }; + }; + touchpad = { + tap = true; + natural-scroll = true; + }; + tablet = { + map-to-output = "DP-3"; + }; + touch = { + map-to-output = "eDP-1"; + }; + power-key-handling.enable = false; + }; + outputs."eDP-1" = { + scale = 1.0; + mode = { + width = 2736; + height = 1824; + refresh = 59.959; + }; + position = { + x=0; + y=0; + }; + }; + + outputs."DP-1" = { + scale = 1.0; + mode = { + width = 5120; + height = 2160; + refresh = 59.940; + }; + position = { + x=2736; + y=0; + }; + }; + + layout = { + focus-ring = { + width = 4; + active.gradient = { + from=config.theme.rose; + to=config.theme.pine; + angle=135; + }; + inactive.color = config.theme.iris; + }; + + preset-column-widths = [ + { proportion = 0.25; } + { proportion = 0.5; } + { proportion = 0.75; } + ]; + + default-column-width = { proportion = 0.25; }; + gaps = 4; + }; + + window-rules = [ + { + geometry-corner-radius = { + top-left = 8.0; + top-right = 8.0; + bottom-left = 8.0; + bottom-right= 8.0; + }; + clip-to-geometry = true; + } { + matches = [{app-id = "gamescope";}]; + open-fullscreen = true; + } + ]; + + prefer-no-csd = true; + + screenshot-path = "~/Pictures/Screenshots/%Y-%m-%d-%H-%M-%S.png"; + + hotkey-overlay.skip-at-startup = true; + + spawn-at-startup = [ + { command = ["waybar"]; } + { command = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "0"]; } + { command = ["brightnessctl" "s" "50%"]; } + { command = ["swaybg" "-c" "1f1d2e"]; } + ]; + + binds = { + "Mod+T".action.spawn = "alacritty"; + "Mod+B".action.spawn = "firefox"; + "Mod+S".action.spawn = ["fuzzel" "-I" "-T" "alacritty" "-p" ""]; + + "XF86AudioRaiseVolume".action.spawn = ["wpctl" "set-volume" "-l" "1" "@DEFAULT_AUDIO_SINK@" "5%+"]; + "XF86AudioLowerVolume".action.spawn = ["wpctl" "set-volume" "@DEFAULT_AUDIO_SINK@" "5%-"]; + "XF86MonBrightnessDown".action.spawn = ["brightnessctl" "-n=10%" "s" "5%-"]; + "XF86MonBrightnessUp".action.spawn = ["brightnessctl" "s" "5%+"]; + + "Mod+Backspace".action.close-window = []; + + "Mod+Left".action.focus-column-left = []; + "Mod+Right".action.focus-column-right = []; + "Mod+Up".action.focus-window-up = []; + "Mod+Down".action.focus-window-down = []; + "Mod+Comma".action.focus-column-left = []; + "Mod+Period".action.focus-column-right = []; + "Mod+E".action.focus-window-up = []; + "Mod+O".action.focus-window-down = []; + + "Mod+Shift+Left".action.move-column-left = []; + "Mod+Shift+Right".action.move-column-right = []; + "Mod+Shift+Up".action.move-window-up = []; + "Mod+Shift+Down".action.move-window-down = []; + "Mod+Shift+Comma".action.move-column-left = []; + "Mod+Shift+Period".action.move-column-right = []; + "Mod+Shift+E".action.move-window-up = []; + "Mod+Shift+O".action.move-window-down = []; + + "Mod+Ctrl+Left".action.focus-monitor-left = []; + "Mod+Ctrl+Right".action.focus-monitor-right = []; + "Mod+Ctrl+Up".action.focus-monitor-up = []; + "Mod+Ctrl+Down".action.focus-monitor-down = []; + "Mod+Ctrl+Comma".action.focus-monitor-left = []; + "Mod+Ctrl+Period".action.focus-monitor-right = []; + "Mod+Ctrl+E".action.focus-monitor-up = []; + "Mod+Ctrl+O".action.focus-monitor-down = []; + + "Mod+Shift+Ctrl+Left".action.move-column-to-monitor-left = []; + "Mod+Shift+Ctrl+Right".action.move-column-to-monitor-right = []; + "Mod+Shift+Ctrl+Up".action.move-column-to-monitor-up = []; + "Mod+Shift+Ctrl+Down".action.move-column-to-monitor-down = []; + "Mod+Shift+Ctrl+Comma".action.move-column-to-monitor-left = []; + "Mod+Shift+Ctrl+Period".action.move-column-to-monitor-right = []; + "Mod+Shift+Ctrl+E".action.move-column-to-monitor-up = []; + "Mod+Shift+Ctrl+O".action.move-column-to-monitor-down = []; + + "Mod+P".action.consume-window-into-column = []; + "Mod+Shift+P".action.expel-window-from-column = []; + + "Mod+Z".action.switch-preset-column-width = []; + "Mod+F".action.maximize-column = []; + "Mod+Shift+F".action.fullscreen-window = []; + "Mod+K".action.center-column = []; + + "Mod+Plus".action.set-column-width = "+10%"; + "Mod+Minus".action.set-column-width = "-10%"; + "Mod+Shift+Plus".action.set-window-height = "+10%"; + "Mod+Shift+Minus".action.set-window-height = "-10%"; + + "Mod+Shift+S".action.screenshot = []; + "Mod+Shift+Ctrl+S".action.screenshot-window = []; + "Print".action.screenshot-screen = []; + + "Mod+Shift+L".action.spawn = "swaylock"; + "Mod+Shift+Q".action.quit = []; + }; +} diff --git a/modules/niri/swaylock-settings.nix b/modules/niri/swaylock-settings.nix new file mode 100644 index 0000000..7d2ed94 --- /dev/null +++ b/modules/niri/swaylock-settings.nix @@ -0,0 +1,32 @@ +{ lib, config, ... }: { + ignore-empty-password = true; + screenshots = true; + clock = true; + submit-on-touch = true; + indicator = true; + indicator-caps-lock = true; + indicator-radius = 100; + indicator-thickness = 4; + inside-color = lib.strings.concatStrings [ config.theme.overlay "aa" ]; + inside-clear-color = lib.strings.concatStrings [ config.theme.subtle "aa" ]; + inside-caps-lock-color = lib.strings.concatStrings [ config.theme.rose "aa" ]; + inside-ver-color = lib.strings.concatStrings [ config.theme.foam "aa" ]; + inside-wrong-color = lib.strings.concatStrings [ config.theme.love "aa" ]; + line-uses-inside = true; + ring-color = config.theme.surface; + ring-clear-color = config.theme.muted; + ring-caps-lock-color = config.theme.gold; + ring-ver-color = config.theme.pine; + ring-wrong-color = config.theme.love; + seperator-color = config.theme.base; + key-hl-color = config.theme.iris; + bs-hl-color = config.theme.love; + caps-lock-key-hl-color = config.theme.iris; + caps-lock-bs-hl-color = config.theme.love; + text-color = config.theme.text; + text-clear-color = config.theme.text; + text-caps-lock-color = config.theme.text; + text-ver-color = config.theme.text; + text-wrong-color = config.theme.text; + effect-blur = "30x10"; +} diff --git a/modules/niri/waybar-settings.nix b/modules/niri/waybar-settings.nix new file mode 100644 index 0000000..f4a3fe7 --- /dev/null +++ b/modules/niri/waybar-settings.nix @@ -0,0 +1,63 @@ +{ config, ... }: { + mainBar = { + layer = "top"; + position = "top"; + modules-left = [ + "memory" + "cpu" + "temperature" + ]; + modules-center = [ + "clock" + ]; + modules-right = [ + "network" + "wireplumber" + "battery" + ]; + "cpu" = { + interval = 10; + format = "{usage}%"; + }; + "temperature" = { + hwmon-path = config.hwmonPath; + format = "{temperatureC}°C "; + interval = 10; + tooltip = false; + }; + "memory" = { + interval = 30; + format = "{percentage}% "; + }; + "clock" = { + format = "{:%H:%M}"; + format-alt = "{:%a, %Y-%m-%d}"; + }; + "battery" = { + states = { + good = 80; + warning = 50; + critical = 20; + }; + format = "{icon}"; + format-alt = "{capacity}%"; + format-icons = ["" "" "" "" ""]; + tooltip = false; + }; + "network" = { + format-wifi = "{icon}"; + format-alt = "{essid}"; + format-ethernet = "󰈁"; + format-disconnected = "󰤭"; + format-icons = ["󰤯" "󰤟" "󰤢" "󰤥" "󰤨"]; + tooltip = false; + }; + "wireplumber" = { + format = "{icon}"; + format-alt = "{volume}%"; + format-muted = ""; + format-icons = ["" "" ""]; + tooltip = false; + }; + }; +} diff --git a/modules/home/niri-setup/waybar.css b/modules/niri/waybar.css similarity index 100% rename from modules/home/niri-setup/waybar.css rename to modules/niri/waybar.css