Standardize networking, add more Librewolf configs, standardize synatxing for Waybar, generalize app usage

This commit is contained in:
Jimbo 2024-12-01 01:44:12 -05:00
parent f4acc6c10d
commit 0042da23be
17 changed files with 90 additions and 114 deletions

View file

@ -1,6 +1,6 @@
{ {
"nodes": { "nodes": {
"blender-bin": { "blender": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
@ -442,7 +442,7 @@
}, },
"root": { "root": {
"inputs": { "inputs": {
"blender-bin": "blender-bin", "blender": "blender",
"disko": "disko", "disko": "disko",
"home-manager": "home-manager", "home-manager": "home-manager",
"impermanence": "impermanence", "impermanence": "impermanence",

View file

@ -25,7 +25,7 @@
}; };
nur.url = "github:nix-community/NUR"; 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 = { outputs = {
@ -38,7 +38,7 @@
minecraft, minecraft,
home-manager, home-manager,
nur, nur,
blender-bin, blender,
... ...
}: }:
let let
@ -54,7 +54,7 @@
minecraft minecraft
home-manager home-manager
nur nur
blender-bin blender
; ;
}; };
}; };
@ -64,7 +64,7 @@
inherit inherit
unstable unstable
nur nur
blender-bin blender
; ;
}; };
}; };

View file

@ -9,12 +9,8 @@
../../modules/system ../../modules/system
]; ];
system.wireless.enable = false;
system.wireguard.client.enable = true; system.wireguard.client.enable = true;
networking.wireguard.interfaces.wgc.ips = [ "10.100.0.21/24" ]; networking.wireguard.interfaces.wgc.ips = [ "10.100.0.21/24" ];
boot.binfmt.emulatedSystems = [ "x86_64-linux" ];
networking.hostName = "extern"; networking.hostName = "extern";
} }

View file

@ -5,6 +5,6 @@
boot.initrd.kernelModules = [ "dm-snapshot" ]; boot.initrd.kernelModules = [ "dm-snapshot" ];
networking.useDHCP = lib.mkDefault true; 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; hardware.cpu.amd.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
} }

View file

@ -1,4 +1,7 @@
{ modulesPath, ... }: { modulesPath, ... }:
{ {
imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; imports = [
(modulesPath + "/profiles/all-hardware.nix")
#(modulesPath + "/profiles/qemu-guest.nix")
];
} }

View file

@ -1,13 +1,10 @@
{ lib, config, ... }: { lib, config, ... }:
{ {
networking = { networking = {
firewall = { firewall.extraInputRules = ''
allowPing = false; ip saddr { ${config.ips.localSpan}.0/24, 10.100.0.0/24 } tcp dport 2049 accept comment "Accept NFS"
extraInputRules = '' ip saddr { ${config.ips.pc}, ${config.secrets.lunaIP}, ${config.secrets.cornIP} } tcp dport { 1935, 1945 } accept comment "Accept RTMP"
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 configuration only if server is enabled
nftables.tables.forwarding = { nftables.tables.forwarding = {

View file

@ -51,7 +51,7 @@
subvolumes = { subvolumes = {
"/root" = { "/root" = {
mountpoint = "/"; mountpoint = "/";
mountOptions = [ "compress=zstd" "noatime" "ssd" "noexec" ]; mountOptions = [ "compress=zstd" "noatime" "ssd" ];
}; };
"/prev" = { "/prev" = {
mountpoint = "/prev"; mountpoint = "/prev";

View file

@ -129,6 +129,10 @@ in {
name = "Kernel"; name = "Kernel";
url = "https://www.kernel.org"; url = "https://www.kernel.org";
} }
{
name = "Github";
url = "https://github.com";
}
]; ];
commonSettings = { commonSettings = {
"general.autoScroll" = true; "general.autoScroll" = true;
@ -234,6 +238,7 @@ in {
"datareporting.healthreport.uploadEnabled" = false; "datareporting.healthreport.uploadEnabled" = false;
"svg.context-properties.content.enabled" = true; "svg.context-properties.content.enabled" = true;
"services.sync.engine.addresses.available" = false; "services.sync.engine.addresses.available" = false;
"full-screen-api.ignore-widgets" = true;
"device.sensors.motion.enabled" = false; "device.sensors.motion.enabled" = false;
"security.OCSP.require" = true; "security.OCSP.require" = true;
"gnomeTheme.hideSingleTab" = true; "gnomeTheme.hideSingleTab" = true;

View file

@ -1,7 +1,8 @@
{ pkgs, config, ... }: { pkgs, ... }:
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
vesktop vesktop
fractal fractal
telegram-desktop
]; ];
} }

View file

@ -1,12 +1,12 @@
{ pkgs, blender-bin, ... }: { pkgs, blender, ... }:
{ {
imports = [ ./obs ]; imports = [ ./obs ];
nixpkgs.overlays = [ blender.overlays.default ];
home.packages = with pkgs; [ home.packages = with pkgs; [
krita krita
audacity audacity
blender_4_3 blender_4_3
]; ];
nixpkgs.overlays = [ blender-bin.overlays.default ];
} }

View file

@ -26,6 +26,7 @@
{ command = "librewolf -P Misc --name=MiscBrowser"; } { command = "librewolf -P Misc --name=MiscBrowser"; }
{ command = "vesktop"; } { command = "vesktop"; }
{ command = "fractal"; } { command = "fractal"; }
{ command = "telegram-desktop"; }
{ command = "thunderbird"; } { command = "thunderbird"; }
]; ];
}; };

View file

@ -11,8 +11,6 @@
libnotify libnotify
grim grim
slurp slurp
swappy
lm_sensors
wl-clipboard wl-clipboard
wdisplays wdisplays
jq jq

View file

@ -2,7 +2,6 @@
{ {
home.packages = with pkgs; [ home.packages = with pkgs; [
(pkgs.writeScriptBin "swayshot" '' (pkgs.writeScriptBin "swayshot" ''
# 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
grim -t jpeg -q 90 - | imv -w "GlobalShot" - & imv_pid=$! grim -t jpeg -q 90 - | imv -w "GlobalShot" - & imv_pid=$!
@ -15,11 +14,10 @@
kill $imv_pid kill $imv_pid
# Copy the screenshot to the clipboard and clear the temp # Copy the screenshot to the clipboard and clear the temp
swappy -f - < "$temp_file" ${pkgs.swappy}/bin/swappy -f - < "$temp_file"
rm "$temp_file" rm "$temp_file"
} }
# Screen
handle_screen() { handle_screen() {
temp_file=$(mktemp -u).png temp_file=$(mktemp -u).png
grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') "$temp_file" grim -o $(swaymsg -t get_outputs | jq -r '.[] | select(.focused) | .name') "$temp_file"

View file

@ -109,7 +109,7 @@
]; ];
}; };
assigns = { assigns = {
# Broconfig.wsers # Browsers
"${config.ws.w1}" = [{ app_id = "MainBrowser"; }]; "${config.ws.w1}" = [{ app_id = "MainBrowser"; }];
"${config.ws.w1a}" = [{ app_id = "AltBrowser"; }]; "${config.ws.w1a}" = [{ app_id = "AltBrowser"; }];
@ -120,13 +120,16 @@
{ app_id = "vesktop"; } { app_id = "vesktop"; }
{ class = "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"; }]; "${config.ws.w9}" = [{ app_id = "thunderbird"; }];
# Etc # Etc
"${config.ws.w2}" = [ "${config.ws.w2}" = [
{ class = "steam"; } { class = "steam"; }
{app_id = "heroic";} { app_id = "heroic"; }
]; ];
"${config.ws.w2a}" = [{ app_id = "looking-glass-client"; }]; "${config.ws.w2a}" = [{ app_id = "looking-glass-client"; }];
"${config.ws.w4a}" = [{ app_id = "com.obsproject.Studio"; }]; "${config.ws.w4a}" = [{ app_id = "com.obsproject.Studio"; }];

View file

@ -32,7 +32,10 @@
on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; on-click = "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle";
on-click-middle = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 100%"; on-click-middle = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 100%";
on-click-right = "wpctl set-volume @DEFAULT_AUDIO_SINK@ 60%"; 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 # CPU, Ram and Vram
@ -43,6 +46,7 @@
ramModule = { ramModule = {
format = " {used}G"; format = " {used}G";
tooltip = false; tooltip = false;
interval = 3;
}; };
vramModule = { vramModule = {
exec = pkgs.writeScript "vramScript" '' exec = pkgs.writeScript "vramScript" ''
@ -56,7 +60,7 @@
elif [ "$gpu_driver" == "amdgpu" ]; then 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) 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 fi
# Check if VRAM usage is under 1GB # Check if VRAM usage is under 1GB
@ -80,7 +84,6 @@
# Clocks # Clocks
longClockModule = { longClockModule = {
exec = pkgs.writeScript "longClock" '' 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 ' ') time=$(date +'%a %b %d %l:%M:%S%p' | tr -s ' ')
date=$(date "+%Y-%m-%d") date=$(date "+%Y-%m-%d")
echo "{\"text\":\" $time\",\"tooltip\":\"$date\"}" echo "{\"text\":\" $time\",\"tooltip\":\"$date\"}"
@ -99,9 +102,7 @@
}; };
# Tray, gamemode, bluetooth, and network tray modules # Tray, gamemode, bluetooth, and network tray modules
trayModule = { trayModule.spacing = 5;
spacing = 5;
};
networkModule = { networkModule = {
format-ethernet = "󰈀"; format-ethernet = "󰈀";
format-wifi = ""; format-wifi = "";
@ -140,37 +141,11 @@
# Special per-bar modules # Special per-bar modules
mediaModule = { mediaModule = {
exec-if = "mpc status | grep -q '^\\[playing\\] \\|^\\[paused\\]'"; format = " {title}";
exec = pkgs.writeScript "mpvMetadata" '' format-paused = " {artist}";
get_metadata() { format-stopped = "";
mpc | head -n 1 format-disconnected = "";
} tooltip-format = "{artist} - {title}";
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";
interval = 2; interval = 2;
max-length = 30; max-length = 30;
on-click = "mpc toggle"; on-click = "mpc toggle";
@ -196,39 +171,17 @@
on-click = "makotoggle"; on-click = "makotoggle";
}; };
weatherModule = { weatherModule = {
exec = let exec = "${pkgs.wttrbar}/bin/wttrbar --ampm";
weatherConf = pkgs.writeText "weather.jsonc" '' format = "{}°";
{ tooltip = true;
"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 = "<span font_size='11pt'>{}</span>";
return-type = "json"; return-type = "json";
interval = 150; interval = 3600;
}; };
# Laptop modules # Laptop modules
backlightModule = { backlightModule = {
format = "{icon} {percent}%"; format = "{icon} {percent}%";
format-icons = ["" "󰖨"]; format-icons = [ "" "󰖨" ];
tooltip = false; tooltip = false;
}; };
batteryModule = { batteryModule = {
@ -238,7 +191,7 @@
critical = 15; critical = 15;
}; };
format = "{icon} {capacity}%"; format = "{icon} {capacity}%";
format-icons = ["" "" "" "" ""]; format-icons = [ "" "" "" "" "" ];
}; };
in { in {
enable = config.home.desktop.enable; enable = config.home.desktop.enable;
@ -247,8 +200,14 @@
name = "bar1"; name = "bar1";
position = "top"; position = "top";
layer = "bottom"; layer = "bottom";
output = [ config.displays.d1 "VGA-1" ]; output = [
modules-left = ["sway/workspaces" "sway/window"]; config.displays.d1
"VGA-1"
];
modules-left = [
"sway/workspaces"
"sway/window"
];
modules-right = [ modules-right = [
"pulseaudio" "pulseaudio"
"cpu" "cpu"
@ -279,10 +238,13 @@
position = "top"; position = "top";
layer = "bottom"; layer = "bottom";
output = [ config.displays.d2 ]; output = [ config.displays.d2 ];
modules-left = ["sway/workspaces" "sway/window"]; modules-left = [
"sway/workspaces"
"sway/window"
];
modules-right = [ modules-right = [
"pulseaudio" "pulseaudio"
"custom/media" "mpd"
"custom/notifs" "custom/notifs"
"cpu" "cpu"
"memory" "memory"
@ -292,7 +254,7 @@
"sway/workspaces" = swayWorkspacesModule; "sway/workspaces" = swayWorkspacesModule;
"sway/window" = swayWindowsModule; "sway/window" = swayWindowsModule;
"pulseaudio" = pulseModule; "pulseaudio" = pulseModule;
"custom/media" = mediaModule; "mpd" = mediaModule;
"custom/notifs" = notificationModule; "custom/notifs" = notificationModule;
"cpu" = cpuModule; "cpu" = cpuModule;
"memory" = ramModule; "memory" = ramModule;
@ -304,7 +266,10 @@
position = "top"; position = "top";
layer = "bottom"; layer = "bottom";
output = [ config.displays.d3 ]; output = [ config.displays.d3 ];
modules-left = ["sway/workspaces" "sway/window"]; modules-left = [
"sway/workspaces"
"sway/window"
];
modules-right = [ modules-right = [
"pulseaudio" "pulseaudio"
"custom/weather" "custom/weather"
@ -326,11 +291,19 @@
name = "laptop"; name = "laptop";
position = "top"; position = "top";
layer = "bottom"; layer = "bottom";
output = [ "eDP-1" "LVDS-1" "DSI-1" "HDMI-A-1" ]; output = [
modules-left = [ "sway/workspaces" "sway/window" ]; "eDP-1"
"LVDS-1"
"DSI-1"
"HDMI-A-1"
];
modules-left = [
"sway/workspaces"
"sway/window"
];
modules-right = [ modules-right = [
"pulseaudio" "pulseaudio"
"custom/media" "mpd"
"custom/notifs" "custom/notifs"
"custom/weather2" "custom/weather2"
"cpu" "cpu"
@ -348,7 +321,7 @@
"sway/workspaces" = swayWorkspacesModule; "sway/workspaces" = swayWorkspacesModule;
"sway/window" = swayWindowsModule; "sway/window" = swayWindowsModule;
"pulseaudio" = pulseModule; "pulseaudio" = pulseModule;
"custom/media" = mediaModule; "mpd" = mediaModule;
"custom/notifs" = notificationModule; "custom/notifs" = notificationModule;
"custom/weather2" = weatherModule; "custom/weather2" = weatherModule;
"cpu" = cpuModule; "cpu" = cpuModule;
@ -411,7 +384,7 @@
#scratchpad { #scratchpad {
margin-left: 2px; 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; margin: 0 5px 0 2px;
} }
#cpu { #cpu {
@ -423,9 +396,12 @@
#custom-vram { #custom-vram {
border-bottom: 3px solid #33FF00; border-bottom: 3px solid #33FF00;
} }
#custom-media { #mpd {
border-bottom: 3px solid #ffb066; border-bottom: 3px solid #ffb066;
} }
#mpd.paused {
color: #888;
}
#custom-clock-long { #custom-clock-long {
border-bottom: 3px solid #0a6cf5; border-bottom: 3px solid #0a6cf5;
} }
@ -438,9 +414,6 @@
#battery { #battery {
border-bottom: 3px solid #fcfc16; border-bottom: 3px solid #fcfc16;
} }
#custom-media.paused {
color: #888;
}
#custom-weather { #custom-weather {
border-bottom: 3px solid #3823C4; border-bottom: 3px solid #3823C4;
} }

View file

@ -1,4 +1,4 @@
{ pkgs, config, unstable, nur, blender-bin, ... }: { pkgs, config, unstable, nur, blender, ... }:
{ {
users.users = { users.users = {
jimbo = { jimbo = {
@ -45,7 +45,7 @@
inherit inherit
unstable unstable
nur nur
blender-bin blender
; ;
}; };
users.jimbo = import ../../../../home; users.jimbo = import ../../../../home;

View file

@ -9,6 +9,7 @@
wireless.enable = false; wireless.enable = false;
dhcpcd.enable = true; dhcpcd.enable = true;
nftables.enable = true; nftables.enable = true;
firewall.allowPing = false;
nameservers = [ nameservers = [
"1.1.1.1" "1.1.1.1"
"1.1.1.2" "1.1.1.2"