The big variable overhaul

This commit is contained in:
Jimbo 2024-09-23 16:22:01 -04:00
parent 3f0a235dc8
commit 6dab8fc029
36 changed files with 269 additions and 326 deletions

2
.gitattributes vendored
View file

@ -1 +1 @@
secrets.nix filter=git-crypt diff=git-crypt
extras/secrets.nix filter=git-crypt diff=git-crypt

4
extras/cmd.nix Normal file
View file

@ -0,0 +1,4 @@
{
auth = "doas";
nixcfg = "ranger /etc/nixos";
}

View file

@ -1,7 +1,5 @@
{
# Define the primary monitor
d1 = ''DP-3'';
d2 = ''DP-1'';
d3 = ''DP-2'';
dTouch = ''eDP-1'';
}

21
extras/look.nix Normal file
View file

@ -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;
};
}

View file

@ -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];

View file

@ -1,5 +1,4 @@
{
# Define the workspace names
w0 = ''0:0'';
w1 = ''1:1'';
w2 = ''2:2'';

View file

@ -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 = {

View file

@ -1,3 +0,0 @@
{
method = "doas";
}

View file

@ -1,5 +0,0 @@
rec {
# Define miscellaneous window manager properties
weightInt = 3;
weight = toString weightInt;
}

View file

@ -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
}

View file

@ -1,5 +0,0 @@
{
# Set the default fonts
main = ''Ubuntu'';
nerd = ''UbuntuMono Nerd Font'';
}

View file

@ -1,3 +0,0 @@
{
open = "ranger /etc/nixos";
}

View file

@ -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";

View file

@ -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 = {

View file

@ -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;

View file

@ -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
}

View file

@ -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

View file

@ -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

View file

@ -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";
};

View file

@ -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}";
};
};
};
};

View file

@ -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'';

View file

@ -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";
};

View file

@ -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}
'';
};
}

View file

@ -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"

View file

@ -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"

View file

@ -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 = {

View file

@ -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;

View file

@ -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 <<EOF
-- Set up nvim-cmp
local cmp = require'cmp'
@ -81,8 +78,8 @@
let g:airline_theme='onedark'
let g:airline#extensions#tabline#enabled = 1
hi Normal guibg=none ctermbg=235
hi Visual guibg=#${colors.mid} ctermbg=238
hi Pmenu guibg=#${colors.mid} ctermbg=238
hi Visual guibg=#${outputs.look.colors.mid} ctermbg=238
hi Pmenu guibg=#${outputs.look.colors.mid} ctermbg=238
hi EndOfBuffer guibg=none ctermbg=235
hi LineNr guibg=none ctermbg=none
lua require'colorizer'.setup()

View file

@ -1,8 +1,5 @@
{pkgs, config, ...}: {
programs.zsh = let
auth = import ../common/auth.nix;
nixcfg = import ../common/nixcfg.nix;
in {
{pkgs, config, outputs, ...}: {
programs.zsh = {
enable = true;
autosuggestion.enable = true;
syntaxHighlighting.enable = true;
@ -13,14 +10,14 @@
};
shellAliases = {
# NixOS aliases
nixcfg = "${nixcfg.open}";
nixclean = "${auth.method} nix-store --gc; nix-collect-garbage -d";
nixpurge = "${auth.method} nix-collect-garbage --delete-old";
nixoptimize = "${auth.method} nix store optimise";
nixcfg = "${outputs.cmd.nixcfg}";
nixclean = "${outputs.cmd.auth} nix-store --gc; nix-collect-garbage -d";
nixpurge = "${outputs.cmd.auth} nix-collect-garbage --delete-old";
nixoptimize = "${outputs.cmd.auth} nix store optimise";
# Flake commands
flakedate = "${auth.method} nix flake update /etc/nixos";
sysswitch = "${auth.method} nixos-rebuild switch --flake /etc/nixos";
flakedate = "${outputs.cmd.auth} nix flake update /etc/nixos";
sysswitch = "${outputs.cmd.auth} nixos-rebuild switch --flake /etc/nixos";
homeswitch = "home-manager switch --flake /etc/nixos";
nixswitch = "sysswitch; homeswitch";
nixdate = "flakedate && sysswitch; homeswitch";

View file

@ -1,13 +1,11 @@
let
ips = import ../modules/ips.nix;
in {
{outputs, ...}: {
# Networking settings
networking = {
# Enable firewall
firewall = {
allowPing = false;
extraInputRules = ''
ip saddr { ${ips.server}, ${ips.wgSpan}.1 } accept comment "Accept Server"
ip saddr { ${outputs.ips.server}, ${outputs.ips.wgSpan}.1 } accept comment "Accept Server"
'';
};
};

View file

@ -4,9 +4,9 @@
packages = with pkgs; [
liberation_ttf
twitter-color-emoji
ubuntu_font_family
noto-fonts
sarasa-gothic
ubuntu_font_family
(nerdfonts.override {fonts = ["UbuntuMono"];})
];
fontconfig.defaultFonts.emoji = ["Twitter Color Emoji"];

View file

@ -1,4 +1,4 @@
{ config, lib, pkgs, modulesPath, ... }: let
{ config, lib, pkgs, outputs, modulesPath, ... }: let
# Set common boot paramaters
commonKernelParams = [
# Nvidia settings
@ -100,7 +100,7 @@ in {
options = ["nosuid" "nodev" "noauto"];
};
"/home/jimbo/JimboNFS" = {
device = "server:/export/JimboNFS";
device = "${outputs.ips.server}:/export/JimboNFS";
fsType = "nfs4";
options = ["x-systemd.automount" "_netdev" "nofail" "noauto"];
};

View file

@ -1,17 +1,7 @@
{
# Networking settings
networking = {
# Choose networking method
wireless.enable = false;
dhcpcd.enable = true;
# Set hostnames
hosts = let
ips = import ../modules/ips.nix;
in {
"${ips.server}" = ["server"];
"${ips.pc}" = ["pc"];
"${ips.vm}" = ["vm"];
};
};
}

View file

@ -4,7 +4,6 @@
# Configure firewall
networking = let
ips = import ../modules/ips.nix;
mailPorts = "{ 25, 143, 465, 587, 993, 4190 }";
in {
firewall = {
@ -12,9 +11,9 @@
# Add extra input rules using nftables
extraInputRules = ''
ip saddr { ${ips.localSpan}.0/24, ${ips.wgSpan}.0/24 } tcp dport 2049 accept comment "Accept NFS"
ip saddr { ${ips.pc}, ${outputs.secrets.lunaIP}, ${outputs.secrets.cornIP}, ${outputs.secrets.vertIP} } tcp dport { 1935, 1945 } accept comment "Accept RTMP"
ip saddr ${ips.wgSpan}.3 tcp dport ${mailPorts} accept comment "Accept mail"
ip saddr { ${outputs.ips.localSpan}.0/24, ${outputs.ips.wgSpan}.0/24 } tcp dport 2049 accept comment "Accept NFS"
ip saddr { ${outputs.ips.pc}, ${outputs.secrets.lunaIP}, ${outputs.secrets.cornIP}, ${outputs.secrets.vertIP} } tcp dport { 1935, 1945 } accept comment "Accept RTMP"
ip saddr ${outputs.ips.wgSpan}.3 tcp dport ${mailPorts} accept comment "Accept mail"
'';
};
@ -27,27 +26,27 @@
content = ''
chain PREROUTING {
type nat hook prerouting priority dstnat; policy accept;
tcp dport 2211 dnat to ${ips.pc}:22 comment "SSH to PC"
tcp dport 2233 dnat to ${ips.wgSpan}.3:22 comment "SSH to Oracle VM"
tcp dport 2211 dnat to ${outputs.ips.pc}:22 comment "SSH to PC"
tcp dport 2233 dnat to ${outputs.ips.wgSpan}.3:22 comment "SSH to Oracle VM"
udp dport { 27005, 27015, 7777 } dnat to ${ips.pc} comment "PC Hosted Games"
udp dport { 27005, 27015, 7777 } dnat to ${outputs.ips.pc} comment "PC Hosted Games"
tcp dport { 58010, 57989, 57984 } dnat to ${ips.pc} comment "PC Sunshine TCP"
udp dport { 57998, 57999, 58000 } dnat to ${ips.pc} comment "PC Sunshine UDP"
tcp dport { 58010, 57989, 57984 } dnat to ${outputs.ips.pc} comment "PC Sunshine TCP"
udp dport { 57998, 57999, 58000 } dnat to ${outputs.ips.pc} comment "PC Sunshine UDP"
tcp dport { 38010, 37989, 37984 } dnat to ${ips.vm} comment "VM Sunshine TCP"
udp dport { 37998, 37999, 38000 } dnat to ${ips.vm} comment "VM Sunshine UDP"
tcp dport { 38010, 37989, 37984 } dnat to ${outputs.ips.vm} comment "VM Sunshine TCP"
udp dport { 37998, 37999, 38000 } dnat to ${outputs.ips.vm} comment "VM Sunshine UDP"
udp dport { 7790, 7791, 7792 } dnat to ${ips.hx} comment "Deus Ex"
udp dport { 7790, 7791, 7792 } dnat to ${outputs.ips.hx} comment "Deus Ex"
ip saddr ${outputs.secrets.cornIP} tcp dport { 9943, 9944 } dnat to ${ips.vm} comment "VM ALVR TCP"
ip saddr ${outputs.secrets.cornIP} udp dport { 9943, 9944 } dnat to ${ips.vm} comment "VM ALVR UDP"
ip saddr ${outputs.secrets.cornIP} tcp dport { 9943, 9944 } dnat to ${outputs.ips.vm} comment "VM ALVR TCP"
ip saddr ${outputs.secrets.cornIP} udp dport { 9943, 9944 } dnat to ${outputs.ips.vm} comment "VM ALVR UDP"
}
chain POSTROUTING {
type nat hook postrouting priority 100; policy accept;
oifname "${ips.netInt}" masquerade
iifname "${ips.netInt}" oifname "${ips.wgInt}" masquerade comment "Traffic from public to WireGuard"
tcp dport ${mailPorts} oifname != "${ips.wgInt}" drop comment "Send mail"
oifname "${outputs.ips.netInt}" masquerade
iifname "${outputs.ips.netInt}" oifname "${outputs.ips.wgInt}" masquerade comment "Traffic from public to WireGuard"
tcp dport ${mailPorts} oifname != "${outputs.ips.wgInt}" drop comment "Send mail"
}
'';
};