Simplify the Sway config files

This commit is contained in:
Jimbo 2024-11-07 18:17:51 -05:00
parent 9299782075
commit bbd3d080b5
10 changed files with 436 additions and 443 deletions

View file

@ -24,5 +24,5 @@
];
networking.hostName = "bomberman";
networking.wireguard.interfaces."${config.ips.wgInt}".ips = [ "${config.ips.wgSpan}.19/24" ];
networking.wireguard.interfaces.wgc.ips = [ "10.100.0.19/24" ];
}

View file

@ -1,7 +1,6 @@
{ pkgs, ... }:
{
wayland.windowManager.sway = {
config = {
wayland.windowManager.sway.config = {
bars = [ {command = "waybar";} ];
startup = [
@ -27,5 +26,4 @@
{command = "thunderbird";}
];
};
};
}

View file

@ -1,29 +1,33 @@
{ config, ... }:
{
wayland.windowManager.sway = {
config = {
wayland.windowManager.sway.config = {
# Define monitors
output = {
${config.displays.d1} = {
pos = "1920 405";
pos = "3840 405";
mode = "1920x1080@143.980Hz";
max_render_time = "3";
bg = "~/.assets/wallpapers/1.png fill";
adaptive_sync = "on";
};
${config.displays.d2} = {
pos = "0 405";
pos = "1920 405";
mode = "1920x1080@60Hz";
max_render_time = "3";
bg = "~/.assets/wallpapers/2.png fill";
};
${config.displays.d3} = {
pos = "3840 0";
pos = "5760 0";
mode = "1680x1050@59.883Hz";
transform = "270";
max_render_time = "3";
bg = "~/.assets/wallpapers/3.png fill";
};
${config.displays.d4} = {
pos = "0 405";
mode = "1920x1080@60Hz";
max_render_time = "3";
};
"*" = {
bg = "~/.assets/wallpapers/1.png fill";
};
@ -47,5 +51,4 @@
};
};
};
};
}

View file

@ -1,7 +1,6 @@
{ pkgs, config, ... }:
{
wayland.windowManager.sway = {
config = let
wayland.windowManager.sway.config = let
# Set default modifier and variables
primeMod = "Mod4";
secMod = "Mod1";
@ -224,5 +223,4 @@
"${primeMod}+Shift+Backslash" = ''[app_id="com.github.wwmm.easyeffects"] scratchpad show, move position center, resize set 1000 800'';
};
};
};
}

View file

@ -1,7 +1,6 @@
{ config, ... }:
{
wayland.windowManager.sway = {
config = {
wayland.windowManager.sway.config = {
# Assign workspaces to config
workspaceOutputAssign = let
workspaces1 = [
@ -137,5 +136,4 @@
};
focus.newWindow = "focus";
};
};
}

View file

@ -1,7 +1,6 @@
{ config, ... }:
{
wayland.windowManager.sway = {
config = {
wayland.windowManager.sway.config = {
colors = {
focused = {
border = "#${config.look.colors.prime}";
@ -41,5 +40,4 @@
smartGaps = true;
};
};
};
}

View file

@ -16,10 +16,10 @@
allowPing = false;
extraInputRules = ''
${lib.optionalString (!config.system.firewall.server.enable) ''
ip saddr { ${config.ips.server}, ${config.ips.wgSpan}.1 } accept comment "Accept Server"
ip saddr { ${config.ips.server}, 10.100.0.1 } accept comment "Accept Server"
''}
${lib.optionalString config.system.firewall.server.enable ''
ip saddr { ${config.ips.localSpan}.0/24, ${config.ips.wgSpan}.0/24 } tcp dport 2049 accept comment "Accept NFS"
ip saddr { ${config.ips.localSpan}.0/24, 10.100.0.0/24 } tcp dport 2049 accept comment "Accept NFS"
ip saddr { ${config.ips.pc}, ${config.secrets.lunaIP}, ${config.secrets.cornIP} } tcp dport { 1935, 1945 } accept comment "Accept RTMP"
''}
'';
@ -34,7 +34,7 @@
chain PREROUTING {
type nat hook prerouting priority dstnat; policy accept;
tcp dport 2211 dnat to ${config.ips.pc}:22 comment "SSH to PC"
tcp dport 2222 dnat to ${config.ips.wgSpan}.19:22 comment "SSH to Oracle VM"
tcp dport 2222 dnat to 10.100.0.19:22 comment "SSH to Oracle VM"
udp dport { 27005, 27015, 7777 } dnat to ${config.ips.pc} comment "PC Hosted Games"

View file

@ -24,36 +24,36 @@
nat = {
enable = config.system.wireguard.server.enable;
externalInterface = "${config.ips.netInt}";
internalInterfaces = [ "${config.ips.wgInt}" ];
internalInterfaces = [ "wgs" ];
};
wireguard.interfaces = {
"wgc" = lib.mkIf config.system.wireguard.client.enable {
wgc = lib.mkIf config.system.wireguard.client.enable {
# Define IP of client in per device config
listenPort = 51820;
privateKey = config.secrets.wgClientPriv;
peers = [
{ # NixOS Server
publicKey = "qnOT/lXOJMaQgDUdXpyfGZB2IEyUouRje2m/bCe9ux8=";
allowedIPs = [ "${config.ips.wgSpan}.0/24" ];
allowedIPs = [ "10.100.0.0/24" ];
endpoint = "sv.${config.domains.jim1}:51820";
persistentKeepalive = 25;
}
];
};
"wgs" = lib.mkIf config.system.wireguard.server.enable {
ips = [ "${config.ips.wgSpan}.1/24" ];
wgs = lib.mkIf config.system.wireguard.server.enable {
ips = [ "10.100.0.1/24" ];
listenPort = 51820;
privateKey = config.secrets.wgServerPriv;
peers = [
{ # NixOS
publicKey = "OKUH/h6YSURI4vgeTZKQD15QsqaygdbTn1mAWzQp9S0=";
allowedIPs = [ "${config.ips.wgSpan}.16/28" ];
allowedIPs = [ "10.100.0.16/28" ];
}
{ # Pixel 9
publicKey = "dPCtjm67adMZCnyL1O2L+uUOk0RbjA9T/tht1r+qcE4=";
allowedIPs = [ "${config.ips.wgSpan}.2/32" ];
allowedIPs = [ "10.100.0.2/32" ];
}
];
};

View file

@ -6,9 +6,10 @@
};
config.displays = {
d1 = "DP-3";
d2 = "DP-1";
d3 = "DP-2";
d1 = "DP-2";
d2 = "DP-3";
d3 = "DP-1";
d4 = "HDMI-A-1";
dI = "eDP-1";
};
}

View file

@ -12,8 +12,5 @@
pc = "${localSpan}.3";
vm = "${localSpan}.4";
hx = "${localSpan}.70";
wgInt = "wg0";
wgSpan = "10.100.0";
};
}