From 0b699858fc27eb437819b789b292af9a909023cb Mon Sep 17 00:00:00 2001 From: Jimbo Date: Sun, 1 Dec 2024 01:44:12 -0500 Subject: [PATCH] Standardize networking, add more Librewolf configs, standardize synatxing for Waybar, generalize app usage --- flake.lock | 4 +- flake.nix | 8 +- hosts/extern/default.nix | 4 - hosts/extern/hardware/default.nix | 2 +- hosts/extern/modules/default.nix | 5 +- hosts/kitty/firewall/default.nix | 11 +- hosts/tower/disko/default.nix | 2 +- .../home/programs/gui/librewolf/default.nix | 5 + modules/home/programs/misc/chat/default.nix | 3 +- .../home/programs/misc/production/default.nix | 6 +- modules/home/wms/sway/autostart/default.nix | 1 + modules/home/wms/sway/programs/default.nix | 2 - .../wms/sway/programs/swayshot/default.nix | 4 +- modules/home/wms/sway/rules/default.nix | 9 +- modules/home/wms/waybar/default.nix | 133 +++++++----------- .../system/accounts/users/jimbo/default.nix | 4 +- modules/system/devices/networking/default.nix | 1 + 17 files changed, 90 insertions(+), 114 deletions(-) diff --git a/flake.lock b/flake.lock index 5bace6a..2044bfe 100644 --- a/flake.lock +++ b/flake.lock @@ -1,6 +1,6 @@ { "nodes": { - "blender-bin": { + "blender": { "inputs": { "nixpkgs": "nixpkgs" }, @@ -442,7 +442,7 @@ }, "root": { "inputs": { - "blender-bin": "blender-bin", + "blender": "blender", "disko": "disko", "home-manager": "home-manager", "impermanence": "impermanence", diff --git a/flake.nix b/flake.nix index a38f065..b52b6cb 100644 --- a/flake.nix +++ b/flake.nix @@ -25,7 +25,7 @@ }; nur.url = "github:nix-community/NUR"; - blender-bin.url = "https://flakehub.com/f/edolstra/blender-bin/1.0.11.tar.gz"; + blender.url = "https://flakehub.com/f/edolstra/blender-bin/1.0.11.tar.gz"; }; outputs = { @@ -38,7 +38,7 @@ minecraft, home-manager, nur, - blender-bin, + blender, ... }: let @@ -54,7 +54,7 @@ minecraft home-manager nur - blender-bin + blender ; }; }; @@ -64,7 +64,7 @@ inherit unstable nur - blender-bin + blender ; }; }; diff --git a/hosts/extern/default.nix b/hosts/extern/default.nix index 3e489b6..a09fb4b 100644 --- a/hosts/extern/default.nix +++ b/hosts/extern/default.nix @@ -9,12 +9,8 @@ ../../modules/system ]; - system.wireless.enable = false; - system.wireguard.client.enable = true; networking.wireguard.interfaces.wgc.ips = [ "10.100.0.21/24" ]; - boot.binfmt.emulatedSystems = [ "x86_64-linux" ]; - networking.hostName = "extern"; } diff --git a/hosts/extern/hardware/default.nix b/hosts/extern/hardware/default.nix index 6f4ec49..b67f311 100644 --- a/hosts/extern/hardware/default.nix +++ b/hosts/extern/hardware/default.nix @@ -5,6 +5,6 @@ boot.initrd.kernelModules = [ "dm-snapshot" ]; networking.useDHCP = lib.mkDefault true; - nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux"; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; } diff --git a/hosts/extern/modules/default.nix b/hosts/extern/modules/default.nix index a16dc39..468ad95 100644 --- a/hosts/extern/modules/default.nix +++ b/hosts/extern/modules/default.nix @@ -1,4 +1,7 @@ { modulesPath, ... }: { - imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; + imports = [ + (modulesPath + "/profiles/all-hardware.nix") + #(modulesPath + "/profiles/qemu-guest.nix") + ]; } diff --git a/hosts/kitty/firewall/default.nix b/hosts/kitty/firewall/default.nix index d304593..984ab08 100644 --- a/hosts/kitty/firewall/default.nix +++ b/hosts/kitty/firewall/default.nix @@ -1,13 +1,10 @@ { lib, config, ... }: { networking = { - firewall = { - allowPing = false; - extraInputRules = '' - 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" - ''; - }; + firewall.extraInputRules = '' + 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" + ''; # Nftables configuration only if server is enabled nftables.tables.forwarding = { diff --git a/hosts/tower/disko/default.nix b/hosts/tower/disko/default.nix index d021010..ae5244e 100644 --- a/hosts/tower/disko/default.nix +++ b/hosts/tower/disko/default.nix @@ -51,7 +51,7 @@ subvolumes = { "/root" = { mountpoint = "/"; - mountOptions = [ "compress=zstd" "noatime" "ssd" "noexec" ]; + mountOptions = [ "compress=zstd" "noatime" "ssd" ]; }; "/prev" = { mountpoint = "/prev"; diff --git a/modules/home/programs/gui/librewolf/default.nix b/modules/home/programs/gui/librewolf/default.nix index 304e5e3..cc0bb52 100644 --- a/modules/home/programs/gui/librewolf/default.nix +++ b/modules/home/programs/gui/librewolf/default.nix @@ -129,6 +129,10 @@ in { name = "Kernel"; url = "https://www.kernel.org"; } + { + name = "Github"; + url = "https://github.com"; + } ]; commonSettings = { "general.autoScroll" = true; @@ -234,6 +238,7 @@ in { "datareporting.healthreport.uploadEnabled" = false; "svg.context-properties.content.enabled" = true; "services.sync.engine.addresses.available" = false; + "full-screen-api.ignore-widgets" = true; "device.sensors.motion.enabled" = false; "security.OCSP.require" = true; "gnomeTheme.hideSingleTab" = true; diff --git a/modules/home/programs/misc/chat/default.nix b/modules/home/programs/misc/chat/default.nix index ef82d03..654634a 100644 --- a/modules/home/programs/misc/chat/default.nix +++ b/modules/home/programs/misc/chat/default.nix @@ -1,7 +1,8 @@ -{ pkgs, config, ... }: +{ pkgs, ... }: { home.packages = with pkgs; [ vesktop fractal + telegram-desktop ]; } diff --git a/modules/home/programs/misc/production/default.nix b/modules/home/programs/misc/production/default.nix index cebd518..a32fc68 100644 --- a/modules/home/programs/misc/production/default.nix +++ b/modules/home/programs/misc/production/default.nix @@ -1,12 +1,12 @@ -{ pkgs, blender-bin, ... }: +{ pkgs, blender, ... }: { imports = [ ./obs ]; + nixpkgs.overlays = [ blender.overlays.default ]; + home.packages = with pkgs; [ krita audacity blender_4_3 ]; - - nixpkgs.overlays = [ blender-bin.overlays.default ]; } diff --git a/modules/home/wms/sway/autostart/default.nix b/modules/home/wms/sway/autostart/default.nix index b2f7cc2..e9c69d5 100644 --- a/modules/home/wms/sway/autostart/default.nix +++ b/modules/home/wms/sway/autostart/default.nix @@ -26,6 +26,7 @@ { command = "librewolf -P Misc --name=MiscBrowser"; } { command = "vesktop"; } { command = "fractal"; } + { command = "telegram-desktop"; } { command = "thunderbird"; } ]; }; diff --git a/modules/home/wms/sway/programs/default.nix b/modules/home/wms/sway/programs/default.nix index 7c4cc5a..6fa6783 100644 --- a/modules/home/wms/sway/programs/default.nix +++ b/modules/home/wms/sway/programs/default.nix @@ -11,8 +11,6 @@ libnotify grim slurp - swappy - lm_sensors wl-clipboard wdisplays jq diff --git a/modules/home/wms/sway/programs/swayshot/default.nix b/modules/home/wms/sway/programs/swayshot/default.nix index 1eadab2..36e422a 100644 --- a/modules/home/wms/sway/programs/swayshot/default.nix +++ b/modules/home/wms/sway/programs/swayshot/default.nix @@ -2,7 +2,6 @@ { home.packages = with pkgs; [ (pkgs.writeScriptBin "swayshot" '' - # Swappy handle_swappy() { # Create an imv window to act as a static screen grim -t jpeg -q 90 - | imv -w "GlobalShot" - & imv_pid=$! @@ -15,11 +14,10 @@ kill $imv_pid # Copy the screenshot to the clipboard and clear the temp - swappy -f - < "$temp_file" + ${pkgs.swappy}/bin/swappy -f - < "$temp_file" rm "$temp_file" } - # Screen handle_screen() { temp_file=$(mktemp -u).png grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') "$temp_file" diff --git a/modules/home/wms/sway/rules/default.nix b/modules/home/wms/sway/rules/default.nix index 0a6bd94..5f715d3 100644 --- a/modules/home/wms/sway/rules/default.nix +++ b/modules/home/wms/sway/rules/default.nix @@ -109,7 +109,7 @@ ]; }; assigns = { - # Broconfig.wsers + # Browsers "${config.ws.w1}" = [{ app_id = "MainBrowser"; }]; "${config.ws.w1a}" = [{ app_id = "AltBrowser"; }]; @@ -120,13 +120,16 @@ { app_id = "vesktop"; } { class = "vesktop"; } ]; - "${config.ws.w8}" = [{ app_id = "org.gnome.Fractal"; }]; + "${config.ws.w8}" = [ + { app_id = "org.gnome.Fractal"; } + { app_id = "org.telegram.desktop"; } + ]; "${config.ws.w9}" = [{ app_id = "thunderbird"; }]; # Etc "${config.ws.w2}" = [ { class = "steam"; } - {app_id = "heroic";} + { app_id = "heroic"; } ]; "${config.ws.w2a}" = [{ app_id = "looking-glass-client"; }]; "${config.ws.w4a}" = [{ app_id = "com.obsproject.Studio"; }]; diff --git a/modules/home/wms/waybar/default.nix b/modules/home/wms/waybar/default.nix index 0c0cacd..d920a7a 100644 --- a/modules/home/wms/waybar/default.nix +++ b/modules/home/wms/waybar/default.nix @@ -32,7 +32,10 @@ on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; on-click-middle = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 100%"; on-click-right = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 60%"; - ignored-sinks = ["Easy Effects Sink" "USB FS AUDIO Analog Stereo"]; + ignored-sinks = [ + "Easy Effects Sink" + "USB FS AUDIO Analog Stereo" + ]; }; # CPU, Ram and Vram @@ -43,6 +46,7 @@ ramModule = { format = " {used}G"; tooltip = false; + interval = 3; }; vramModule = { exec = pkgs.writeScript "vramScript" '' @@ -56,7 +60,7 @@ elif [ "$gpu_driver" == "amdgpu" ]; then vram_usage_mb=$(echo "$(cat /sys/class/drm/card0/device/mem_info_vram_used || cat /sys/class/drm/card1/device/mem_info_vram_used) / 1024 / 1024" | bc) - temperature=$(sensors | grep 'edge' | awk '{print $2}' | sed 's/[^0-9.-]//g') + temperature=$(${pkgs.lm_sensors}/bin/sensors | grep 'edge' | awk '{print $2}' | sed 's/[^0-9.-]//g') fi # Check if VRAM usage is under 1GB @@ -80,7 +84,6 @@ # Clocks longClockModule = { exec = pkgs.writeScript "longClock" '' - # Long clock format, with a numeric date and military time tooltip time=$(date +'%a %b %d %l:%M:%S%p' | tr -s ' ') date=$(date "+%Y-%m-%d") echo "{\"text\":\" $time\",\"tooltip\":\"$date\"}" @@ -99,9 +102,7 @@ }; # Tray, gamemode, bluetooth, and network tray modules - trayModule = { - spacing = 5; - }; + trayModule.spacing = 5; networkModule = { format-ethernet = "󰈀"; format-wifi = ""; @@ -140,37 +141,11 @@ # Special per-bar modules mediaModule = { - exec-if = "mpc status | grep -q '^\\[playing\\] \\|^\\[paused\\]'"; - exec = pkgs.writeScript "mpvMetadata" '' - get_metadata() { - mpc | head -n 1 - } - - truncate_string() { - local str="$1" - local max_length=30 - if [ $(expr length "$str") -gt $max_length ]; then - str=$(expr substr "$str" 1 $max_length)... - fi - echo "$str" - } - - if mpc status 2>/dev/null | grep -q playing; then - song_name=$(get_metadata | awk -F ' - ' '{print $2}') - if [ -z "$song_name" ]; then - song_name=$(get_metadata) - fi - echo "{\"text\":\"$(truncate_string " $song_name")\",\"tooltip\":\"$(get_metadata)\"}" - elif mpc status 2>/dev/null | grep -q paused; then - artist_name=$(get_metadata | awk -F ' - ' '{print $1}') - if [ -z "$artist_name" ]; then - artist_name=$(get_metadata) - fi - echo "{\"text\":\"$(truncate_string " $artist_name")\",\"tooltip\":\"$(get_metadata)\",\"class\":\"paused\"}" - fi - ''; - format = "{}"; - return-type = "json"; + format = " {title}"; + format-paused = " {artist}"; + format-stopped = ""; + format-disconnected = ""; + tooltip-format = "{artist} - {title}"; interval = 2; max-length = 30; on-click = "mpc toggle"; @@ -196,39 +171,17 @@ on-click = "makotoggle"; }; weatherModule = { - exec = let - weatherConf = pkgs.writeText "weather.jsonc" '' - { - "logo": { - "source": "none" - }, - "modules": [ - { - "type": "weather", - "outputFormat": "%0A%t%0A%C%0A%l" - } - ] - } - ''; - in pkgs.writeScript "weatherScript" '' - # Fetch weather data - fetch=$(fastfetch -c ${weatherConf} | sed 's/[[:space:]]*$//') - temp=$(echo "$fetch" | sed -n '2s/^\+//p') - condition=$(echo "$fetch" | sed -n '3p') - location=$(echo "$fetch" | sed -n '4p') - - # Display weather emoji and temperature - echo {\"text\":\" $temp\",\"tooltip\":\"$location: $condition\"} - ''; - format = "{}"; + exec = "${pkgs.wttrbar}/bin/wttrbar --ampm"; + format = "{}°"; + tooltip = true; return-type = "json"; - interval = 150; + interval = 3600; }; # Laptop modules backlightModule = { format = "{icon} {percent}%"; - format-icons = ["" "󰖨"]; + format-icons = [ "" "󰖨" ]; tooltip = false; }; batteryModule = { @@ -238,7 +191,7 @@ critical = 15; }; format = "{icon} {capacity}%"; - format-icons = ["" "" "" "" ""]; + format-icons = [ "" "" "" "" "" ]; }; in { enable = config.home.desktop.enable; @@ -247,8 +200,14 @@ name = "bar1"; position = "top"; layer = "bottom"; - output = [ config.displays.d1 "VGA-1" ]; - modules-left = ["sway/workspaces" "sway/window"]; + output = [ + config.displays.d1 + "VGA-1" + ]; + modules-left = [ + "sway/workspaces" + "sway/window" + ]; modules-right = [ "pulseaudio" "cpu" @@ -279,10 +238,13 @@ position = "top"; layer = "bottom"; output = [ config.displays.d2 ]; - modules-left = ["sway/workspaces" "sway/window"]; + modules-left = [ + "sway/workspaces" + "sway/window" + ]; modules-right = [ "pulseaudio" - "custom/media" + "mpd" "custom/notifs" "cpu" "memory" @@ -292,7 +254,7 @@ "sway/workspaces" = swayWorkspacesModule; "sway/window" = swayWindowsModule; "pulseaudio" = pulseModule; - "custom/media" = mediaModule; + "mpd" = mediaModule; "custom/notifs" = notificationModule; "cpu" = cpuModule; "memory" = ramModule; @@ -304,7 +266,10 @@ position = "top"; layer = "bottom"; output = [ config.displays.d3 ]; - modules-left = ["sway/workspaces" "sway/window"]; + modules-left = [ + "sway/workspaces" + "sway/window" + ]; modules-right = [ "pulseaudio" "custom/weather" @@ -326,11 +291,19 @@ name = "laptop"; position = "top"; layer = "bottom"; - output = [ "eDP-1" "LVDS-1" "DSI-1" "HDMI-A-1" ]; - modules-left = [ "sway/workspaces" "sway/window" ]; + output = [ + "eDP-1" + "LVDS-1" + "DSI-1" + "HDMI-A-1" + ]; + modules-left = [ + "sway/workspaces" + "sway/window" + ]; modules-right = [ "pulseaudio" - "custom/media" + "mpd" "custom/notifs" "custom/weather2" "cpu" @@ -348,7 +321,7 @@ "sway/workspaces" = swayWorkspacesModule; "sway/window" = swayWindowsModule; "pulseaudio" = pulseModule; - "custom/media" = mediaModule; + "mpd" = mediaModule; "custom/notifs" = notificationModule; "custom/weather2" = weatherModule; "cpu" = cpuModule; @@ -411,7 +384,7 @@ #scratchpad { margin-left: 2px; } - #cpu, #memory, #custom-vram, #custom-media, #custom-clock-long, #custom-clock-short, #backlight, #battery, #custom-weather, #custom-weather2, #custom-notifs { + #cpu, #memory, #custom-vram, #mpd, #custom-clock-long, #custom-clock-short, #backlight, #battery, #custom-weather, #custom-weather2, #custom-notifs { margin: 0 5px 0 2px; } #cpu { @@ -423,9 +396,12 @@ #custom-vram { border-bottom: 3px solid #33FF00; } - #custom-media { + #mpd { border-bottom: 3px solid #ffb066; } + #mpd.paused { + color: #888; + } #custom-clock-long { border-bottom: 3px solid #0a6cf5; } @@ -438,9 +414,6 @@ #battery { border-bottom: 3px solid #fcfc16; } - #custom-media.paused { - color: #888; - } #custom-weather { border-bottom: 3px solid #3823C4; } diff --git a/modules/system/accounts/users/jimbo/default.nix b/modules/system/accounts/users/jimbo/default.nix index 60b2a16..8f9ffe3 100644 --- a/modules/system/accounts/users/jimbo/default.nix +++ b/modules/system/accounts/users/jimbo/default.nix @@ -1,4 +1,4 @@ -{ pkgs, config, unstable, nur, blender-bin, ... }: +{ pkgs, config, unstable, nur, blender, ... }: { users.users = { jimbo = { @@ -45,7 +45,7 @@ inherit unstable nur - blender-bin + blender ; }; users.jimbo = import ../../../../home; diff --git a/modules/system/devices/networking/default.nix b/modules/system/devices/networking/default.nix index aa0bc66..8deebc6 100644 --- a/modules/system/devices/networking/default.nix +++ b/modules/system/devices/networking/default.nix @@ -9,6 +9,7 @@ wireless.enable = false; dhcpcd.enable = true; nftables.enable = true; + firewall.allowPing = false; nameservers = [ "1.1.1.1" "1.1.1.2"