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''; d1 = ''DP-3'';
d2 = ''DP-1''; d2 = ''DP-1'';
d3 = ''DP-2''; 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, ...}: { {inputs, ...}: {
# This one brings our custom packages from the 'pkgs' directory # This one brings our custom packages from the 'pkgs' directory
additions = final: _prev: import ./pkgs {pkgs = final;}; additions = final: _prev: import ./pkgs {pkgs = final;};
# This one contains whatever you want to overlay
selfsuper = (self: super: { selfsuper = (self: super: {
mpv = super.mpv.override { mpv = super.mpv.override {
scripts = with self.mpvScripts; [mpris sponsorblock thumbnail]; scripts = with self.mpvScripts; [mpris sponsorblock thumbnail];

View file

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

View file

@ -42,8 +42,13 @@
# Your custom packages and modifications, exported as overlays # Your custom packages and modifications, exported as overlays
overlays = import ./extras/overlays.nix {inherit inputs;}; overlays = import ./extras/overlays.nix {inherit inputs;};
# Secrets defined so they can be accessed globally # Variables defined so they can be accessed globally
secrets = import ./secrets.nix; 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' # NixOS configuration entrypointm use 'nixos-rebuild --flake .#your-hostname'
nixosConfigurations = { 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 # Enable a terminal emulator
programs.foot = { programs.foot = {
enable = true; enable = true;
server.enable = false; server.enable = false;
settings = { settings = {
main = let main = {
fonts = import ../common/fonts.nix;
in {
term = "xterm-256color"; term = "xterm-256color";
font = "${fonts.nerd}:size=14.7"; font = "${outputs.look.fonts.nerd}:size=14.7";
}; };
cursor = { cursor = {
style = "beam"; style = "beam";
}; };
colors = let colors = {
colors = import ../common/colors.nix;
in {
alpha = "0.65"; alpha = "0.65";
background = "${colors.dark}"; background = "${outputs.look.colors.dark}";
regular0 = "3f3f3f"; regular0 = "3f3f3f";
regular1 = "cc0000"; regular1 = "cc0000";
regular2 = "4e9a06"; regular2 = "4e9a06";

View file

@ -1,11 +1,9 @@
{pkgs, ...}: { {pkgs, outputs, ...}: {
# Define GTK theme settings # Define GTK theme settings
gtk = { gtk = {
enable = true; enable = true;
font = let font = {
fonts = import ../common/fonts.nix; name = "${outputs.look.fonts.main}";
in {
name = "${fonts.main}";
size = 11; size = 11;
}; };
theme = { theme = {

View file

@ -1,34 +1,30 @@
{pkgs, config, ...}: let {pkgs, config, outputs, ...}: let
# Import variables
colors = import ../common/colors.nix;
fonts = import ../common/fonts.nix;
# FireFox colors # FireFox colors
themeJim = '' themeJim = ''
:root { :root {
--tab-active-bg-color: #${colors.prime}; --tab-active-bg-color: #${outputs.look.colors.prime};
--tab-hover-bg-color: #${colors.accent}; --tab-hover-bg-color: #${outputs.look.colors.accent};
--tab-inactive-bg-color: #${colors.dark}; --tab-inactive-bg-color: #${outputs.look.colors.dark};
--tab-active-fg-fallback-color: #FFFFFF; --tab-active-fg-fallback-color: #FFFFFF;
--tab-inactive-fg-fallback-color: #${colors.text}; --tab-inactive-fg-fallback-color: #${outputs.look.colors.text};
--urlbar-focused-bg-color: #${colors.dark}; --urlbar-focused-bg-color: #${outputs.look.colors.dark};
--urlbar-not-focused-bg-color: #${colors.dark}; --urlbar-not-focused-bg-color: #${outputs.look.colors.dark};
--toolbar-bgcolor: #${colors.dark} !important; --toolbar-bgcolor: #${outputs.look.colors.dark} !important;
''; '';
themeAlt = '' themeAlt = ''
:root { :root {
--tab-active-bg-color: #${colors.dark}; --tab-active-bg-color: #${outputs.look.colors.dark};
--tab-hover-bg-color: #${colors.accent}; --tab-hover-bg-color: #${outputs.look.colors.accent};
--tab-inactive-bg-color: #${colors.prime}; --tab-inactive-bg-color: #${outputs.look.colors.prime};
--tab-active-fg-fallback-color: #${colors.text}; --tab-active-fg-fallback-color: #${outputs.look.colors.text};
--tab-inactive-fg-fallback-color: #FFFFFF; --tab-inactive-fg-fallback-color: #FFFFFF;
--urlbar-focused-bg-color: #${colors.prime}; --urlbar-focused-bg-color: #${outputs.look.colors.prime};
--urlbar-not-focused-bg-color: #${colors.prime}; --urlbar-not-focused-bg-color: #${outputs.look.colors.prime};
--toolbar-bgcolor: #${colors.prime} !important; --toolbar-bgcolor: #${outputs.look.colors.prime} !important;
''; '';
quteFoxCSS = '' quteFoxCSS = ''
--tab-font: '${fonts.main}'; --tab-font: '${outputs.look.fonts.main}';
--urlbar-font: '${fonts.main}'; --urlbar-font: '${outputs.look.fonts.main}';
/* try increasing if you encounter problems */ /* try increasing if you encounter problems */
--urlbar-height-setting: 24px; --urlbar-height-setting: 24px;
@ -339,9 +335,9 @@ in {
}; };
}; };
commonSettings = { commonSettings = {
"font.name.serif.x-western" = "${fonts.main}"; "font.name.serif.x-western" = "${outputs.look.fonts.main}";
"font.name.sans-serif.x-western" = "${fonts.main}"; "font.name.sans-serif.x-western" = "${outputs.look.fonts.main}";
"font.name.monospace.x-western" = "${fonts.nerd}"; "font.name.monospace.x-western" = "${outputs.look.fonts.nerd}";
"general.autoScroll" = true; "general.autoScroll" = true;
"browser.compactmode.show" = true; "browser.compactmode.show" = true;
"browser.uidensity" = 1; "browser.uidensity" = 1;

View file

@ -1,16 +1,12 @@
{pkgs, config, ...}: { {pkgs, config, outputs, ...}: {
# Enable Rofi # Enable Rofi
programs.rofi = { programs.rofi = {
enable = true; enable = true;
package = pkgs.rofi-wayland; package = pkgs.rofi-wayland;
terminal = "foot"; terminal = "foot";
font = let font = "${outputs.look.fonts.main} 14";
fonts = import ../common/fonts.nix;
in "${fonts.main} 14";
theme = let theme = let
inherit (config.lib.formats.rasi) mkLiteral; inherit (config.lib.formats.rasi) mkLiteral;
border = import ../common/border.nix;
colors = import ../common/colors.nix;
in { in {
"*" = { "*" = {
lightbg = mkLiteral "#EEE8D5"; lightbg = mkLiteral "#EEE8D5";
@ -19,24 +15,24 @@
red = mkLiteral "#DC322F"; red = mkLiteral "#DC322F";
background-color = mkLiteral "#00000000"; background-color = mkLiteral "#00000000";
separatorcolor = mkLiteral "#00000000"; separatorcolor = mkLiteral "#00000000";
normal-foreground = mkLiteral "#${colors.text}"; normal-foreground = mkLiteral "#${outputs.look.colors.text}";
normal-background = mkLiteral "#${colors.dark}1A"; normal-background = mkLiteral "#${outputs.look.colors.dark}1A";
urgent-foreground = mkLiteral "#${colors.urgent}"; urgent-foreground = mkLiteral "#${outputs.look.colors.urgent}";
active-foreground = mkLiteral "#${colors.split}"; active-foreground = mkLiteral "#${outputs.look.colors.split}";
selected-active-foreground = mkLiteral "#${colors.prime}"; selected-active-foreground = mkLiteral "#${outputs.look.colors.prime}";
background = mkLiteral "#${colors.dark}B3"; background = mkLiteral "#${outputs.look.colors.dark}B3";
bordercolor = mkLiteral "#${colors.prime}"; bordercolor = mkLiteral "#${outputs.look.colors.prime}";
selected-normal-foreground = mkLiteral "#FFFFFF"; selected-normal-foreground = mkLiteral "#FFFFFF";
selected-normal-background = mkLiteral "#${colors.prime}80"; selected-normal-background = mkLiteral "#${outputs.look.colors.prime}80";
border-color = mkLiteral "#${colors.prime}"; border-color = mkLiteral "#${outputs.look.colors.prime}";
urgent-background = mkLiteral "#${colors.accent}26"; urgent-background = mkLiteral "#${outputs.look.colors.accent}26";
active-background = mkLiteral "#${colors.accent}26"; active-background = mkLiteral "#${outputs.look.colors.accent}26";
selected-active-background = mkLiteral "#${colors.split}54"; selected-active-background = mkLiteral "#${outputs.look.colors.split}54";
}; };
"#window" = { "#window" = {
background-color = mkLiteral "@background"; background-color = mkLiteral "@background";
width = 500; width = 500;
border = mkLiteral "${border.weight}"; border = mkLiteral "${outputs.look.border.string}";
padding = 5; padding = 5;
}; };
"#message" = { "#message" = {
@ -161,13 +157,13 @@
case $RET in case $RET in
Default) swaymsg reload ;; Default) swaymsg reload ;;
Wide) swaymsg " Wide) swaymsg "
output ${displays.d1} enable pos 1680 0 mode 1680x1050@59.954Hz output ${outputs.displays.d1} enable pos 1680 0 mode 1680x1050@59.954Hz
output ${displays.d2} enable pos 0 0 mode 1680x1050@59.954Hz output ${outputs.displays.d2} enable pos 0 0 mode 1680x1050@59.954Hz
output ${displays.d3} enable pos 3360 0 transform 0 output ${outputs.displays.d3} enable pos 3360 0 transform 0
";; ";;
GPU2) swaymsg " GPU2) swaymsg "
output ${displays.d2} enable pos 1680 0 mode 1920x1080@60Hz output ${outputs.displays.d2} enable pos 1680 0 mode 1920x1080@60Hz
output ${displays.d3} enable pos 0 0 transform 0 output ${outputs.displays.d3} enable pos 0 0 transform 0
";; ";;
esac esac
} }

View file

@ -20,7 +20,6 @@
outputs.overlays.additions outputs.overlays.additions
outputs.overlays.selfsuper outputs.overlays.selfsuper
outputs.overlays.finalprev outputs.overlays.finalprev
outputs.overlays.unstable-packages
inputs.blender-bin.overlays.default inputs.blender-bin.overlays.default
]; ];
# Configure your nixpkgs instance # Configure your nixpkgs instance

View file

@ -5,9 +5,6 @@
./users/jimbo.nix ./users/jimbo.nix
]; ];
# Manually set the locale because it can fail otherwise
home.sessionVariables.LANG = "C.UTF-8";
# Rebuild this entire system # Rebuild this entire system
programs.zsh = { programs.zsh = {
shellAliases = let shellAliases = let

View file

@ -1,23 +1,18 @@
{pkgs, ...}: { {pkgs, outputs, ...}: {
# Notification daemon # Notification daemon
services.mako = let services.mako = {
colors = import ../common/colors.nix;
border = import ../common/border.nix;
displays = import ../common/displays.nix;
fonts = import ../common/fonts.nix;
in {
enable = true; enable = true;
borderColor = "#${colors.accent}"; borderColor = "#${outputs.look.colors.accent}";
backgroundColor = "#${colors.dark}CC"; backgroundColor = "#${outputs.look.colors.dark}CC";
output = "${displays.d1}"; output = "${outputs.displays.d1}";
sort = "+time"; sort = "+time";
layer = "overlay"; layer = "overlay";
padding = "8"; padding = "8";
margin = "0"; margin = "0";
borderSize = border.weightInt; borderSize = outputs.look.border.int;
maxIconSize = 40; maxIconSize = 40;
defaultTimeout = 6000; defaultTimeout = 6000;
font = "${fonts.main} 12"; font = "${outputs.look.fonts.main} 12";
anchor = "bottom-right"; anchor = "bottom-right";
extraConfig = "on-button-right=dismiss-all\nouter-margin=10\n[mode=do-not-disturb]\ninvisible=1"; extraConfig = "on-button-right=dismiss-all\nouter-margin=10\n[mode=do-not-disturb]\ninvisible=1";
}; };

View file

@ -1,12 +1,9 @@
{config, pkgs, ...}: { {config, pkgs, outputs, ...}: {
# Enable Sway and write some scripts
wayland.windowManager.sway = { wayland.windowManager.sway = {
config = let config = {
displays = import ../common/displays.nix; # Define monitors
in {
# Define hardware
output = { output = {
${displays.d1} = { ${outputs.displays.d1} = {
pos = "1920 405"; pos = "1920 405";
mode = "1920x1080@143.980Hz"; mode = "1920x1080@143.980Hz";
max_render_time = "3"; max_render_time = "3";
@ -14,28 +11,25 @@
scale = "1"; scale = "1";
adaptive_sync = "on"; adaptive_sync = "on";
}; };
${displays.d2} = { ${outputs.displays.d2} = {
pos = "0 405"; pos = "0 405";
mode = "1920x1080@60Hz"; mode = "1920x1080@60Hz";
max_render_time = "3"; max_render_time = "3";
bg = "~/.wallpapers/2.png fill"; bg = "~/.wallpapers/2.png fill";
}; };
${displays.d3} = { ${outputs.displays.d3} = {
pos = "3840 0"; pos = "3840 0";
mode = "1680x1050@59.883Hz"; mode = "1680x1050@59.883Hz";
transform = "270"; transform = "270";
max_render_time = "3"; max_render_time = "3";
bg = "~/.wallpapers/3.png fill"; bg = "~/.wallpapers/3.png fill";
}; };
${displays.dTouch} = {
#scale = "1.4";
};
"*" = { "*" = {
bg = "~/.wallpapers/1.png fill"; bg = "~/.wallpapers/1.png fill";
}; };
}; };
# Mouse sensitivity, disable acceleration, allow touch while typing # HID device config
input = { input = {
"9610:4103:SINOWEALTH_Game_Mouse" = { "9610:4103:SINOWEALTH_Game_Mouse" = {
pointer_accel = "-0.9"; pointer_accel = "-0.9";
@ -51,11 +45,6 @@
dwt = "disabled"; dwt = "disabled";
natural_scroll = "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 = { wayland.windowManager.sway = {
config = let config = let
border = import ../common/border.nix;
colors = import ../common/colors.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 # Set default modifier and variables
primeMod = "Mod4"; primeMod = "Mod4";
secMod = "Mod1"; secMod = "Mod1";
@ -21,9 +16,9 @@
# Get the current border style of the focused window # Get the current border style of the focused window
current_style=$(swaymsg -t get_tree | jq -r '.. | select(.focused?).border') 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 if [ "$current_style" == "none" ]; then
swaymsg "sticky disable, border pixel ${border.weight}" swaymsg "sticky disable, border pixel ${outputs.look.border.string}"
else else
swaymsg "sticky enable, border none" swaymsg "sticky enable, border none"
fi fi
@ -33,7 +28,7 @@
swayTools = pkgs.writeScript "swaytools" '' swayTools = pkgs.writeScript "swaytools" ''
# List the app name and whether or not it uses wayland # List the app name and whether or not it uses wayland
swayprop() { 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 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') 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')) 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 # Kill a selected window
swaykill() { 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 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') 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" kill -9 "$pid"
@ -83,7 +78,7 @@
"${primeMod}+${secMod}+Ctrl+r" = ''exec rofiscripts --resolutions''; "${primeMod}+${secMod}+Ctrl+r" = ''exec rofiscripts --resolutions'';
# Open NixOS configuration files # 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 # Terminal, rofi, clipmenu, media script, power menu, show/hide waybar
"${primeMod}+Return" = ''exec foot''; "${primeMod}+Return" = ''exec foot'';
@ -164,50 +159,50 @@
"${primeMod}+Shift+r" = ''reload''; "${primeMod}+Shift+r" = ''reload'';
# Switch to workspaces # Switch to workspaces
"${primeMod}+grave" = ''workspace ${ws.w0}''; "${primeMod}+grave" = ''workspace ${outputs.ws.w0}'';
"${primeMod}+1" = ''workspace ${ws.w1}''; "${primeMod}+1" = ''workspace ${outputs.ws.w1}'';
"${primeMod}+2" = ''workspace ${ws.w2}''; "${primeMod}+2" = ''workspace ${outputs.ws.w2}'';
"${primeMod}+3" = ''workspace ${ws.w3}''; "${primeMod}+3" = ''workspace ${outputs.ws.w3}'';
"${primeMod}+4" = ''workspace ${ws.w4}''; "${primeMod}+4" = ''workspace ${outputs.ws.w4}'';
"${primeMod}+5" = ''workspace ${ws.w5}''; "${primeMod}+5" = ''workspace ${outputs.ws.w5}'';
"${primeMod}+6" = ''workspace ${ws.w6}''; "${primeMod}+6" = ''workspace ${outputs.ws.w6}'';
"${primeMod}+7" = ''workspace ${ws.w7}''; "${primeMod}+7" = ''workspace ${outputs.ws.w7}'';
"${primeMod}+8" = ''workspace ${ws.w8}''; "${primeMod}+8" = ''workspace ${outputs.ws.w8}'';
"${primeMod}+9" = ''workspace ${ws.w9}''; "${primeMod}+9" = ''workspace ${outputs.ws.w9}'';
# Switch to alternate workspaces # Switch to alternate workspaces
"${secMod}+F1" = ''workspace ${ws.w1a}''; "${secMod}+F1" = ''workspace ${outputs.ws.w1a}'';
"${secMod}+F2" = ''workspace ${ws.w2a}''; "${secMod}+F2" = ''workspace ${outputs.ws.w2a}'';
"${secMod}+F3" = ''workspace ${ws.w3a}''; "${secMod}+F3" = ''workspace ${outputs.ws.w3a}'';
"${secMod}+F4" = ''workspace ${ws.w4a}''; "${secMod}+F4" = ''workspace ${outputs.ws.w4a}'';
"${secMod}+F5" = ''workspace ${ws.w5a}''; "${secMod}+F5" = ''workspace ${outputs.ws.w5a}'';
"${secMod}+F6" = ''workspace ${ws.w6a}''; "${secMod}+F6" = ''workspace ${outputs.ws.w6a}'';
"${secMod}+F7" = ''workspace ${ws.w7a}''; "${secMod}+F7" = ''workspace ${outputs.ws.w7a}'';
"${secMod}+F8" = ''workspace ${ws.w8a}''; "${secMod}+F8" = ''workspace ${outputs.ws.w8a}'';
"${secMod}+F9" = ''workspace ${ws.w9a}''; "${secMod}+F9" = ''workspace ${outputs.ws.w9a}'';
# Move window to and focus new workspace # Move window to and focus new workspace
"${primeMod}+Shift+grave" = ''move container to workspace ${ws.w0}; workspace ${ws.w0}''; "${primeMod}+Shift+grave" = ''move container to workspace ${outputs.ws.w0}; workspace ${outputs.ws.w0}'';
"${primeMod}+Shift+1" = ''move container to workspace ${ws.w1}; workspace ${ws.w1}''; "${primeMod}+Shift+1" = ''move container to workspace ${outputs.ws.w1}; workspace ${outputs.ws.w1}'';
"${primeMod}+Shift+2" = ''move container to workspace ${ws.w2}; workspace ${ws.w2}''; "${primeMod}+Shift+2" = ''move container to workspace ${outputs.ws.w2}; workspace ${outputs.ws.w2}'';
"${primeMod}+Shift+3" = ''move container to workspace ${ws.w3}; workspace ${ws.w3}''; "${primeMod}+Shift+3" = ''move container to workspace ${outputs.ws.w3}; workspace ${outputs.ws.w3}'';
"${primeMod}+Shift+4" = ''move container to workspace ${ws.w4}; workspace ${ws.w4}''; "${primeMod}+Shift+4" = ''move container to workspace ${outputs.ws.w4}; workspace ${outputs.ws.w4}'';
"${primeMod}+Shift+5" = ''move container to workspace ${ws.w5}; workspace ${ws.w5}''; "${primeMod}+Shift+5" = ''move container to workspace ${outputs.ws.w5}; workspace ${outputs.ws.w5}'';
"${primeMod}+Shift+6" = ''move container to workspace ${ws.w6}; workspace ${ws.w6}''; "${primeMod}+Shift+6" = ''move container to workspace ${outputs.ws.w6}; workspace ${outputs.ws.w6}'';
"${primeMod}+Shift+7" = ''move container to workspace ${ws.w7}; workspace ${ws.w7}''; "${primeMod}+Shift+7" = ''move container to workspace ${outputs.ws.w7}; workspace ${outputs.ws.w7}'';
"${primeMod}+Shift+8" = ''move container to workspace ${ws.w8}; workspace ${ws.w8}''; "${primeMod}+Shift+8" = ''move container to workspace ${outputs.ws.w8}; workspace ${outputs.ws.w8}'';
"${primeMod}+Shift+9" = ''move container to workspace ${ws.w9}; workspace ${ws.w9}''; "${primeMod}+Shift+9" = ''move container to workspace ${outputs.ws.w9}; workspace ${outputs.ws.w9}'';
# Move window to and focus new alternate workspace # Move window to and focus new alternate workspace
"${secMod}+Shift+F1" = ''move container to workspace ${ws.w1a}; workspace ${ws.w1a}''; "${secMod}+Shift+F1" = ''move container to workspace ${outputs.ws.w1a}; workspace ${outputs.ws.w1a}'';
"${secMod}+Shift+F2" = ''move container to workspace ${ws.w2a}; workspace ${ws.w2a}''; "${secMod}+Shift+F2" = ''move container to workspace ${outputs.ws.w2a}; workspace ${outputs.ws.w2a}'';
"${secMod}+Shift+F3" = ''move container to workspace ${ws.w3a}; workspace ${ws.w3a}''; "${secMod}+Shift+F3" = ''move container to workspace ${outputs.ws.w3a}; workspace ${outputs.ws.w3a}'';
"${secMod}+Shift+F4" = ''move container to workspace ${ws.w4a}; workspace ${ws.w4a}''; "${secMod}+Shift+F4" = ''move container to workspace ${outputs.ws.w4a}; workspace ${outputs.ws.w4a}'';
"${secMod}+Shift+F5" = ''move container to workspace ${ws.w5a}; workspace ${ws.w5a}''; "${secMod}+Shift+F5" = ''move container to workspace ${outputs.ws.w5a}; workspace ${outputs.ws.w5a}'';
"${secMod}+Shift+F6" = ''move container to workspace ${ws.w6a}; workspace ${ws.w6a}''; "${secMod}+Shift+F6" = ''move container to workspace ${outputs.ws.w6a}; workspace ${outputs.ws.w6a}'';
"${secMod}+Shift+F7" = ''move container to workspace ${ws.w7a}; workspace ${ws.w7a}''; "${secMod}+Shift+F7" = ''move container to workspace ${outputs.ws.w7a}; workspace ${outputs.ws.w7a}'';
"${secMod}+Shift+F8" = ''move container to workspace ${ws.w8a}; workspace ${ws.w8a}''; "${secMod}+Shift+F8" = ''move container to workspace ${outputs.ws.w8a}; workspace ${outputs.ws.w8a}'';
"${secMod}+Shift+F9" = ''move container to workspace ${ws.w9a}; workspace ${ws.w9a}''; "${secMod}+Shift+F9" = ''move container to workspace ${outputs.ws.w9a}; workspace ${outputs.ws.w9a}'';
# Change focus across windows # Change focus across windows
"${primeMod}+Up" = ''focus up''; "${primeMod}+Up" = ''focus up'';
@ -216,9 +211,9 @@
"${primeMod}+Right" = ''focus right''; "${primeMod}+Right" = ''focus right'';
# Switch focus across outputs # Switch focus across outputs
"${primeMod}+j" = ''focus output ${displays.d2}''; "${primeMod}+j" = ''focus output ${outputs.displays.d2}'';
"${primeMod}+k" = ''focus output ${displays.d1}''; "${primeMod}+k" = ''focus output ${outputs.displays.d1}'';
"${primeMod}+l" = ''focus output ${displays.d3}''; "${primeMod}+l" = ''focus output ${outputs.displays.d3}'';
# Move focused window # Move focused window
"${primeMod}+Shift+Up" = ''move up ${resizeAmount} px''; "${primeMod}+Shift+Up" = ''move up ${resizeAmount} px'';
@ -227,9 +222,9 @@
"${primeMod}+Shift+Right" = ''move right ${resizeAmount} px''; "${primeMod}+Shift+Right" = ''move right ${resizeAmount} px'';
# Move window across outputs # Move window across outputs
"${primeMod}+Shift+j" = ''move output ${displays.d2}; focus output ${displays.d2}''; "${primeMod}+Shift+j" = ''move output ${outputs.displays.d2}; focus output ${outputs.displays.d2}'';
"${primeMod}+Shift+k" = ''move output ${displays.d1}; focus output ${displays.d1}''; "${primeMod}+Shift+k" = ''move output ${outputs.displays.d1}; focus output ${outputs.displays.d1}'';
"${primeMod}+Shift+l" = ''move output ${displays.d3}; focus output ${displays.d3}''; "${primeMod}+Shift+l" = ''move output ${outputs.displays.d3}; focus output ${outputs.displays.d3}'';
# Change focus between floating/tiled, toggle floating # Change focus between floating/tiled, toggle floating
"${primeMod}+space" = ''focus mode_toggle''; "${primeMod}+space" = ''focus mode_toggle'';

View file

@ -1,16 +1,34 @@
{config, pkgs, ...}: { {config, pkgs, outputs, ...}: {
# Enable Sway and write some scripts # Enable Sway and write some scripts
wayland.windowManager.sway = { wayland.windowManager.sway = {
config = let config = {
border = import ../common/border.nix;
displays = import ../common/displays.nix;
ws = import ./workspaces.nix;
in {
# Assign workspaces to outputs # Assign workspaces to outputs
workspaceOutputAssign = let workspaceOutputAssign = let
workspaces1 = ["${ws.w0}" "${ws.w1}" "${ws.w2}" "${ws.w3}" "${ws.w1a}" "${ws.w2a}" "${ws.w3a}"]; workspaces1 = [
workspaces2 = ["${ws.w4}" "${ws.w5}" "${ws.w6}" "${ws.w4a}" "${ws.w5a}" "${ws.w6a}"]; "${outputs.ws.w0}"
workspaces3 = ["${ws.w7}" "${ws.w8}" "${ws.w9}" "${ws.w7a}" "${ws.w8a}" "${ws.w9a}"]; "${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: assign = output: workspaces:
map (workspace: { map (workspace: {
inherit workspace; inherit workspace;
@ -18,11 +36,13 @@
}) })
workspaces; workspaces;
in 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 # Rules
window = { window = {
border = border.weightInt; border = outputs.look.border.int;
titlebar = false; titlebar = false;
commands = [ commands = [
# Scratchpads # Scratchpads
@ -56,7 +76,7 @@
# Give apps that don't have them borders # Give apps that don't have them borders
{ {
criteria = {con_mark = "borderless";}; criteria = {con_mark = "borderless";};
command = ''border pixel ${border.weight}''; command = ''border pixel ${outputs.look.border.string}'';
} }
{ {
criteria = {app_id = "com.github.wwmm.easyeffects";}; criteria = {app_id = "com.github.wwmm.easyeffects";};
@ -91,20 +111,20 @@
]; ];
}; };
assigns = { assigns = {
# Browsers # Brooutputs.wsers
"${ws.w1}" = [{app_id = "JimBrowser";}]; "${outputs.ws.w1}" = [{app_id = "JimBrooutputs.wser";}];
"${ws.w1a}" = [{app_id = "AltBrowser";}]; "${outputs.ws.w1a}" = [{app_id = "AltBrooutputs.wser";}];
# Communication # Communication
"${ws.w3a}" = [{class = "zoom";}]; "${outputs.ws.w3a}" = [{class = "zoom";}];
"${ws.w7}" = [{app_id = "MiscBrowser";} {app_id = "vesktop";} {class = "vesktop";}]; "${outputs.ws.w7}" = [{app_id = "MiscBrooutputs.wser";} {app_id = "vesktop";} {class = "vesktop";}];
"${ws.w8}" = [{app_id = "Element";} {class = "Element";}]; "${outputs.ws.w8}" = [{app_id = "Element";} {class = "Element";}];
"${ws.w9}" = [{app_id = "thunderbird";}]; "${outputs.ws.w9}" = [{app_id = "thunderbird";}];
# Else # Else
"${ws.w2}" = [{class = "steam";} {app_id = "heroic";}]; "${outputs.ws.w2}" = [{class = "steam";} {app_id = "heroic";}];
"${ws.w2a}" = [{app_id = "looking-glass-client";}]; "${outputs.ws.w2a}" = [{app_id = "looking-glass-client";}];
"${ws.w4a}" = [{app_id = "com.obsproject.Studio";}]; "${outputs.ws.w4a}" = [{app_id = "com.obsproject.Studio";}];
}; };
focus.newWindow = "focus"; focus.newWindow = "focus";
}; };

View file

@ -1,4 +1,4 @@
{config, pkgs, ...}: { {config, pkgs, outputs, ...}: {
# Import modules # Import modules
imports = [ imports = [
#"./swayfx.nix" #"./swayfx.nix"
@ -17,12 +17,9 @@
package = null; package = null;
wrapperFeatures.gtk = true; wrapperFeatures.gtk = true;
checkConfig = false; checkConfig = false;
extraConfig = let extraConfig = ''
border = import ../common/border.nix;
ws = import ./workspaces.nix;
in ''
# Options I can't find in Nix yet # 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 hide_edge_borders --i3 smart
titlebar_padding 10 1 titlebar_padding 10 1
primary_selection disabled primary_selection disabled
@ -34,8 +31,8 @@
}} }}
# Switch to workspace 1 # Switch to workspace 1
workspace ${ws.w7} workspace ${outputs.ws.w7}
workspace ${ws.w1} workspace ${outputs.ws.w1}
''; '';
}; };
} }

View file

@ -1,16 +1,13 @@
{config, pkgs, ...}: let {config, pkgs, outputs, ...}: let
swayLock = let swayLock = pkgs.writeScriptBin "swaylock" ''
colors = import ../common/colors.nix;
fonts = import ../common/fonts.nix;
in pkgs.writeScriptBin "swaylock" ''
# Set the lock script # Set the lock script
lockscript() { lockscript() {
BLANK='#00000000' BLANK='#00000000'
CLEAR='#FFFFFF22' CLEAR='#FFFFFF22'
DEFAULT='#${colors.prime}FF' DEFAULT='#${outputs.look.colors.prime}FF'
TEXT='#FFFFFFFF' TEXT='#FFFFFFFF'
WRONG='#${colors.split}FF' WRONG='#${outputs.look.colors.split}FF'
VERIFYING='#${colors.accent}FF' VERIFYING='#${outputs.look.colors.accent}FF'
${pkgs.swaylock-effects}/bin/swaylock -f -e \ ${pkgs.swaylock-effects}/bin/swaylock -f -e \
--key-hl-color=$VERIFYING \ --key-hl-color=$VERIFYING \
@ -37,7 +34,7 @@
--indicator-radius=80 \ --indicator-radius=80 \
--image=~/.wallpapers/lock.png \ --image=~/.wallpapers/lock.png \
--clock \ --clock \
--font=${fonts.main} \ --font=${outputs.look.fonts.main} \
--font-size=30 \ --font-size=30 \
--timestr="%I:%M%p" \ --timestr="%I:%M%p" \
--datestr="%a %b %d %Y" --datestr="%a %b %d %Y"

View file

@ -1,10 +1,7 @@
{pkgs, ...}: { {pkgs, outputs, ...}: {
home.packages = let home.packages = let
# Use grim and slurp to take screenshots in multiple ways # Use grim and slurp to take screenshots in multiple ways
swayShot = let swayShot = pkgs.writeScriptBin "swayshot" ''
border = import ../common/border.nix;
colors = import ../common/colors.nix;
in pkgs.writeScriptBin "swayshot" ''
# Swappy # Swappy
handle_swappy() { handle_swappy() {
# Create an imv window to act as a static screen # 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 # 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)"'\ 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 temp_file=$(mktemp -u).png
grim -g "$selected_area" "$temp_file" grim -g "$selected_area" "$temp_file"

View file

@ -1,47 +1,44 @@
{config, pkgs, ...}: { {config, pkgs, outputs, ...}: {
# Enable Sway and write some scripts # Enable Sway and write some scripts
wayland.windowManager.sway = { wayland.windowManager.sway = {
enable = true; enable = true;
#package = pkgs.unstable.sway; #package = pkgs.unstable.sway;
wrapperFeatures.gtk = true; wrapperFeatures.gtk = true;
checkConfig = false; checkConfig = false;
config = let config = {
colors = import ../common/colors.nix;
fonts = import ../common/fonts.nix;
in {
# Theming settings # Theming settings
colors = { colors = {
focused = { focused = {
border = "#${colors.prime}"; border = "#${outputs.look.colors.prime}";
background = "#${colors.prime}"; background = "#${outputs.look.colors.prime}";
text = "#FFFFFF"; text = "#FFFFFF";
indicator = "#${colors.actSplit}"; indicator = "#${outputs.look.colors.actSplit}";
childBorder = "#${colors.prime}"; childBorder = "#${outputs.look.colors.prime}";
}; };
focusedInactive = { focusedInactive = {
border = "#${colors.accent}"; border = "#${outputs.look.colors.accent}";
background = "#${colors.accent}"; background = "#${outputs.look.colors.accent}";
text = "#${colors.text}"; text = "#${outputs.look.colors.text}";
indicator = "#${colors.split}"; indicator = "#${outputs.look.colors.split}";
childBorder = "#${colors.accent}"; childBorder = "#${outputs.look.colors.accent}";
}; };
unfocused = { unfocused = {
border = "#${colors.dark}"; border = "#${outputs.look.colors.dark}";
background = "#${colors.dark}"; background = "#${outputs.look.colors.dark}";
text = "#${colors.text}"; text = "#${outputs.look.colors.text}";
indicator = "#${colors.split}"; indicator = "#${outputs.look.colors.split}";
childBorder = "#${colors.split}"; childBorder = "#${outputs.look.colors.split}";
}; };
urgent = { urgent = {
border = "#${colors.urgent}"; border = "#${outputs.look.colors.urgent}";
background = "#${colors.urgent}"; background = "#${outputs.look.colors.urgent}";
text = "#${colors.text}"; text = "#${outputs.look.colors.text}";
indicator = "#${colors.urgent}"; indicator = "#${outputs.look.colors.urgent}";
childBorder = "#${colors.urgent}"; childBorder = "#${outputs.look.colors.urgent}";
}; };
}; };
fonts = { fonts = {
names = ["${fonts.main}"]; names = ["${outputs.look.fonts.main}"];
size = 10.5; size = 10.5;
}; };
gaps = { gaps = {

View file

@ -1,9 +1,5 @@
{pkgs, ...}: { {pkgs, outputs, ...}: {
programs.waybar = let programs.waybar = let
colors = import ../common/colors.nix;
displays = import ../common/displays.nix;
fonts = import ../common/fonts.nix;
swayWorkspacesModule = { swayWorkspacesModule = {
format = "{name}"; format = "{name}";
enable-bar-scroll = true; enable-bar-scroll = true;
@ -265,7 +261,7 @@
name = "bar1"; name = "bar1";
position = "top"; position = "top";
layer = "bottom"; layer = "bottom";
output = [displays.d1 "VGA-1"]; output = [outputs.displays.d1 "VGA-1"];
modules-left = ["sway/workspaces" "sway/window"]; modules-left = ["sway/workspaces" "sway/window"];
modules-right = [ modules-right = [
"pulseaudio" "pulseaudio"
@ -296,7 +292,7 @@
name = "bar2"; name = "bar2";
position = "top"; position = "top";
layer = "bottom"; layer = "bottom";
output = [displays.d2]; output = [outputs.displays.d2];
modules-left = ["sway/workspaces" "sway/window"]; modules-left = ["sway/workspaces" "sway/window"];
modules-right = [ modules-right = [
"pulseaudio" "pulseaudio"
@ -321,7 +317,7 @@
name = "bar3"; name = "bar3";
position = "top"; position = "top";
layer = "bottom"; layer = "bottom";
output = [displays.d3]; output = [outputs.displays.d3];
modules-left = ["sway/workspaces" "sway/window"]; modules-left = ["sway/workspaces" "sway/window"];
modules-right = [ modules-right = [
"pulseaudio" "pulseaudio"
@ -386,12 +382,12 @@
border: 0; border: 0;
border-radius: 0; border-radius: 0;
min-height: 0; min-height: 0;
font-family: ${fonts.main}, ${fonts.nerd}; font-family: ${outputs.look.fonts.main}, ${outputs.look.fonts.nerd};
font-size: 15.5px; font-size: 15.5px;
color: #${colors.text}; color: #${outputs.look.colors.text};
} }
#waybar { #waybar {
background: #${colors.dark}; background: #${outputs.look.colors.dark};
} }
#workspaces { #workspaces {
padding: 0 6px 0 0; padding: 0 6px 0 0;
@ -416,15 +412,15 @@
min-width: 20px; min-width: 20px;
} }
#workspaces button.visible { #workspaces button.visible {
border-bottom: 3px solid #${colors.prime}; border-bottom: 3px solid #${outputs.look.colors.prime};
background: #${colors.mid}; background: #${outputs.look.colors.mid};
} }
#workspaces button.urgent { #workspaces button.urgent {
border-bottom: 3px solid #${colors.urgent}; border-bottom: 3px solid #${outputs.look.colors.urgent};
} }
#workspaces button:hover { #workspaces button:hover {
box-shadow: none; box-shadow: none;
background: #${colors.light}; background: #${outputs.look.colors.light};
} }
#scratchpad { #scratchpad {
margin-left: 2px; margin-left: 2px;
@ -460,13 +456,13 @@
color: #888; color: #888;
} }
#custom-weather { #custom-weather {
border-bottom: 3px solid #${colors.prime}; border-bottom: 3px solid #${outputs.look.colors.prime};
} }
#custom-weather2 { #custom-weather2 {
border-bottom: 3px solid #c75bd3; border-bottom: 3px solid #c75bd3;
} }
#custom-notifs { #custom-notifs {
border-bottom: 3px solid #${colors.prime}; border-bottom: 3px solid #${outputs.look.colors.prime};
} }
#custom-notifs.disabled { #custom-notifs.disabled {
color: #888; color: #888;

View file

@ -1,4 +1,4 @@
{pkgs, ...}: { {pkgs, outputs, ...}: {
# Install Neovim and plugins # Install Neovim and plugins
programs.neovim = { programs.neovim = {
enable = true; enable = true;
@ -28,10 +28,7 @@
nvim-colorizer-lua nvim-colorizer-lua
vim-monokai-pro vim-monokai-pro
]; ];
extraConfig = let extraConfig = ''
# Import colors
colors = import ../common/colors.nix;
in ''
lua <<EOF lua <<EOF
-- Set up nvim-cmp -- Set up nvim-cmp
local cmp = require'cmp' local cmp = require'cmp'
@ -81,8 +78,8 @@
let g:airline_theme='onedark' let g:airline_theme='onedark'
let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#enabled = 1
hi Normal guibg=none ctermbg=235 hi Normal guibg=none ctermbg=235
hi Visual guibg=#${colors.mid} ctermbg=238 hi Visual guibg=#${outputs.look.colors.mid} ctermbg=238
hi Pmenu guibg=#${colors.mid} ctermbg=238 hi Pmenu guibg=#${outputs.look.colors.mid} ctermbg=238
hi EndOfBuffer guibg=none ctermbg=235 hi EndOfBuffer guibg=none ctermbg=235
hi LineNr guibg=none ctermbg=none hi LineNr guibg=none ctermbg=none
lua require'colorizer'.setup() lua require'colorizer'.setup()

View file

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

View file

@ -1,13 +1,11 @@
let {outputs, ...}: {
ips = import ../modules/ips.nix;
in {
# Networking settings # Networking settings
networking = { networking = {
# Enable firewall # Enable firewall
firewall = { firewall = {
allowPing = false; allowPing = false;
extraInputRules = '' 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; [ packages = with pkgs; [
liberation_ttf liberation_ttf
twitter-color-emoji twitter-color-emoji
ubuntu_font_family
noto-fonts noto-fonts
sarasa-gothic sarasa-gothic
ubuntu_font_family
(nerdfonts.override {fonts = ["UbuntuMono"];}) (nerdfonts.override {fonts = ["UbuntuMono"];})
]; ];
fontconfig.defaultFonts.emoji = ["Twitter Color Emoji"]; 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 # Set common boot paramaters
commonKernelParams = [ commonKernelParams = [
# Nvidia settings # Nvidia settings
@ -100,7 +100,7 @@ in {
options = ["nosuid" "nodev" "noauto"]; options = ["nosuid" "nodev" "noauto"];
}; };
"/home/jimbo/JimboNFS" = { "/home/jimbo/JimboNFS" = {
device = "server:/export/JimboNFS"; device = "${outputs.ips.server}:/export/JimboNFS";
fsType = "nfs4"; fsType = "nfs4";
options = ["x-systemd.automount" "_netdev" "nofail" "noauto"]; options = ["x-systemd.automount" "_netdev" "nofail" "noauto"];
}; };

View file

@ -1,17 +1,7 @@
{ {
# Networking settings # Networking settings
networking = { networking = {
# Choose networking method
wireless.enable = false; wireless.enable = false;
dhcpcd.enable = true; 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 # Configure firewall
networking = let networking = let
ips = import ../modules/ips.nix;
mailPorts = "{ 25, 143, 465, 587, 993, 4190 }"; mailPorts = "{ 25, 143, 465, 587, 993, 4190 }";
in { in {
firewall = { firewall = {
@ -12,9 +11,9 @@
# Add extra input rules using nftables # Add extra input rules using nftables
extraInputRules = '' extraInputRules = ''
ip saddr { ${ips.localSpan}.0/24, ${ips.wgSpan}.0/24 } tcp dport 2049 accept comment "Accept NFS" ip saddr { ${outputs.ips.localSpan}.0/24, ${outputs.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 { ${outputs.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.wgSpan}.3 tcp dport ${mailPorts} accept comment "Accept mail"
''; '';
}; };
@ -27,27 +26,27 @@
content = '' content = ''
chain PREROUTING { chain PREROUTING {
type nat hook prerouting priority dstnat; policy accept; type nat hook prerouting priority dstnat; policy accept;
tcp dport 2211 dnat to ${ips.pc}:22 comment "SSH to PC" tcp dport 2211 dnat to ${outputs.ips.pc}:22 comment "SSH to PC"
tcp dport 2233 dnat to ${ips.wgSpan}.3:22 comment "SSH to Oracle VM" 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" tcp dport { 58010, 57989, 57984 } dnat to ${outputs.ips.pc} comment "PC Sunshine TCP"
udp dport { 57998, 57999, 58000 } dnat to ${ips.pc} comment "PC Sunshine UDP" 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" tcp dport { 38010, 37989, 37984 } dnat to ${outputs.ips.vm} comment "VM Sunshine TCP"
udp dport { 37998, 37999, 38000 } dnat to ${ips.vm} comment "VM Sunshine UDP" 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} tcp dport { 9943, 9944 } dnat to ${outputs.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} udp dport { 9943, 9944 } dnat to ${outputs.ips.vm} comment "VM ALVR UDP"
} }
chain POSTROUTING { chain POSTROUTING {
type nat hook postrouting priority 100; policy accept; type nat hook postrouting priority 100; policy accept;
oifname "${ips.netInt}" masquerade oifname "${outputs.ips.netInt}" masquerade
iifname "${ips.netInt}" oifname "${ips.wgInt}" masquerade comment "Traffic from public to WireGuard" iifname "${outputs.ips.netInt}" oifname "${outputs.ips.wgInt}" masquerade comment "Traffic from public to WireGuard"
tcp dport ${mailPorts} oifname != "${ips.wgInt}" drop comment "Send mail" tcp dport ${mailPorts} oifname != "${outputs.ips.wgInt}" drop comment "Send mail"
} }
''; '';
}; };