From 6dab8fc029141238705f15573c9733307f54ffea Mon Sep 17 00:00:00 2001 From: Jimbo Date: Mon, 23 Sep 2024 16:22:01 -0400 Subject: [PATCH] The big variable overhaul --- .gitattributes | 2 +- extras/cmd.nix | 4 + {home-manager/common => extras}/displays.nix | 2 - {system/modules => extras}/ips.nix | 0 extras/look.nix | 21 ++++ extras/overlays.nix | 2 - secrets.nix => extras/secrets.nix | Bin {home-manager/sway => extras}/workspaces.nix | 1 - flake.nix | 9 +- home-manager/common/auth.nix | 3 - home-manager/common/border.nix | 5 - home-manager/common/colors.nix | 12 --- home-manager/common/fonts.nix | 5 - home-manager/common/nixcfg.nix | 3 - home-manager/guiapps/foot.nix | 14 +-- home-manager/guiapps/gtk.nix | 8 +- home-manager/guiapps/librewolf.nix | 44 ++++---- home-manager/guiapps/rofi.nix | 44 ++++---- home-manager/home.nix | 1 - home-manager/jimbo_ssh.nix | 3 - home-manager/services/mako.nix | 19 ++-- home-manager/sway/hardware.nix | 25 ++--- home-manager/sway/hotkeys.nix | 105 +++++++++---------- home-manager/sway/rules.nix | 64 +++++++---- home-manager/sway/sway.nix | 13 +-- home-manager/sway/swaylock.nix | 15 ++- home-manager/sway/swayshot.nix | 9 +- home-manager/sway/theme.nix | 47 ++++----- home-manager/sway/waybar.nix | 30 +++--- home-manager/tuiapps/neovim.nix | 11 +- home-manager/tuiapps/zsh.nix | 19 ++-- system/desktop/firewall.nix | 6 +- system/desktop/fonts.nix | 2 +- system/hardware/machines/desktop.nix | 4 +- system/modules/networking.nix | 10 -- system/server/firewall.nix | 33 +++--- 36 files changed, 269 insertions(+), 326 deletions(-) create mode 100644 extras/cmd.nix rename {home-manager/common => extras}/displays.nix (50%) rename {system/modules => extras}/ips.nix (100%) create mode 100644 extras/look.nix rename secrets.nix => extras/secrets.nix (100%) rename {home-manager/sway => extras}/workspaces.nix (91%) delete mode 100644 home-manager/common/auth.nix delete mode 100644 home-manager/common/border.nix delete mode 100644 home-manager/common/colors.nix delete mode 100644 home-manager/common/fonts.nix delete mode 100644 home-manager/common/nixcfg.nix diff --git a/.gitattributes b/.gitattributes index f0bd4f3..8aafc71 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1 @@ -secrets.nix filter=git-crypt diff=git-crypt +extras/secrets.nix filter=git-crypt diff=git-crypt diff --git a/extras/cmd.nix b/extras/cmd.nix new file mode 100644 index 0000000..a407dca --- /dev/null +++ b/extras/cmd.nix @@ -0,0 +1,4 @@ +{ + auth = "doas"; + nixcfg = "ranger /etc/nixos"; +} diff --git a/home-manager/common/displays.nix b/extras/displays.nix similarity index 50% rename from home-manager/common/displays.nix rename to extras/displays.nix index 698c51f..cfaa867 100644 --- a/home-manager/common/displays.nix +++ b/extras/displays.nix @@ -1,7 +1,5 @@ { - # Define the primary monitor d1 = ''DP-3''; d2 = ''DP-1''; d3 = ''DP-2''; - dTouch = ''eDP-1''; } diff --git a/system/modules/ips.nix b/extras/ips.nix similarity index 100% rename from system/modules/ips.nix rename to extras/ips.nix diff --git a/extras/look.nix b/extras/look.nix new file mode 100644 index 0000000..0a2dad5 --- /dev/null +++ b/extras/look.nix @@ -0,0 +1,21 @@ +{ + colors = { + prime = ''3823C4''; #3823C4 + accent = ''1B1F59''; #1B1F59 + split = ''555B9E''; #555B9E + actSplit = ''5980B7''; #5980B7 + dark = ''101419''; #101419 + mid = ''171C23''; #171C23 + light = ''272b33''; #272B33 + urgent = ''C43823''; #C43823 + text = ''C7D3E3''; #C7D3E3 + }; + fonts = { + main = ''Ubuntu''; + nerd = ''UbuntuMono Nerd Font''; + }; + border = rec { + int = 3; + string = toString int; + }; +} diff --git a/extras/overlays.nix b/extras/overlays.nix index bf2d243..f048cce 100644 --- a/extras/overlays.nix +++ b/extras/overlays.nix @@ -1,9 +1,7 @@ -# This file defines overlays {inputs, ...}: { # This one brings our custom packages from the 'pkgs' directory additions = final: _prev: import ./pkgs {pkgs = final;}; - # This one contains whatever you want to overlay selfsuper = (self: super: { mpv = super.mpv.override { scripts = with self.mpvScripts; [mpris sponsorblock thumbnail]; diff --git a/secrets.nix b/extras/secrets.nix similarity index 100% rename from secrets.nix rename to extras/secrets.nix diff --git a/home-manager/sway/workspaces.nix b/extras/workspaces.nix similarity index 91% rename from home-manager/sway/workspaces.nix rename to extras/workspaces.nix index 1183507..4615a49 100644 --- a/home-manager/sway/workspaces.nix +++ b/extras/workspaces.nix @@ -1,5 +1,4 @@ { - # Define the workspace names w0 = ''0:0''; w1 = ''1:1''; w2 = ''2:2''; diff --git a/flake.nix b/flake.nix index 6575ab2..e847f1a 100644 --- a/flake.nix +++ b/flake.nix @@ -42,8 +42,13 @@ # Your custom packages and modifications, exported as overlays overlays = import ./extras/overlays.nix {inherit inputs;}; - # Secrets defined so they can be accessed globally - secrets = import ./secrets.nix; + # Variables defined so they can be accessed globally + secrets = import ./extras/secrets.nix; + cmd = import ./extras/cmd.nix; + displays = import ./extras/displays.nix; + ips = import ./extras/ips.nix; + look = import ./extras/look.nix; + ws = import ./extras/workspaces.nix; # NixOS configuration entrypointm use 'nixos-rebuild --flake .#your-hostname' nixosConfigurations = { diff --git a/home-manager/common/auth.nix b/home-manager/common/auth.nix deleted file mode 100644 index 2c4b758..0000000 --- a/home-manager/common/auth.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - method = "doas"; -} diff --git a/home-manager/common/border.nix b/home-manager/common/border.nix deleted file mode 100644 index 790234c..0000000 --- a/home-manager/common/border.nix +++ /dev/null @@ -1,5 +0,0 @@ -rec { - # Define miscellaneous window manager properties - weightInt = 3; - weight = toString weightInt; -} diff --git a/home-manager/common/colors.nix b/home-manager/common/colors.nix deleted file mode 100644 index 84bd09b..0000000 --- a/home-manager/common/colors.nix +++ /dev/null @@ -1,12 +0,0 @@ -{ - # Global color palette - prime = ''3823C4''; #3823C4 - accent = ''1B1F59''; #1B1F59 - split = ''555B9E''; #555B9E - actSplit = ''5980B7''; #5980B7 - dark = ''101419''; #101419 - mid = ''171C23''; #171C23 - light = ''272b33''; #272B33 - urgent = ''C43823''; #C43823 - text = ''C7D3E3''; #C7D3E3 -} diff --git a/home-manager/common/fonts.nix b/home-manager/common/fonts.nix deleted file mode 100644 index d326efb..0000000 --- a/home-manager/common/fonts.nix +++ /dev/null @@ -1,5 +0,0 @@ -{ - # Set the default fonts - main = ''Ubuntu''; - nerd = ''UbuntuMono Nerd Font''; -} diff --git a/home-manager/common/nixcfg.nix b/home-manager/common/nixcfg.nix deleted file mode 100644 index 88370a9..0000000 --- a/home-manager/common/nixcfg.nix +++ /dev/null @@ -1,3 +0,0 @@ -{ - open = "ranger /etc/nixos"; -} diff --git a/home-manager/guiapps/foot.nix b/home-manager/guiapps/foot.nix index b5aa2a4..73d8a1c 100644 --- a/home-manager/guiapps/foot.nix +++ b/home-manager/guiapps/foot.nix @@ -1,23 +1,19 @@ -{ +{outputs, ...}: { # Enable a terminal emulator programs.foot = { enable = true; server.enable = false; settings = { - main = let - fonts = import ../common/fonts.nix; - in { + main = { term = "xterm-256color"; - font = "${fonts.nerd}:size=14.7"; + font = "${outputs.look.fonts.nerd}:size=14.7"; }; cursor = { style = "beam"; }; - colors = let - colors = import ../common/colors.nix; - in { + colors = { alpha = "0.65"; - background = "${colors.dark}"; + background = "${outputs.look.colors.dark}"; regular0 = "3f3f3f"; regular1 = "cc0000"; regular2 = "4e9a06"; diff --git a/home-manager/guiapps/gtk.nix b/home-manager/guiapps/gtk.nix index 778f420..fcf97ed 100644 --- a/home-manager/guiapps/gtk.nix +++ b/home-manager/guiapps/gtk.nix @@ -1,11 +1,9 @@ -{pkgs, ...}: { +{pkgs, outputs, ...}: { # Define GTK theme settings gtk = { enable = true; - font = let - fonts = import ../common/fonts.nix; - in { - name = "${fonts.main}"; + font = { + name = "${outputs.look.fonts.main}"; size = 11; }; theme = { diff --git a/home-manager/guiapps/librewolf.nix b/home-manager/guiapps/librewolf.nix index 069acc9..31b9ca1 100644 --- a/home-manager/guiapps/librewolf.nix +++ b/home-manager/guiapps/librewolf.nix @@ -1,34 +1,30 @@ -{pkgs, config, ...}: let - # Import variables - colors = import ../common/colors.nix; - fonts = import ../common/fonts.nix; - +{pkgs, config, outputs, ...}: let # FireFox colors themeJim = '' :root { - --tab-active-bg-color: #${colors.prime}; - --tab-hover-bg-color: #${colors.accent}; - --tab-inactive-bg-color: #${colors.dark}; + --tab-active-bg-color: #${outputs.look.colors.prime}; + --tab-hover-bg-color: #${outputs.look.colors.accent}; + --tab-inactive-bg-color: #${outputs.look.colors.dark}; --tab-active-fg-fallback-color: #FFFFFF; - --tab-inactive-fg-fallback-color: #${colors.text}; - --urlbar-focused-bg-color: #${colors.dark}; - --urlbar-not-focused-bg-color: #${colors.dark}; - --toolbar-bgcolor: #${colors.dark} !important; + --tab-inactive-fg-fallback-color: #${outputs.look.colors.text}; + --urlbar-focused-bg-color: #${outputs.look.colors.dark}; + --urlbar-not-focused-bg-color: #${outputs.look.colors.dark}; + --toolbar-bgcolor: #${outputs.look.colors.dark} !important; ''; themeAlt = '' :root { - --tab-active-bg-color: #${colors.dark}; - --tab-hover-bg-color: #${colors.accent}; - --tab-inactive-bg-color: #${colors.prime}; - --tab-active-fg-fallback-color: #${colors.text}; + --tab-active-bg-color: #${outputs.look.colors.dark}; + --tab-hover-bg-color: #${outputs.look.colors.accent}; + --tab-inactive-bg-color: #${outputs.look.colors.prime}; + --tab-active-fg-fallback-color: #${outputs.look.colors.text}; --tab-inactive-fg-fallback-color: #FFFFFF; - --urlbar-focused-bg-color: #${colors.prime}; - --urlbar-not-focused-bg-color: #${colors.prime}; - --toolbar-bgcolor: #${colors.prime} !important; + --urlbar-focused-bg-color: #${outputs.look.colors.prime}; + --urlbar-not-focused-bg-color: #${outputs.look.colors.prime}; + --toolbar-bgcolor: #${outputs.look.colors.prime} !important; ''; quteFoxCSS = '' - --tab-font: '${fonts.main}'; - --urlbar-font: '${fonts.main}'; + --tab-font: '${outputs.look.fonts.main}'; + --urlbar-font: '${outputs.look.fonts.main}'; /* try increasing if you encounter problems */ --urlbar-height-setting: 24px; @@ -339,9 +335,9 @@ in { }; }; commonSettings = { - "font.name.serif.x-western" = "${fonts.main}"; - "font.name.sans-serif.x-western" = "${fonts.main}"; - "font.name.monospace.x-western" = "${fonts.nerd}"; + "font.name.serif.x-western" = "${outputs.look.fonts.main}"; + "font.name.sans-serif.x-western" = "${outputs.look.fonts.main}"; + "font.name.monospace.x-western" = "${outputs.look.fonts.nerd}"; "general.autoScroll" = true; "browser.compactmode.show" = true; "browser.uidensity" = 1; diff --git a/home-manager/guiapps/rofi.nix b/home-manager/guiapps/rofi.nix index edd927c..61528b6 100644 --- a/home-manager/guiapps/rofi.nix +++ b/home-manager/guiapps/rofi.nix @@ -1,16 +1,12 @@ -{pkgs, config, ...}: { +{pkgs, config, outputs, ...}: { # Enable Rofi programs.rofi = { enable = true; package = pkgs.rofi-wayland; terminal = "foot"; - font = let - fonts = import ../common/fonts.nix; - in "${fonts.main} 14"; + font = "${outputs.look.fonts.main} 14"; theme = let inherit (config.lib.formats.rasi) mkLiteral; - border = import ../common/border.nix; - colors = import ../common/colors.nix; in { "*" = { lightbg = mkLiteral "#EEE8D5"; @@ -19,24 +15,24 @@ red = mkLiteral "#DC322F"; background-color = mkLiteral "#00000000"; separatorcolor = mkLiteral "#00000000"; - normal-foreground = mkLiteral "#${colors.text}"; - normal-background = mkLiteral "#${colors.dark}1A"; - urgent-foreground = mkLiteral "#${colors.urgent}"; - active-foreground = mkLiteral "#${colors.split}"; - selected-active-foreground = mkLiteral "#${colors.prime}"; - background = mkLiteral "#${colors.dark}B3"; - bordercolor = mkLiteral "#${colors.prime}"; + normal-foreground = mkLiteral "#${outputs.look.colors.text}"; + normal-background = mkLiteral "#${outputs.look.colors.dark}1A"; + urgent-foreground = mkLiteral "#${outputs.look.colors.urgent}"; + active-foreground = mkLiteral "#${outputs.look.colors.split}"; + selected-active-foreground = mkLiteral "#${outputs.look.colors.prime}"; + background = mkLiteral "#${outputs.look.colors.dark}B3"; + bordercolor = mkLiteral "#${outputs.look.colors.prime}"; selected-normal-foreground = mkLiteral "#FFFFFF"; - selected-normal-background = mkLiteral "#${colors.prime}80"; - border-color = mkLiteral "#${colors.prime}"; - urgent-background = mkLiteral "#${colors.accent}26"; - active-background = mkLiteral "#${colors.accent}26"; - selected-active-background = mkLiteral "#${colors.split}54"; + selected-normal-background = mkLiteral "#${outputs.look.colors.prime}80"; + border-color = mkLiteral "#${outputs.look.colors.prime}"; + urgent-background = mkLiteral "#${outputs.look.colors.accent}26"; + active-background = mkLiteral "#${outputs.look.colors.accent}26"; + selected-active-background = mkLiteral "#${outputs.look.colors.split}54"; }; "#window" = { background-color = mkLiteral "@background"; width = 500; - border = mkLiteral "${border.weight}"; + border = mkLiteral "${outputs.look.border.string}"; padding = 5; }; "#message" = { @@ -161,13 +157,13 @@ case $RET in Default) swaymsg reload ;; Wide) swaymsg " - output ${displays.d1} enable pos 1680 0 mode 1680x1050@59.954Hz - output ${displays.d2} enable pos 0 0 mode 1680x1050@59.954Hz - output ${displays.d3} enable pos 3360 0 transform 0 + output ${outputs.displays.d1} enable pos 1680 0 mode 1680x1050@59.954Hz + output ${outputs.displays.d2} enable pos 0 0 mode 1680x1050@59.954Hz + output ${outputs.displays.d3} enable pos 3360 0 transform 0 ";; GPU2) swaymsg " - output ${displays.d2} enable pos 1680 0 mode 1920x1080@60Hz - output ${displays.d3} enable pos 0 0 transform 0 + output ${outputs.displays.d2} enable pos 1680 0 mode 1920x1080@60Hz + output ${outputs.displays.d3} enable pos 0 0 transform 0 ";; esac } diff --git a/home-manager/home.nix b/home-manager/home.nix index f058d41..c6f2f07 100644 --- a/home-manager/home.nix +++ b/home-manager/home.nix @@ -20,7 +20,6 @@ outputs.overlays.additions outputs.overlays.selfsuper outputs.overlays.finalprev - outputs.overlays.unstable-packages inputs.blender-bin.overlays.default ]; # Configure your nixpkgs instance diff --git a/home-manager/jimbo_ssh.nix b/home-manager/jimbo_ssh.nix index 358f57b..3269777 100644 --- a/home-manager/jimbo_ssh.nix +++ b/home-manager/jimbo_ssh.nix @@ -5,9 +5,6 @@ ./users/jimbo.nix ]; - # Manually set the locale because it can fail otherwise - home.sessionVariables.LANG = "C.UTF-8"; - # Rebuild this entire system programs.zsh = { shellAliases = let diff --git a/home-manager/services/mako.nix b/home-manager/services/mako.nix index 1bc1cff..050bdf3 100644 --- a/home-manager/services/mako.nix +++ b/home-manager/services/mako.nix @@ -1,23 +1,18 @@ -{pkgs, ...}: { +{pkgs, outputs, ...}: { # Notification daemon - services.mako = let - colors = import ../common/colors.nix; - border = import ../common/border.nix; - displays = import ../common/displays.nix; - fonts = import ../common/fonts.nix; - in { + services.mako = { enable = true; - borderColor = "#${colors.accent}"; - backgroundColor = "#${colors.dark}CC"; - output = "${displays.d1}"; + borderColor = "#${outputs.look.colors.accent}"; + backgroundColor = "#${outputs.look.colors.dark}CC"; + output = "${outputs.displays.d1}"; sort = "+time"; layer = "overlay"; padding = "8"; margin = "0"; - borderSize = border.weightInt; + borderSize = outputs.look.border.int; maxIconSize = 40; defaultTimeout = 6000; - font = "${fonts.main} 12"; + font = "${outputs.look.fonts.main} 12"; anchor = "bottom-right"; extraConfig = "on-button-right=dismiss-all\nouter-margin=10\n[mode=do-not-disturb]\ninvisible=1"; }; diff --git a/home-manager/sway/hardware.nix b/home-manager/sway/hardware.nix index c86b1a3..3a8d8e8 100644 --- a/home-manager/sway/hardware.nix +++ b/home-manager/sway/hardware.nix @@ -1,12 +1,9 @@ -{config, pkgs, ...}: { - # Enable Sway and write some scripts +{config, pkgs, outputs, ...}: { wayland.windowManager.sway = { - config = let - displays = import ../common/displays.nix; - in { - # Define hardware + config = { + # Define monitors output = { - ${displays.d1} = { + ${outputs.displays.d1} = { pos = "1920 405"; mode = "1920x1080@143.980Hz"; max_render_time = "3"; @@ -14,28 +11,25 @@ scale = "1"; adaptive_sync = "on"; }; - ${displays.d2} = { + ${outputs.displays.d2} = { pos = "0 405"; mode = "1920x1080@60Hz"; max_render_time = "3"; bg = "~/.wallpapers/2.png fill"; }; - ${displays.d3} = { + ${outputs.displays.d3} = { pos = "3840 0"; mode = "1680x1050@59.883Hz"; transform = "270"; max_render_time = "3"; bg = "~/.wallpapers/3.png fill"; }; - ${displays.dTouch} = { - #scale = "1.4"; - }; "*" = { bg = "~/.wallpapers/1.png fill"; }; }; - # Mouse sensitivity, disable acceleration, allow touch while typing + # HID device config input = { "9610:4103:SINOWEALTH_Game_Mouse" = { pointer_accel = "-0.9"; @@ -51,11 +45,6 @@ dwt = "disabled"; natural_scroll = "disabled"; }; - - # Map touchscreen to output - "1386:806:Wacom_ISDv5_326_Finger" = { - map_to_output = "${displays.dTouch}"; - }; }; }; }; diff --git a/home-manager/sway/hotkeys.nix b/home-manager/sway/hotkeys.nix index 4d05ccd..fa45efd 100644 --- a/home-manager/sway/hotkeys.nix +++ b/home-manager/sway/hotkeys.nix @@ -1,12 +1,7 @@ -{config, pkgs, ...}: { +{config, pkgs, outputs, ...}: { wayland.windowManager.sway = { config = let - border = import ../common/border.nix; colors = import ../common/colors.nix; - displays = import ../common/displays.nix; - nixcfg = import ../common/nixcfg.nix; - ws = import ./workspaces.nix; - # Set default modifier and variables primeMod = "Mod4"; secMod = "Mod1"; @@ -21,9 +16,9 @@ # Get the current border style of the focused window current_style=$(swaymsg -t get_tree | jq -r '.. | select(.focused?).border') - # Toggle between "normal" (default) and "pixel ${border.weight}" border styles + # Toggle between "normal" (default) and "pixel ${outputs.look.border.string}" border styles if [ "$current_style" == "none" ]; then - swaymsg "sticky disable, border pixel ${border.weight}" + swaymsg "sticky disable, border pixel ${outputs.look.border.string}" else swaymsg "sticky enable, border none" fi @@ -33,7 +28,7 @@ swayTools = pkgs.writeScript "swaytools" '' # List the app name and whether or not it uses wayland swayprop() { - selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${colors.prime} -B 00000066 -b 00000000) + selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${outputs.look.colors.prime} -B 00000066 -b 00000000) if [ -n "$selected_window" ]; then app_id=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .app_id') system=$(sed 's/xdg_shell/Wayland/g; s/xwayland/Xorg/g' < <(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .shell')) @@ -43,7 +38,7 @@ # Kill a selected window swaykill() { - selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${colors.prime} -B 00000066 -b 00000000) + selected_window=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | "\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)"' | slurp -r -c ${outputs.look.colors.prime} -B 00000066 -b 00000000) if [ -n "$selected_window" ]; then pid=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | select("\(.rect.x),\(.rect.y) \(.rect.width)x\(.rect.height)" == "'"$selected_window"'") | .pid') kill -9 "$pid" @@ -83,7 +78,7 @@ "${primeMod}+${secMod}+Ctrl+r" = ''exec rofiscripts --resolutions''; # Open NixOS configuration files - "${primeMod}+F12" = ''exec foot ${nixcfg.open} | ${sendNotif} "Nix Config"''; + "${primeMod}+F12" = ''exec foot ${outputs.cmd.nixcfg} | ${sendNotif} "Nix Config"''; # Terminal, rofi, clipmenu, media script, power menu, show/hide waybar "${primeMod}+Return" = ''exec foot''; @@ -164,50 +159,50 @@ "${primeMod}+Shift+r" = ''reload''; # Switch to workspaces - "${primeMod}+grave" = ''workspace ${ws.w0}''; - "${primeMod}+1" = ''workspace ${ws.w1}''; - "${primeMod}+2" = ''workspace ${ws.w2}''; - "${primeMod}+3" = ''workspace ${ws.w3}''; - "${primeMod}+4" = ''workspace ${ws.w4}''; - "${primeMod}+5" = ''workspace ${ws.w5}''; - "${primeMod}+6" = ''workspace ${ws.w6}''; - "${primeMod}+7" = ''workspace ${ws.w7}''; - "${primeMod}+8" = ''workspace ${ws.w8}''; - "${primeMod}+9" = ''workspace ${ws.w9}''; + "${primeMod}+grave" = ''workspace ${outputs.ws.w0}''; + "${primeMod}+1" = ''workspace ${outputs.ws.w1}''; + "${primeMod}+2" = ''workspace ${outputs.ws.w2}''; + "${primeMod}+3" = ''workspace ${outputs.ws.w3}''; + "${primeMod}+4" = ''workspace ${outputs.ws.w4}''; + "${primeMod}+5" = ''workspace ${outputs.ws.w5}''; + "${primeMod}+6" = ''workspace ${outputs.ws.w6}''; + "${primeMod}+7" = ''workspace ${outputs.ws.w7}''; + "${primeMod}+8" = ''workspace ${outputs.ws.w8}''; + "${primeMod}+9" = ''workspace ${outputs.ws.w9}''; # Switch to alternate workspaces - "${secMod}+F1" = ''workspace ${ws.w1a}''; - "${secMod}+F2" = ''workspace ${ws.w2a}''; - "${secMod}+F3" = ''workspace ${ws.w3a}''; - "${secMod}+F4" = ''workspace ${ws.w4a}''; - "${secMod}+F5" = ''workspace ${ws.w5a}''; - "${secMod}+F6" = ''workspace ${ws.w6a}''; - "${secMod}+F7" = ''workspace ${ws.w7a}''; - "${secMod}+F8" = ''workspace ${ws.w8a}''; - "${secMod}+F9" = ''workspace ${ws.w9a}''; + "${secMod}+F1" = ''workspace ${outputs.ws.w1a}''; + "${secMod}+F2" = ''workspace ${outputs.ws.w2a}''; + "${secMod}+F3" = ''workspace ${outputs.ws.w3a}''; + "${secMod}+F4" = ''workspace ${outputs.ws.w4a}''; + "${secMod}+F5" = ''workspace ${outputs.ws.w5a}''; + "${secMod}+F6" = ''workspace ${outputs.ws.w6a}''; + "${secMod}+F7" = ''workspace ${outputs.ws.w7a}''; + "${secMod}+F8" = ''workspace ${outputs.ws.w8a}''; + "${secMod}+F9" = ''workspace ${outputs.ws.w9a}''; # Move window to and focus new workspace - "${primeMod}+Shift+grave" = ''move container to workspace ${ws.w0}; workspace ${ws.w0}''; - "${primeMod}+Shift+1" = ''move container to workspace ${ws.w1}; workspace ${ws.w1}''; - "${primeMod}+Shift+2" = ''move container to workspace ${ws.w2}; workspace ${ws.w2}''; - "${primeMod}+Shift+3" = ''move container to workspace ${ws.w3}; workspace ${ws.w3}''; - "${primeMod}+Shift+4" = ''move container to workspace ${ws.w4}; workspace ${ws.w4}''; - "${primeMod}+Shift+5" = ''move container to workspace ${ws.w5}; workspace ${ws.w5}''; - "${primeMod}+Shift+6" = ''move container to workspace ${ws.w6}; workspace ${ws.w6}''; - "${primeMod}+Shift+7" = ''move container to workspace ${ws.w7}; workspace ${ws.w7}''; - "${primeMod}+Shift+8" = ''move container to workspace ${ws.w8}; workspace ${ws.w8}''; - "${primeMod}+Shift+9" = ''move container to workspace ${ws.w9}; workspace ${ws.w9}''; + "${primeMod}+Shift+grave" = ''move container to workspace ${outputs.ws.w0}; workspace ${outputs.ws.w0}''; + "${primeMod}+Shift+1" = ''move container to workspace ${outputs.ws.w1}; workspace ${outputs.ws.w1}''; + "${primeMod}+Shift+2" = ''move container to workspace ${outputs.ws.w2}; workspace ${outputs.ws.w2}''; + "${primeMod}+Shift+3" = ''move container to workspace ${outputs.ws.w3}; workspace ${outputs.ws.w3}''; + "${primeMod}+Shift+4" = ''move container to workspace ${outputs.ws.w4}; workspace ${outputs.ws.w4}''; + "${primeMod}+Shift+5" = ''move container to workspace ${outputs.ws.w5}; workspace ${outputs.ws.w5}''; + "${primeMod}+Shift+6" = ''move container to workspace ${outputs.ws.w6}; workspace ${outputs.ws.w6}''; + "${primeMod}+Shift+7" = ''move container to workspace ${outputs.ws.w7}; workspace ${outputs.ws.w7}''; + "${primeMod}+Shift+8" = ''move container to workspace ${outputs.ws.w8}; workspace ${outputs.ws.w8}''; + "${primeMod}+Shift+9" = ''move container to workspace ${outputs.ws.w9}; workspace ${outputs.ws.w9}''; # Move window to and focus new alternate workspace - "${secMod}+Shift+F1" = ''move container to workspace ${ws.w1a}; workspace ${ws.w1a}''; - "${secMod}+Shift+F2" = ''move container to workspace ${ws.w2a}; workspace ${ws.w2a}''; - "${secMod}+Shift+F3" = ''move container to workspace ${ws.w3a}; workspace ${ws.w3a}''; - "${secMod}+Shift+F4" = ''move container to workspace ${ws.w4a}; workspace ${ws.w4a}''; - "${secMod}+Shift+F5" = ''move container to workspace ${ws.w5a}; workspace ${ws.w5a}''; - "${secMod}+Shift+F6" = ''move container to workspace ${ws.w6a}; workspace ${ws.w6a}''; - "${secMod}+Shift+F7" = ''move container to workspace ${ws.w7a}; workspace ${ws.w7a}''; - "${secMod}+Shift+F8" = ''move container to workspace ${ws.w8a}; workspace ${ws.w8a}''; - "${secMod}+Shift+F9" = ''move container to workspace ${ws.w9a}; workspace ${ws.w9a}''; + "${secMod}+Shift+F1" = ''move container to workspace ${outputs.ws.w1a}; workspace ${outputs.ws.w1a}''; + "${secMod}+Shift+F2" = ''move container to workspace ${outputs.ws.w2a}; workspace ${outputs.ws.w2a}''; + "${secMod}+Shift+F3" = ''move container to workspace ${outputs.ws.w3a}; workspace ${outputs.ws.w3a}''; + "${secMod}+Shift+F4" = ''move container to workspace ${outputs.ws.w4a}; workspace ${outputs.ws.w4a}''; + "${secMod}+Shift+F5" = ''move container to workspace ${outputs.ws.w5a}; workspace ${outputs.ws.w5a}''; + "${secMod}+Shift+F6" = ''move container to workspace ${outputs.ws.w6a}; workspace ${outputs.ws.w6a}''; + "${secMod}+Shift+F7" = ''move container to workspace ${outputs.ws.w7a}; workspace ${outputs.ws.w7a}''; + "${secMod}+Shift+F8" = ''move container to workspace ${outputs.ws.w8a}; workspace ${outputs.ws.w8a}''; + "${secMod}+Shift+F9" = ''move container to workspace ${outputs.ws.w9a}; workspace ${outputs.ws.w9a}''; # Change focus across windows "${primeMod}+Up" = ''focus up''; @@ -216,9 +211,9 @@ "${primeMod}+Right" = ''focus right''; # Switch focus across outputs - "${primeMod}+j" = ''focus output ${displays.d2}''; - "${primeMod}+k" = ''focus output ${displays.d1}''; - "${primeMod}+l" = ''focus output ${displays.d3}''; + "${primeMod}+j" = ''focus output ${outputs.displays.d2}''; + "${primeMod}+k" = ''focus output ${outputs.displays.d1}''; + "${primeMod}+l" = ''focus output ${outputs.displays.d3}''; # Move focused window "${primeMod}+Shift+Up" = ''move up ${resizeAmount} px''; @@ -227,9 +222,9 @@ "${primeMod}+Shift+Right" = ''move right ${resizeAmount} px''; # Move window across outputs - "${primeMod}+Shift+j" = ''move output ${displays.d2}; focus output ${displays.d2}''; - "${primeMod}+Shift+k" = ''move output ${displays.d1}; focus output ${displays.d1}''; - "${primeMod}+Shift+l" = ''move output ${displays.d3}; focus output ${displays.d3}''; + "${primeMod}+Shift+j" = ''move output ${outputs.displays.d2}; focus output ${outputs.displays.d2}''; + "${primeMod}+Shift+k" = ''move output ${outputs.displays.d1}; focus output ${outputs.displays.d1}''; + "${primeMod}+Shift+l" = ''move output ${outputs.displays.d3}; focus output ${outputs.displays.d3}''; # Change focus between floating/tiled, toggle floating "${primeMod}+space" = ''focus mode_toggle''; diff --git a/home-manager/sway/rules.nix b/home-manager/sway/rules.nix index 59b901e..16a1240 100644 --- a/home-manager/sway/rules.nix +++ b/home-manager/sway/rules.nix @@ -1,16 +1,34 @@ -{config, pkgs, ...}: { +{config, pkgs, outputs, ...}: { # Enable Sway and write some scripts wayland.windowManager.sway = { - config = let - border = import ../common/border.nix; - displays = import ../common/displays.nix; - ws = import ./workspaces.nix; - in { + config = { # Assign workspaces to outputs workspaceOutputAssign = let - workspaces1 = ["${ws.w0}" "${ws.w1}" "${ws.w2}" "${ws.w3}" "${ws.w1a}" "${ws.w2a}" "${ws.w3a}"]; - workspaces2 = ["${ws.w4}" "${ws.w5}" "${ws.w6}" "${ws.w4a}" "${ws.w5a}" "${ws.w6a}"]; - workspaces3 = ["${ws.w7}" "${ws.w8}" "${ws.w9}" "${ws.w7a}" "${ws.w8a}" "${ws.w9a}"]; + workspaces1 = [ + "${outputs.ws.w0}" + "${outputs.ws.w1}" + "${outputs.ws.w2}" + "${outputs.ws.w3}" + "${outputs.ws.w1a}" + "${outputs.ws.w2a}" + "${outputs.ws.w3a}" + ]; + workspaces2 = [ + "${outputs.ws.w4}" + "${outputs.ws.w5}" + "${outputs.ws.w6}" + "${outputs.ws.w4a}" + "${outputs.ws.w5a}" + "${outputs.ws.w6a}" + ]; + workspaces3 = [ + "${outputs.ws.w7}" + "${outputs.ws.w8}" + "${outputs.ws.w9}" + "${outputs.ws.w7a}" + "${outputs.ws.w8a}" + "${outputs.ws.w9a}" + ]; assign = output: workspaces: map (workspace: { inherit workspace; @@ -18,11 +36,13 @@ }) workspaces; in - (assign "${displays.d1}" workspaces1) ++ (assign "${displays.d2}" workspaces2) ++ (assign "${displays.d3}" workspaces3); + (assign "${outputs.displays.d1}" workspaces1) ++ + (assign "${outputs.displays.d2}" workspaces2) ++ + (assign "${outputs.displays.d3}" workspaces3); # Rules window = { - border = border.weightInt; + border = outputs.look.border.int; titlebar = false; commands = [ # Scratchpads @@ -56,7 +76,7 @@ # Give apps that don't have them borders { criteria = {con_mark = "borderless";}; - command = ''border pixel ${border.weight}''; + command = ''border pixel ${outputs.look.border.string}''; } { criteria = {app_id = "com.github.wwmm.easyeffects";}; @@ -91,20 +111,20 @@ ]; }; assigns = { - # Browsers - "${ws.w1}" = [{app_id = "JimBrowser";}]; - "${ws.w1a}" = [{app_id = "AltBrowser";}]; + # Brooutputs.wsers + "${outputs.ws.w1}" = [{app_id = "JimBrooutputs.wser";}]; + "${outputs.ws.w1a}" = [{app_id = "AltBrooutputs.wser";}]; # Communication - "${ws.w3a}" = [{class = "zoom";}]; - "${ws.w7}" = [{app_id = "MiscBrowser";} {app_id = "vesktop";} {class = "vesktop";}]; - "${ws.w8}" = [{app_id = "Element";} {class = "Element";}]; - "${ws.w9}" = [{app_id = "thunderbird";}]; + "${outputs.ws.w3a}" = [{class = "zoom";}]; + "${outputs.ws.w7}" = [{app_id = "MiscBrooutputs.wser";} {app_id = "vesktop";} {class = "vesktop";}]; + "${outputs.ws.w8}" = [{app_id = "Element";} {class = "Element";}]; + "${outputs.ws.w9}" = [{app_id = "thunderbird";}]; # Else - "${ws.w2}" = [{class = "steam";} {app_id = "heroic";}]; - "${ws.w2a}" = [{app_id = "looking-glass-client";}]; - "${ws.w4a}" = [{app_id = "com.obsproject.Studio";}]; + "${outputs.ws.w2}" = [{class = "steam";} {app_id = "heroic";}]; + "${outputs.ws.w2a}" = [{app_id = "looking-glass-client";}]; + "${outputs.ws.w4a}" = [{app_id = "com.obsproject.Studio";}]; }; focus.newWindow = "focus"; }; diff --git a/home-manager/sway/sway.nix b/home-manager/sway/sway.nix index a2c4308..5d8d716 100644 --- a/home-manager/sway/sway.nix +++ b/home-manager/sway/sway.nix @@ -1,4 +1,4 @@ -{config, pkgs, ...}: { +{config, pkgs, outputs, ...}: { # Import modules imports = [ #"./swayfx.nix" @@ -17,12 +17,9 @@ package = null; wrapperFeatures.gtk = true; checkConfig = false; - extraConfig = let - border = import ../common/border.nix; - ws = import ./workspaces.nix; - in '' + extraConfig = '' # Options I can't find in Nix yet - default_floating_border pixel ${border.weight} + default_floating_border pixel ${outputs.look.border.string} hide_edge_borders --i3 smart titlebar_padding 10 1 primary_selection disabled @@ -34,8 +31,8 @@ }} # Switch to workspace 1 - workspace ${ws.w7} - workspace ${ws.w1} + workspace ${outputs.ws.w7} + workspace ${outputs.ws.w1} ''; }; } diff --git a/home-manager/sway/swaylock.nix b/home-manager/sway/swaylock.nix index 91eefa5..8a8fb35 100644 --- a/home-manager/sway/swaylock.nix +++ b/home-manager/sway/swaylock.nix @@ -1,16 +1,13 @@ -{config, pkgs, ...}: let - swayLock = let - colors = import ../common/colors.nix; - fonts = import ../common/fonts.nix; - in pkgs.writeScriptBin "swaylock" '' +{config, pkgs, outputs, ...}: let + swayLock = pkgs.writeScriptBin "swaylock" '' # Set the lock script lockscript() { BLANK='#00000000' CLEAR='#FFFFFF22' - DEFAULT='#${colors.prime}FF' + DEFAULT='#${outputs.look.colors.prime}FF' TEXT='#FFFFFFFF' - WRONG='#${colors.split}FF' - VERIFYING='#${colors.accent}FF' + WRONG='#${outputs.look.colors.split}FF' + VERIFYING='#${outputs.look.colors.accent}FF' ${pkgs.swaylock-effects}/bin/swaylock -f -e \ --key-hl-color=$VERIFYING \ @@ -37,7 +34,7 @@ --indicator-radius=80 \ --image=~/.wallpapers/lock.png \ --clock \ - --font=${fonts.main} \ + --font=${outputs.look.fonts.main} \ --font-size=30 \ --timestr="%I:%M%p" \ --datestr="%a %b %d %Y" diff --git a/home-manager/sway/swayshot.nix b/home-manager/sway/swayshot.nix index 1e6c777..f1768f8 100644 --- a/home-manager/sway/swayshot.nix +++ b/home-manager/sway/swayshot.nix @@ -1,10 +1,7 @@ -{pkgs, ...}: { +{pkgs, outputs, ...}: { home.packages = let # Use grim and slurp to take screenshots in multiple ways - swayShot = let - border = import ../common/border.nix; - colors = import ../common/colors.nix; - in pkgs.writeScriptBin "swayshot" '' + swayShot = pkgs.writeScriptBin "swayshot" '' # Swappy handle_swappy() { # Create an imv window to act as a static screen @@ -12,7 +9,7 @@ # Capture the screenshot of the selected area and save to a temporary file selected_area=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"'\ - | XCURSOR_SIZE=40 slurp -w ${border.weight} -c ${colors.prime} -B 00000066 -b 00000099) + | XCURSOR_SIZE=40 slurp -w ${outputs.look.border.string} -c ${outputs.look.colors.prime} -B 00000066 -b 00000099) temp_file=$(mktemp -u).png grim -g "$selected_area" "$temp_file" diff --git a/home-manager/sway/theme.nix b/home-manager/sway/theme.nix index dacbab7..6cf24e4 100644 --- a/home-manager/sway/theme.nix +++ b/home-manager/sway/theme.nix @@ -1,47 +1,44 @@ -{config, pkgs, ...}: { +{config, pkgs, outputs, ...}: { # Enable Sway and write some scripts wayland.windowManager.sway = { enable = true; #package = pkgs.unstable.sway; wrapperFeatures.gtk = true; checkConfig = false; - config = let - colors = import ../common/colors.nix; - fonts = import ../common/fonts.nix; - in { + config = { # Theming settings colors = { focused = { - border = "#${colors.prime}"; - background = "#${colors.prime}"; + border = "#${outputs.look.colors.prime}"; + background = "#${outputs.look.colors.prime}"; text = "#FFFFFF"; - indicator = "#${colors.actSplit}"; - childBorder = "#${colors.prime}"; + indicator = "#${outputs.look.colors.actSplit}"; + childBorder = "#${outputs.look.colors.prime}"; }; focusedInactive = { - border = "#${colors.accent}"; - background = "#${colors.accent}"; - text = "#${colors.text}"; - indicator = "#${colors.split}"; - childBorder = "#${colors.accent}"; + border = "#${outputs.look.colors.accent}"; + background = "#${outputs.look.colors.accent}"; + text = "#${outputs.look.colors.text}"; + indicator = "#${outputs.look.colors.split}"; + childBorder = "#${outputs.look.colors.accent}"; }; unfocused = { - border = "#${colors.dark}"; - background = "#${colors.dark}"; - text = "#${colors.text}"; - indicator = "#${colors.split}"; - childBorder = "#${colors.split}"; + border = "#${outputs.look.colors.dark}"; + background = "#${outputs.look.colors.dark}"; + text = "#${outputs.look.colors.text}"; + indicator = "#${outputs.look.colors.split}"; + childBorder = "#${outputs.look.colors.split}"; }; urgent = { - border = "#${colors.urgent}"; - background = "#${colors.urgent}"; - text = "#${colors.text}"; - indicator = "#${colors.urgent}"; - childBorder = "#${colors.urgent}"; + border = "#${outputs.look.colors.urgent}"; + background = "#${outputs.look.colors.urgent}"; + text = "#${outputs.look.colors.text}"; + indicator = "#${outputs.look.colors.urgent}"; + childBorder = "#${outputs.look.colors.urgent}"; }; }; fonts = { - names = ["${fonts.main}"]; + names = ["${outputs.look.fonts.main}"]; size = 10.5; }; gaps = { diff --git a/home-manager/sway/waybar.nix b/home-manager/sway/waybar.nix index c7ce71f..f4d2bd4 100644 --- a/home-manager/sway/waybar.nix +++ b/home-manager/sway/waybar.nix @@ -1,9 +1,5 @@ -{pkgs, ...}: { +{pkgs, outputs, ...}: { programs.waybar = let - colors = import ../common/colors.nix; - displays = import ../common/displays.nix; - fonts = import ../common/fonts.nix; - swayWorkspacesModule = { format = "{name}"; enable-bar-scroll = true; @@ -265,7 +261,7 @@ name = "bar1"; position = "top"; layer = "bottom"; - output = [displays.d1 "VGA-1"]; + output = [outputs.displays.d1 "VGA-1"]; modules-left = ["sway/workspaces" "sway/window"]; modules-right = [ "pulseaudio" @@ -296,7 +292,7 @@ name = "bar2"; position = "top"; layer = "bottom"; - output = [displays.d2]; + output = [outputs.displays.d2]; modules-left = ["sway/workspaces" "sway/window"]; modules-right = [ "pulseaudio" @@ -321,7 +317,7 @@ name = "bar3"; position = "top"; layer = "bottom"; - output = [displays.d3]; + output = [outputs.displays.d3]; modules-left = ["sway/workspaces" "sway/window"]; modules-right = [ "pulseaudio" @@ -386,12 +382,12 @@ border: 0; border-radius: 0; min-height: 0; - font-family: ${fonts.main}, ${fonts.nerd}; + font-family: ${outputs.look.fonts.main}, ${outputs.look.fonts.nerd}; font-size: 15.5px; - color: #${colors.text}; + color: #${outputs.look.colors.text}; } #waybar { - background: #${colors.dark}; + background: #${outputs.look.colors.dark}; } #workspaces { padding: 0 6px 0 0; @@ -416,15 +412,15 @@ min-width: 20px; } #workspaces button.visible { - border-bottom: 3px solid #${colors.prime}; - background: #${colors.mid}; + border-bottom: 3px solid #${outputs.look.colors.prime}; + background: #${outputs.look.colors.mid}; } #workspaces button.urgent { - border-bottom: 3px solid #${colors.urgent}; + border-bottom: 3px solid #${outputs.look.colors.urgent}; } #workspaces button:hover { box-shadow: none; - background: #${colors.light}; + background: #${outputs.look.colors.light}; } #scratchpad { margin-left: 2px; @@ -460,13 +456,13 @@ color: #888; } #custom-weather { - border-bottom: 3px solid #${colors.prime}; + border-bottom: 3px solid #${outputs.look.colors.prime}; } #custom-weather2 { border-bottom: 3px solid #c75bd3; } #custom-notifs { - border-bottom: 3px solid #${colors.prime}; + border-bottom: 3px solid #${outputs.look.colors.prime}; } #custom-notifs.disabled { color: #888; diff --git a/home-manager/tuiapps/neovim.nix b/home-manager/tuiapps/neovim.nix index 3d74027..efa3d3f 100644 --- a/home-manager/tuiapps/neovim.nix +++ b/home-manager/tuiapps/neovim.nix @@ -1,4 +1,4 @@ -{pkgs, ...}: { +{pkgs, outputs, ...}: { # Install Neovim and plugins programs.neovim = { enable = true; @@ -28,10 +28,7 @@ nvim-colorizer-lua vim-monokai-pro ]; - extraConfig = let - # Import colors - colors = import ../common/colors.nix; - in '' + extraConfig = '' lua <