Move more things to Nixlang, remove bemenu and Pavucontrol

This commit is contained in:
Jimbo 2024-08-18 23:42:20 -04:00
parent 5c1ec4d677
commit bdd47c9572
4 changed files with 280 additions and 517 deletions

View file

@ -1,10 +1,9 @@
{ config, pkgs, options, lib, ... }: { config, pkgs, options, lib, ... }:
let let
# Import home manager, set common boot paramaters # Set common boot paramaters
homeManager = fetchTarball
"https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz";
commonKernelParams = [ commonKernelParams = [
# Nvidia GSP firmware # Nvidia settings
"nvidia_drm.fbdev=1"
"nouveau.config=NvGspRm=1" "nouveau.config=NvGspRm=1"
# VM/GPU passthrough # VM/GPU passthrough
@ -18,12 +17,18 @@ let
# Isolate devices into IOMMU groups # Isolate devices into IOMMU groups
"pcie_acs_override=downstream,multifunction" "pcie_acs_override=downstream,multifunction"
"pci=routeirq" "pci=routeirq"
# Provide less context messages
"quiet"
]; ];
in in
{ {
# Import other nix files and firmware # Import other nix files and firmware
imports = [ imports = let
homeManager = fetchTarball
"https://github.com/nix-community/home-manager/archive/release-24.05.tar.gz";
in [
./hardware-configuration.nix ./hardware-configuration.nix
./jimbo.nix ./jimbo.nix
"${homeManager}/nixos" "${homeManager}/nixos"
@ -34,15 +39,12 @@ in
config = { config = {
allowUnfree = true; allowUnfree = true;
packageOverrides = pkgs: { packageOverrides = pkgs: {
unstable = import (builtins.fetchTarball unstable = import (fetchTarball
"https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz") { "https://github.com/NixOS/nixpkgs/archive/nixos-unstable.tar.gz"
inherit pkgs; ){ inherit pkgs; config.allowUnfree = true; };
config.allowUnfree = true; nur = import (fetchTarball
}; "https://github.com/nix-community/NUR/archive/master.tar.gz"
nur = import (builtins.fetchTarball ){ inherit pkgs; };
"https://github.com/nix-community/NUR/archive/master.tar.gz") {
inherit pkgs;
};
}; };
}; };
@ -105,12 +107,13 @@ in
# Allow binary firmware # Allow binary firmware
hardware.enableRedistributableFirmware = true; hardware.enableRedistributableFirmware = true;
# Enable the Nouveau drivers # Enable video drivers
services.xserver.videoDrivers = [ "nvidia" ]; services.xserver.videoDrivers = [ "nvidia" ];
hardware.nvidia = { hardware.nvidia = {
modesetting.enable = true; modesetting.enable = true;
nvidiaSettings = false; nvidiaSettings = false;
package = config.boot.kernelPackages.nvidiaPackages.beta; package = config.boot.kernelPackages.nvidiaPackages.beta;
open = true;
}; };
# Enable a permissioning system # Enable a permissioning system
@ -154,7 +157,7 @@ in
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
# Installed programs to the system profile. # Install programs system-wide
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
# Essential system tools # Essential system tools
cifs-utils parted git cifs-utils parted git
@ -173,10 +176,9 @@ in
info.enable = false; info.enable = false;
}; };
# Enable OpenGL # Enable graphics
hardware.opengl = { hardware.opengl = {
enable = true; enable = true;
driSupport = true;
driSupport32Bit = true; driSupport32Bit = true;
extraPackages = with pkgs; [ extraPackages = with pkgs; [
vulkan-loader vulkan-loader
@ -298,11 +300,31 @@ in
}; };
}; };
}; };
extraPortals = [ pkgs.xdg-desktop-portal-gtk ]; extraPortals = with pkgs; [ xdg-desktop-portal-gtk ];
}; };
# Configure greetd for remote login # Configure greetd for remote login
services.greetd = { services.greetd = let
startSway = pkgs.writeScript "startsway" ''
# Use NVIDIA variables if drivers are in use
if lspci -k | grep "Kernel driver in use: nvidia" &> /dev/null; then
# NVIDIA/AMD variables
export LIBVA_DRIVER_NAME=nvidia
export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export WLR_NO_HARDWARE_CURSORS=1
else
:
fi
# Sway/Wayland
export XDG_CURRENT_DESKTOP=sway
export QT_QPA_PLATFORM="wayland;xcb"
# Start Sway
sway --unsupported-gpu
'';
in {
enable = true; enable = true;
restart = true; restart = true;
settings = { settings = {
@ -311,7 +333,7 @@ in
switch = true; switch = true;
}; };
default_session = { default_session = {
command = "/home/jimbo/.config/sway/start.sh"; command = "${startSway}";
user = "jimbo"; user = "jimbo";
}; };
}; };
@ -365,7 +387,6 @@ in
PrintLastLog = "no"; PrintLastLog = "no";
PasswordAuthentication = false; PasswordAuthentication = false;
}; };
ports = [ 2211 ];
}; };
# Block SSH connections after numerous attempts # Block SSH connections after numerous attempts

View file

@ -55,7 +55,7 @@
"/home/jimbo/JimboNFS" = { "/home/jimbo/JimboNFS" = {
device = "server:/export/JimboNFS"; device = "server:/export/JimboNFS";
fsType = "nfs4"; fsType = "nfs4";
options = [ "x-systemd.automount" "_netdev" "noauto" ]; options = [ "x-systemd.automount" "_netdev" "nofail" "noauto" ];
}; };
}; };

View file

@ -69,46 +69,6 @@ let
# Terminal authentication # Terminal authentication
auth = ''doas''; auth = ''doas'';
# Set the default terminal emulator
terminal = ''${pkgs.foot}/bin/foot'';
terminalClass = ''${terminal} -a'';
termPreviewMethod = ''sixel'';
# Bemenu color options
bemenuOpts = ''
--fn "${mainFont} 13" \
--tb "#${primeCol}" \
--hb "#${primeCol}" \
--nb "#${darkCol}" \
--ab "#${darkCol}" \
--fb "#${darkCol}" \
--tf "#ffffff" \
--hf "#ffffff" \
--ignorecase \
--hp 8 \
'';
# Sway still needs a start script because the sessionconfig doesn't do anything
swayStart = ''
# Use NVIDIA variables if drivers are in use
if lspci -k | grep "Kernel driver in use: nvidia" &> /dev/null; then
# NVIDIA/AMD variables
export LIBVA_DRIVER_NAME=nvidia
export GBM_BACKEND=nvidia-drm
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export WLR_NO_HARDWARE_CURSORS=1
else
:
fi
# Sway/Wayland
export XDG_CURRENT_DESKTOP=sway
export QT_QPA_PLATFORM="wayland;xcb"
# Start Sway
sway --unsupported-gpu
'';
# Swappy config, for screenshot editing # Swappy config, for screenshot editing
swappyConfig = '' swappyConfig = ''
[Default] [Default]
@ -116,22 +76,22 @@ let
save_dir=$HOME/Pictures/Screenshots save_dir=$HOME/Pictures/Screenshots
''; '';
# All my bemenu scripts in one file # All my rofi scripts in one file
beScripts = pkgs.writeScriptBin "bescripts" '' rofiScripts = pkgs.writeScriptBin "rofiscripts" ''
# Scratchpad function # Scratchpad function
handle_scratchpads() { handle_scratchpads() {
SCRATCHPADS=$(echo -e "Gotop\nMusic\nPavuControl\nEasyEffects" | bemenu ${bemenuOpts} -p "Scratchpads") SCRATCHPADS=$(echo -e "Gotop\nMusic\nAudio\nEasyEffects" | rofi -dmenu -i -p "Scratchpads")
case $SCRATCHPADS in case $SCRATCHPADS in
Gotop) ${terminalClass} gotop -T Gotop gotop;; Gotop) foot -a gotop -T Gotop gotop;;
Music) ${terminalClass} music -T Music ncmpcpp;; Music) foot -a music -T Music ncmpcpp;;
PavuControl) pavucontrol;; Audio) foot -a audio -T Audio ncpamixer;;
EasyEffects) easyeffects;; EasyEffects) easyeffects;;
esac esac
} }
# Lock menu # Lock menu
handle_power() { handle_power() {
POWER=$(echo -e "Shutdown\nReboot\nSleep\nLock\nKill" | bemenu ${bemenuOpts} -p "Power") POWER=$(echo -e "Shutdown\nReboot\nSleep\nLock\nKill" | rofi -dmenu -i -p "Power")
case $POWER in case $POWER in
Shutdown) poweroff;; Shutdown) poweroff;;
Reboot) reboot;; Reboot) reboot;;
@ -143,7 +103,7 @@ let
# Resolutions # Resolutions
handle_resolutions() { handle_resolutions() {
RET=$(echo -e "Default\nWide\nGPU2" | bemenu ${bemenuOpts} -p "Resolutions") RET=$(echo -e "Default\nWide\nGPU2" | rofi -dmenu -i -p "Resolutions")
case $RET in case $RET in
Default) swaymsg reload ;; Default) swaymsg reload ;;
Wide) swaymsg " Wide) swaymsg "
@ -163,8 +123,6 @@ let
handle_scratchpads handle_scratchpads
elif [ "$1" == "--power" ]; then elif [ "$1" == "--power" ]; then
handle_power handle_power
elif [ "$1" == "--media" ]; then
handle_media
elif [ "$1" == "--resolutions" ]; then elif [ "$1" == "--resolutions" ]; then
handle_resolutions handle_resolutions
else else
@ -324,101 +282,6 @@ let
fi fi
''; '';
# Handle all my alarms
alarmScript = let
alarmSound = pkgs.fetchurl {
url = "https://archive.org/download/espionage_202105/Espionage.mp3";
sha256 = "0y5b9ha6jrrar8shvilq1gcmrr37zf53f6zwba5c0m7yplbxnv65";
};
in pkgs.writeScriptBin "alarms" ''
# The alarm script itself
alarm() {
mpv --volume=40 --force-media-title="Alarm" ${alarmSound} &
swaynag \
--message "$name" \
--button "Stop Alarm" alarms \
--font ${mainFont} 12 --background ${darkCol} \
--border ${primeCol} \
--button-border-size ${borderWeight} \
--button-background ${darkCol} \
--border-bottom ${primeCol} \
--text ${textCol} \
--button-text ${textCol}
}
# Handle alarm times
handle_alarms() {
# Make the script loop when ran by Sway
while true; do
# Check the current day and time
current_day=$(date +"%A")
current_time=$(date +'%l:%M%p' | sed 's/^ //')
# Monday alarms
if [ "$current_day" == "Monday" ]; then
if [ "$current_time" == "7:30AM" ]; then
name="SEC 330 Physical"; alarm
fi
fi
# Tuesday alarms
if [ "$current_day" == "Tuesday" ]; then
if [ "$current_time" == "10:30AM" ]; then
name="DAT 330 Physical"; alarm
fi
fi
# Wednesday alarms
if [ "$current_day" == "Wednesday" ]; then
if [ "$current_time" == "6:30AM" ]; then
name="MST 300 Physical"; alarm
fi
fi
# Thursday alarms
if [ "$current_day" == "Thursday" ]; then
:
fi
# Friday alarms
if [ "$current_day" == "Friday" ]; then
if [ "$current_time" == "11:40AM" ]; then
name="DAT 330 Online"; alarm
fi
fi
# Wait a minute between checks
sleep 60
done
}
# Handle the killing of the alarm
kill_alarm() {
pkill -f 'mpv.*${alarmSound}'
pkill swaynag
}
# Check which mode the script is ran in
if [ "$1" == "--alarms" ]; then
handle_alarms
else
kill_alarm
fi
'';
# Check IOMMU Groups
iommuCheck = pkgs.writeScriptBin "lsiommu" ''
#!/usr/bin/env bash
shopt -s nullglob
for g in $(find /sys/kernel/iommu_groups/* -maxdepth 0 -type d | sort -V); do
echo "IOMMU Group ''${g##*/}:"
for d in $g/devices/*; do
echo -e "\t$(lspci -nns ''${d##*/})"
done;
done;
'';
# File manager config # File manager config
pcmanConf = '' pcmanConf = ''
[Behavior] [Behavior]
@ -451,7 +314,7 @@ let
[System] [System]
Archiver=file-roller Archiver=file-roller
Terminal=${terminal} Terminal=foot
[Thumbnail] [Thumbnail]
MaxExternalThumbnailFileSize=-1 MaxExternalThumbnailFileSize=-1
@ -468,38 +331,6 @@ let
TabPaths=@Invalid() TabPaths=@Invalid()
''; '';
# Foot config
footConf = ''
font=${nerdFont}:size=14.7
term=xterm-256color
[cursor]
style=beam
[colors]
alpha=0.65
background=${darkCol}
regular0=3f3f3f
regular1=cc0000
regular2=4e9a06
regular3=c4a000
regular4=94bff3
regular5=85678f
regular6=06989a
regular7=dcdccc
bright0=545454
bright1=fc5454
bright2=8ae234
bright3=fce94f
bright4=94bff3
bright5=b294bb
bright6=93e0e3
bright7=ffffff
[key-bindings]
search-start=Control+f
'';
# An Easyeffects equalizer profile that sounds good to me # An Easyeffects equalizer profile that sounds good to me
easyEffectsProfile = '' easyEffectsProfile = ''
{ {
@ -798,27 +629,6 @@ let
} }
''; '';
# Mangohud acts like rivatuner on Windows, config file
mangoConf = ''
table_columns=2
frametime=0
legacy_layout=0
font_scale=0.80
background_alpha=0.25
# Set the loads and such
exec=echo $(echo $XDG_CURRENT_DESKTOP | sed 's/./\U&/') on $(cat /etc/os-release | grep PRETTY_NAME | cut -d '"' -f 2)
fps
fps_color_change
ram
vram
cpu_stats
cpu_load_change
gpu_stats
gpu_load_change
frame_timing
'';
# Neofetch main config # Neofetch main config
neoConf = '' neoConf = ''
{ {
@ -964,164 +774,6 @@ let
in pkgs.writeScriptBin "pfetch" in pkgs.writeScriptBin "pfetch"
''fastfetch --config ${smallConf}''; ''fastfetch --config ${smallConf}'';
# Ranger (terminal file browser) config
rangerConf = ''
set preview_script ~/.config/ranger/scope.sh
set preview_images true
set preview_images_method ${termPreviewMethod}
set dirname_in_tabs true
set cd_tab_fuzzy true
set autosave_bookmarks false
set show_hidden true
set wrap_scroll true
set column_ratios 2,2,4
set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
default_linemode devicons
'';
# Choose which programs ranger uses
rifleConf = ''
# Websites
ext x?html?, has librewolf, X, flag f = librewolf -- "$@"
# Define the "editor" for text files as first action
mime ^text, label editor = vim -- "$@"
!mime ^text, label editor, ext xml|json|jsonc|m3u|m3u8|csv|tex|py|pl|rb|js|sh|php = vim -- "$@"
# Misc files
ext 1 = man "$1"
ext exe = wine "$1"
ext msi = wine "$1"
name ^[mM]akefile$ = make
# Scripts
ext sh = sh -- "$1"
ext py = python -- "$1"
ext pl = perl -- "$1"
ext rb = ruby -- "$1"
ext js = node -- "$1"
ext php = php -- "$1"
# Audio and video
mime ^audio|ogg$, terminal, has mpv = mpv --no-audio-display -- "$@"
mime ^audio|ogg$, terminal, has mpv = mpv --shuffle --no-audio-display -- "$@"
mime ^video, terminal, has mpv = mpv -- "$@"
mime ^video, terminal, has mpv = mpv --video-rotate=270 -- "$@"
# Documents
ext pdf, has zathura, X, flag f = zathura -- "$@"
ext pdf, has okular, X, flag f = okular -- "$@"
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
# Images
mime ^image, has imv, X, flag f = imv -- "$@"
# Archives
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz|iso|jar|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has 7z = 7z x -- "$@"
# Listing and extracting archives without atool:
ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER"
ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done
# Fonts
mime ^font, has fontforge, X, flag f = fontforge "$@"
# Generic file openers
label open, has xdg-open = xdg-open -- "$@"
# Execute a file as program/script.
mime application/x-executable = "$1"
'';
# Ranger's preview
rangerScope = ''
#!/usr/bin/env bash
set -o noclobber -o noglob -o nounset -o pipefail
IFS=$'\n'
# Script arguments
FILE_PATH="$1"
PV_WIDTH="$2"
PV_HEIGHT="$3"
IMAGE_CACHE_PATH="$4"
PV_IMAGE_ENABLED="$5"
FILE_EXTENSION=$(echo "$FILE_PATH" | rev | cut -d. -f1 | rev)
FILE_EXTENSION_LOWER=$(echo "$FILE_EXTENSION" | tr '[:upper:]' '[:lower:]')
handle_extension() {
case "$FILE_EXTENSION_LOWER" in
# Archive
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|iso|\
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip|7z|rar)
7z l -p -- "$FILE_PATH" && exit 5
exit 1;;
pdf)
pdftotext -l 10 -nopgbrk -q -- "$FILE_PATH" - && exit 5
exiftool "$FILE_PATH" && exit 5
exit 1;;
# OpenDocument
odt|ods|odp|sxw)
odt2txt "$FILE_PATH" && exit 5
exit 1;;
esac
}
handle_image() {
local mimetype="$1"
case "$mimetype" in
# SVG
image/svg+xml)
convert "$FILE_PATH" "$IMAGE_CACHE_PATH" && exit 6
exit 1;;
# Image
image/*)
local orientation
orientation="$( identify -format '%[EXIF:Orientation]\n' -- "$FILE_PATH" )"
if [[ -n "$orientation" && "$orientation" != 1 ]]; then
convert -- "$FILE_PATH" -auto-orient "$IMAGE_CACHE_PATH" && exit 6
fi
exit 7;;
# Video
video/*)
# Thumbnail
ffmpegthumbnailer -i "$FILE_PATH" -o "$IMAGE_CACHE_PATH" -s 0 && exit 6
exit 1;;
# PDF
application/pdf)
pdftoppm -f 1 -l 1 \
-scale-to-x 1920 \
-scale-to-y -1 \
-singlefile \
-jpeg -tiffcompression jpeg \
-- "$FILE_PATH" "$(basename "$IMAGE_CACHE_PATH")" \
&& exit 6 || exit 1;;
esac
}
handle_mime() {
local mimetype="$1"
case "$mimetype" in
# Text
text/* | */xml)
exit 2;;
# Audio
audio/*)
exiftool "$FILE_PATH" && exit 5
exit 1;;
esac
}
MIMETYPE="$( file --dereference --brief --mime-type -- "$FILE_PATH" )"
if [[ "$PV_IMAGE_ENABLED" == 'True' ]]; then
handle_image "$MIMETYPE"
fi
handle_extension
handle_mime "$MIMETYPE"
handle_fallback
exit 1
'';
# Ranger's bookmarks # Ranger's bookmarks
rangerBookmarks = '' rangerBookmarks = ''
# Local files # Local files
@ -1147,12 +799,6 @@ let
drivers=pulse drivers=pulse
''; '';
# Ncmpcpp configuration
ncmpcppConf = ''
browser_sort_mode = "name"
user_interface = "alternative"
'';
# FireFox colors # FireFox colors
foxJimCol = '' foxJimCol = ''
:root { :root {
@ -1449,23 +1095,21 @@ in
home.packages = (with pkgs; [ home.packages = (with pkgs; [
# Useful programs # Useful programs
rofi-bluetooth bemoji imv qbittorrent rofi-bluetooth bemoji imv qbittorrent
libreoffice-fresh easyeffects pavucontrol libreoffice-fresh easyeffects vesktop
vesktop element-desktop ffmpegthumbnailer element-desktop ffmpegthumbnailer thunderbird
thunderbird
# Terminal programs # Terminal programs
dua vimv p7zip fastfetch gotop pciutils dua vimv p7zip fastfetch gotop pciutils usbutils
usbutils tcptrack mpc-cli ncmpcpp protonvpn-cli_2 ncpamixer tcptrack mpc-cli protonvpn-cli_2
# Scripts as global programs # Scripts as global programs
beScripts makoToggle swayLock rofiScripts makoToggle swayLock screenShot pFetch
screenShot alarmScript iommuCheck pFetch
# Production tools # Production tools
krita inkscape audacity blender sunvox krita inkscape audacity blender sunvox
# File manager # File manager
pcmanfm-qt gnome.file-roller ranger imagemagick poppler_utils pcmanfm-qt gnome.file-roller imagemagick poppler_utils
# School tools # School tools
remmina freerdp globalprotect-openconnect python3 zoom-us remmina freerdp globalprotect-openconnect python3 zoom-us
@ -1474,7 +1118,7 @@ in
yt-dlp spotdl ani-cli playerctl ffmpeg yt-dlp spotdl ani-cli playerctl ffmpeg
# Unlimited games # Unlimited games
steam steam-run heroic mangohud prismlauncher steam steam-run heroic prismlauncher
# Emulators # Emulators
#dolphin-emu cemu ryujinx duckstation pcsx2 unstable.lime3ds #dolphin-emu cemu ryujinx duckstation pcsx2 unstable.lime3ds
@ -1483,7 +1127,7 @@ in
#moonlight-qt #moonlight-qt
# Window manager apps # Window manager apps
swaybg wdisplays wl-clipboard clipman bemenu swaybg wdisplays wl-clipboard clipman
libnotify bc grim slurp swappy jq lm_sensors libnotify bc grim slurp swappy jq lm_sensors
]); ]);
@ -1491,7 +1135,7 @@ in
wayland.windowManager.sway = let wayland.windowManager.sway = let
# Define certain variables Sway will use # Define certain variables Sway will use
primeMod = "Mod4"; primeMod = "Mod4";
altMod = "Mod1"; secMod = "Mod1";
# Define scripts specific to Sway # Define scripts specific to Sway
pinWindow = pkgs.writeScript "pin-window" '' pinWindow = pkgs.writeScript "pin-window" ''
@ -1536,7 +1180,7 @@ in
''; '';
in { in {
enable = true; enable = true;
package = pkgs.unstable.sway; # swayfx #package = pkgs.swayfx
wrapperFeatures.gtk = true; wrapperFeatures.gtk = true;
checkConfig = false; checkConfig = false;
config = { config = {
@ -1546,13 +1190,12 @@ in
{ command = "swaylock"; } { command = "swaylock"; }
# Scratchpads # Scratchpads
{ command = "${terminalClass} gotop -T Gotop gotop"; } { command = "foot -a gotop -T Gotop gotop"; }
{ command = "${terminalClass} music -T Music ncmpcpp"; } { command = "foot -a music -T Music ncmpcpp"; }
{ command = "pavucontrol"; } { command = "foot -a audio -T Audio ncpamixer"; }
{ command = "easyeffects"; } { command = "easyeffects"; }
# Daemons and tray apps # Daemons and tray apps
{ command = "alarms --alarms"; }
{ command = "wl-paste -t text --watch clipman store -P"; } { command = "wl-paste -t text --watch clipman store -P"; }
{ command = "wl-copy"; } { command = "wl-copy"; }
{ command = "mako"; } { command = "mako"; }
@ -1703,27 +1346,26 @@ in
"${primeMod}+F10" = ''exec virt-manager | ${sendNotif} "Virtual Machines"''; "${primeMod}+F10" = ''exec virt-manager | ${sendNotif} "Virtual Machines"'';
# BeMenu scripts # BeMenu scripts
"${primeMod}+F11" = ''exec bescripts --scratchpads | ${sendNotif} "Scratchpads"''; "${primeMod}+F11" = ''exec rofiscripts --scratchpads | ${sendNotif} "Scratchpads"'';
"${primeMod}+${altMod}+Ctrl+r" = ''exec bescripts --resolutions''; "${primeMod}+${secMod}+Ctrl+r" = ''exec rofiscripts --resolutions'';
# Open NixOS configuration files # Open NixOS configuration files
"${primeMod}+F12" = ''exec bash -c "${terminal} nvim /etc/nixos/{configuration,jimbo,hardware-configuration}.nix" | ${sendNotif} "Nix Config"''; "${primeMod}+F12" = ''exec bash -c "foot nvim /etc/nixos/{configuration,jimbo,hardware-configuration}.nix" | ${sendNotif} "Nix Config"'';
# Terminal, bemenu, clipmenu, media script, power menu, show/hide waybar # Terminal, rofi, clipmenu, media script, power menu, show/hide waybar
"${primeMod}+Return" = ''exec ${terminal}''; "${primeMod}+Return" = ''exec foot'';
"${primeMod}+s" = ''exec bemenu-run ${bemenuOpts} -p Command''; "${primeMod}+s" = ''exec rofi -show run -p Command'';
"${primeMod}+c" = ''exec clipman pick -t rofi''; "${primeMod}+c" = ''exec clipman pick -t rofi'';
"${primeMod}+y" = ''exec bescripts --media''; "${primeMod}+x" = ''exec rofiscripts --power'';
"${primeMod}+x" = ''exec bescripts --power'';
"${primeMod}+b" = ''exec pkill -USR1 waybar''; "${primeMod}+b" = ''exec pkill -USR1 waybar'';
"${primeMod}+Escape" = ''exec ${swayTools} --kill''; "${primeMod}+Escape" = ''exec ${swayTools} --kill'';
# PCManFM, Emoji Picker, Rofi Launcher, Bluetooth, Ranger # PCManFM, Emoji Picker, Rofi Launcher, Bluetooth, Ranger
"${primeMod}+Shift+t" = ''exec pcmanfm-qt''; "${primeMod}+Shift+t" = ''exec pcmanfm-qt'';
"${primeMod}+Shift+e" = ''exec BEMOJI_PICKER_CMD="rofi -dmenu -p Emoji" bemoji -n -P 0''; "${primeMod}+Shift+e" = ''exec BEMOJI_PICKER_CMD="rofi -dmenu -i -p Emoji" bemoji -n -P 0'';
"${primeMod}+Shift+s" = ''exec rofi -show drun -modi drun -drun-display-format {name} -show-icons -disable-history -terminal ${terminal}''; "${primeMod}+Shift+s" = ''exec rofi -show drun -modi drun -drun-display-format {name} -show-icons -disable-history'';
"${primeMod}+Shift+b" = ''exec rofi-bluetooth''; "${primeMod}+Shift+b" = ''exec rofi-bluetooth'';
"${primeMod}+Shift+Return" = ''exec ${terminal} ranger''; "${primeMod}+Shift+Return" = ''exec foot ranger'';
# Swaytools prop, colorpicker, obs-cmd # Swaytools prop, colorpicker, obs-cmd
"${primeMod}+Ctrl+x" = ''exec ${swayTools} --prop''; "${primeMod}+Ctrl+x" = ''exec ${swayTools} --prop'';
@ -1738,27 +1380,25 @@ in
"XF86AudioLowerVolume" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-''; "XF86AudioLowerVolume" = ''exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-'';
# MPV volume control # MPV volume control
"${altMod}+XF86AudioRaiseVolume" = ''exec mpc volume +3''; "${secMod}+XF86AudioRaiseVolume" = ''exec mpc volume +3'';
"${altMod}+XF86AudioLowerVolume" = ''exec mpc volume -3''; "${secMod}+XF86AudioLowerVolume" = ''exec mpc volume -3'';
# Mute, Stop # Mute, Stop
"XF86AudioMute" = ''exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle''; "XF86AudioMute" = ''exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle'';
"XF86AudioStop" = ''exec mpc stop''; "XF86AudioStop" = ''exec mpc stop'';
# Play MPD, Firefox, or MPV # Play MPD, Firefox, or MPV
"XF86AudioPlay" = ''exec playerctl --player=librewolf play-pause''; "XF86AudioPlay" = ''exec mpc toggle'';
"${secMod}+XF86AudioPlay" = ''exec playerctl --player=librewolf play-pause'';
"Ctrl+XF86AudioPlay" = ''exec playerctl --player=mpv play-pause''; "Ctrl+XF86AudioPlay" = ''exec playerctl --player=mpv play-pause'';
"${altMod}+XF86AudioPlay" = ''exec mpc toggle'';
# Next/Previous # Next/Previous
"XF86AudioNext" = ''exec playerctl --player=librewolf next''; "XF86AudioNext" = ''exec mpc next'';
"XF86AudioPrev" = ''exec playerctl --player=librewolf previous''; "XF86AudioPrev" = ''exec mpc prev'';
"${altMod}+XF86AudioNext" = ''exec mpc next'';
"${altMod}+XF86AudioPrev" = ''exec mpc prev'';
# Seek # Seek
"${altMod}+Shift+XF86AudioNext" = ''exec mpc seek +5''; "${secMod}+Shift+XF86AudioNext" = ''exec mpc seek +5'';
"${altMod}+Shift+XF86AudioPrev" = ''exec mpc seek -5''; "${secMod}+Shift+XF86AudioPrev" = ''exec mpc seek -5'';
## Notification keys ## Notification keys
@ -1776,15 +1416,15 @@ in
"Ctrl+Print" = ''exec screenshot --all''; "Ctrl+Print" = ''exec screenshot --all'';
# Server SSH # Server SSH
"${primeMod}+Ctrl+Return" = ''exec ${terminal} ssh server -p 2222''; "${primeMod}+Ctrl+Return" = ''exec foot ssh server -p 2222'';
# Display Brightness and Keyboard Brightness # Display Brightness and Keyboard Brightness
"XF86MonBrightnessUp" = ''exec light -A 5''; "XF86MonBrightnessUp" = ''exec ${pkgs.light}/bin/light -A 5'';
"XF86MonBrightnessDown" = ''exec light -U 5''; "XF86MonBrightnessDown" = ''exec ${pkgs.light}/bin/light -U 5'';
"Shift+XF86MonBrightnessUp" = ''exec light -A 1''; "Shift+XF86MonBrightnessUp" = ''exec ${pkgs.light}/bin/light -A 1'';
"Shift+XF86MonBrightnessDown" = ''exec light -U 1''; "Shift+XF86MonBrightnessDown" = ''exec ${pkgs.light}/bin/light -U 1'';
"XF86KbdBrightnessUp" = ''exec light -s sysfs/leds/smc::kbd_backlight -A 5''; "XF86KbdBrightnessUp" = ''exec ${pkgs.light}/bin/light -s sysfs/leds/smc::kbd_backlight -A 5'';
"XF86KbdBrightnessDown" = ''exec light -s sysfs/leds/smc::kbd_backlight -U 5''; "XF86KbdBrightnessDown" = ''exec ${pkgs.light}/bin/light -s sysfs/leds/smc::kbd_backlight -U 5'';
## Window manager keys ## Window manager keys
"${primeMod}+q" = ''kill''; "${primeMod}+q" = ''kill'';
@ -1803,15 +1443,15 @@ in
"${primeMod}+9" = ''workspace ${w9}''; "${primeMod}+9" = ''workspace ${w9}'';
# Switch to alternate workspaces # Switch to alternate workspaces
"${altMod}+F1" = ''workspace ${w1a}''; "${secMod}+F1" = ''workspace ${w1a}'';
"${altMod}+F2" = ''workspace ${w2a}''; "${secMod}+F2" = ''workspace ${w2a}'';
"${altMod}+F3" = ''workspace ${w3a}''; "${secMod}+F3" = ''workspace ${w3a}'';
"${altMod}+F4" = ''workspace ${w4a}''; "${secMod}+F4" = ''workspace ${w4a}'';
"${altMod}+F5" = ''workspace ${w5a}''; "${secMod}+F5" = ''workspace ${w5a}'';
"${altMod}+F6" = ''workspace ${w6a}''; "${secMod}+F6" = ''workspace ${w6a}'';
"${altMod}+F7" = ''workspace ${w7a}''; "${secMod}+F7" = ''workspace ${w7a}'';
"${altMod}+F8" = ''workspace ${w8a}''; "${secMod}+F8" = ''workspace ${w8a}'';
"${altMod}+F9" = ''workspace ${w9a}''; "${secMod}+F9" = ''workspace ${w9a}'';
# Move window to and focus new workspace # Move window to and focus new workspace
"${primeMod}+Shift+grave" = ''move container to workspace ${w0}; workspace ${w0}''; "${primeMod}+Shift+grave" = ''move container to workspace ${w0}; workspace ${w0}'';
@ -1826,15 +1466,15 @@ in
"${primeMod}+Shift+9" = ''move container to workspace ${w9}; workspace ${w9}''; "${primeMod}+Shift+9" = ''move container to workspace ${w9}; workspace ${w9}'';
# Move window to and focus new alternate workspace # Move window to and focus new alternate workspace
"${altMod}+Shift+F1" = ''move container to workspace ${w1a}; workspace ${w1a}''; "${secMod}+Shift+F1" = ''move container to workspace ${w1a}; workspace ${w1a}'';
"${altMod}+Shift+F2" = ''move container to workspace ${w2a}; workspace ${w2a}''; "${secMod}+Shift+F2" = ''move container to workspace ${w2a}; workspace ${w2a}'';
"${altMod}+Shift+F3" = ''move container to workspace ${w3a}; workspace ${w3a}''; "${secMod}+Shift+F3" = ''move container to workspace ${w3a}; workspace ${w3a}'';
"${altMod}+Shift+F4" = ''move container to workspace ${w4a}; workspace ${w4a}''; "${secMod}+Shift+F4" = ''move container to workspace ${w4a}; workspace ${w4a}'';
"${altMod}+Shift+F5" = ''move container to workspace ${w5a}; workspace ${w5a}''; "${secMod}+Shift+F5" = ''move container to workspace ${w5a}; workspace ${w5a}'';
"${altMod}+Shift+F6" = ''move container to workspace ${w6a}; workspace ${w6a}''; "${secMod}+Shift+F6" = ''move container to workspace ${w6a}; workspace ${w6a}'';
"${altMod}+Shift+F7" = ''move container to workspace ${w7a}; workspace ${w7a}''; "${secMod}+Shift+F7" = ''move container to workspace ${w7a}; workspace ${w7a}'';
"${altMod}+Shift+F8" = ''move container to workspace ${w8a}; workspace ${w8a}''; "${secMod}+Shift+F8" = ''move container to workspace ${w8a}; workspace ${w8a}'';
"${altMod}+Shift+F9" = ''move container to workspace ${w9a}; workspace ${w9a}''; "${secMod}+Shift+F9" = ''move container to workspace ${w9a}; workspace ${w9a}'';
# Change focus across windows # Change focus across windows
"${primeMod}+Up" = ''focus up''; "${primeMod}+Up" = ''focus up'';
@ -1867,7 +1507,7 @@ in
# Toggle fullscreen # Toggle fullscreen
"${primeMod}+f" = ''fullscreen toggle''; "${primeMod}+f" = ''fullscreen toggle'';
"${primeMod}+${altMod}+Ctrl+f" = ''fullscreen toggle global''; "${primeMod}+${secMod}+Ctrl+f" = ''fullscreen toggle global'';
# Change container layout # Change container layout
"${primeMod}+w" = ''layout toggle split''; "${primeMod}+w" = ''layout toggle split'';
@ -1882,10 +1522,10 @@ in
"${primeMod}+d" = ''focus child''; "${primeMod}+d" = ''focus child'';
# Resize windows # Resize windows
"${primeMod}+${altMod}+Up" = ''resize grow height ${resizeAmount} px or 5 ppt''; "${primeMod}+${secMod}+Up" = ''resize grow height ${resizeAmount} px or 5 ppt'';
"${primeMod}+${altMod}+Down" = ''resize shrink height ${resizeAmount} px or 5 ppt''; "${primeMod}+${secMod}+Down" = ''resize shrink height ${resizeAmount} px or 5 ppt'';
"${primeMod}+${altMod}+Left" = ''resize shrink width ${resizeAmount} px or 5 ppt''; "${primeMod}+${secMod}+Left" = ''resize shrink width ${resizeAmount} px or 5 ppt'';
"${primeMod}+${altMod}+Right" = ''resize grow width ${resizeAmount} px or 5 ppt''; "${primeMod}+${secMod}+Right" = ''resize grow width ${resizeAmount} px or 5 ppt'';
# Adjust gap size # Adjust gap size
"${primeMod}+Shift+equal" = ''gaps inner current set 5''; "${primeMod}+Shift+equal" = ''gaps inner current set 5'';
@ -1895,7 +1535,7 @@ in
# Scratchpads # Scratchpads
"Ctrl+Shift+Escape" = ''[app_id="gotop"] scratchpad show, move position center, resize set 1216 888''; "Ctrl+Shift+Escape" = ''[app_id="gotop"] scratchpad show, move position center, resize set 1216 888'';
"${primeMod}+Shift+m" = ''[app_id="music"] scratchpad show, move position center, resize set 1006 657''; "${primeMod}+Shift+m" = ''[app_id="music"] scratchpad show, move position center, resize set 1006 657'';
"${primeMod}+Shift+v" = ''[app_id="pavucontrol"] scratchpad show, move position center, resize set 1000 800''; "${primeMod}+Shift+v" = ''[app_id="audio"] scratchpad show, move position center, resize set 1000 800'';
"${primeMod}+Shift+Backslash" = ''[app_id="com.github.wwmm.easyeffects"] scratchpad show, move position center, resize set 1000 800''; "${primeMod}+Shift+Backslash" = ''[app_id="com.github.wwmm.easyeffects"] scratchpad show, move position center, resize set 1000 800'';
}; };
window = { window = {
@ -1909,8 +1549,8 @@ in
criteria = { app_id = "gotop"; }; } criteria = { app_id = "gotop"; }; }
{ command = ''mark scratchpad''; { command = ''mark scratchpad'';
criteria = { app_id = "music"; }; } criteria = { app_id = "music"; }; }
{ command = ''mark scratchpad, opacity 0.9''; { command = ''mark scratchpad'';
criteria = { app_id = "pavucontrol"; }; } criteria = { app_id = "audio"; }; }
{ command = ''mark scratchpad, opacity 0.9''; { command = ''mark scratchpad, opacity 0.9'';
criteria = { app_id = "com.github.wwmm.easyeffects"; }; } criteria = { app_id = "com.github.wwmm.easyeffects"; }; }
@ -2598,12 +2238,49 @@ in
containers = { containers = {
Google = { color = "green"; icon = "fingerprint"; id = 200; }; Google = { color = "green"; icon = "fingerprint"; id = 200; };
Seneca = { color = "red"; icon = "briefcase"; id = 201; }; Seneca = { color = "red"; icon = "briefcase"; id = 201; };
Centennial = { color = "pink"; icon = "vacation"; id = 202; };
}; };
}; };
}; };
}; };
# Enable a terminal emulator
programs.foot = {
enable = true;
server.enable = false;
settings = {
main = {
term = "xterm-256color";
font = "${nerdFont}:size=14.7";
};
cursor = {
style = "beam";
};
colors = {
alpha = "0.65";
background = "${darkCol}";
regular0 = "3f3f3f";
regular1 = "cc0000";
regular2 = "4e9a06";
regular3 = "c4a000";
regular4 = "94bff3";
regular5 = "85678f";
regular6 = "06989a";
regular7 = "dcdccc";
bright0 = "545454";
bright1 = "fc5454";
bright2 = "8ae234";
bright3 = "fce94f";
bright4 = "94bff3";
bright5 = "b294bb";
bright6 = "93e0e3";
bright7 = "ffffff";
};
key-bindings = {
search-start = "Control+f";
};
};
};
# Install Neovim and plugins # Install Neovim and plugins
programs.neovim = { programs.neovim = {
enable = true; enable = true;
@ -2718,10 +2395,64 @@ in
''; '';
}; };
# Enable Ranger
programs.ranger = {
enable = true;
settings = {
preview_images = true;
preview_images_method = "sixel";
dirname_in_tabs = true;
cd_tab_fuzzy = true;
autosave_bookmarks = false;
show_hidden = true;
wrap_scroll = true;
column_ratios = "2,2,4";
hidden_filter = ''^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$'';
};
rifle = [
# Text editing
{ condition = ''ext xml|json|jsonc|m3u|m3u8|csv|tex|py|pl|rb|js|sh|php|nix''; command = ''vim -- "$@"''; }
# Media
{ condition = ''mime ^image, has imv, X, flag f''; command = ''imv -- "$@"''; }
{ condition = ''mime ^video, terminal, has mpv''; command = ''mpv -- "$@"''; }
{ condition = ''mime ^video, terminal, has mpv''; command = ''mpv --video-rotate=270 -- "$@"''; }
{ condition = ''mime ^audio|ogg$, terminal, has mpv''; command = ''mpv --no-audio-display -- "$@"''; }
{ condition = ''mime ^audio|ogg$, terminal, has mpv''; command = ''mpv --shuffle --no-audio-display -- "$@"''; }
{ condition = ''ext x?html?|pdf, has librewolf, X, flag f''; command = ''librewolf -- "$@"''; }
{ condition = ''ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f''; command = ''libreoffice "$@"''; }
# Scripts
{ condition = ''sh''; command = ''sh -- "$1"''; }
{ condition = ''py''; command = ''python -- "$1"''; }
{ condition = ''pl''; command = ''perl -- "$1"''; }
{ condition = ''js''; command = ''node -- "$1"''; }
{ condition = ''php''; command = ''php -- "$1"''; }
# Misc
{ condition = ''ext exe|msi''; command = ''wine "$1"''; }
{ condition = ''ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz|iso|jar|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has 7z''; command = ''7z x -- "$@"''; }
{ condition = ''label open, has xdg-open''; command = ''xdg-open -- "$@"''; }
];
plugins = [
{
name = "devicons2";
src = builtins.fetchGit {
url = "https://github.com/cdump/ranger-devicons2";
rev = "9606009aa01743768b0f27de0a841f7d8fe196c5";
};
}
];
extraConfig = ''
default_linemode devicons2
'';
};
# Enable Rofi # Enable Rofi
programs.rofi = { programs.rofi = {
enable = true; enable = true;
package = pkgs.rofi-wayland; package = pkgs.rofi-wayland;
terminal = "foot";
font = "${mainFont} 14"; font = "${mainFont} 14";
theme = let theme = let
inherit (config.lib.formats.rasi) mkLiteral; inherit (config.lib.formats.rasi) mkLiteral;
@ -2852,16 +2583,13 @@ in
}; };
}; };
# Enable Discord Music RPC
services.mpd-discord-rpc.enable = true;
# OBS with plugins # OBS with plugins
programs.obs-studio = { programs.obs-studio = {
enable = true; enable = true;
plugins = with pkgs.obs-studio-plugins; [ plugins = with pkgs.obs-studio-plugins; [
obs-pipewire-audio-capture obs-webkitgtk obs-pipewire-audio-capture obs-webkitgtk
obs-multi-rtmp obs-vkcapture obs-tuna obs-multi-rtmp obs-vkcapture obs-tuna
advanced-scene-switcher looking-glass-obs looking-glass-obs
]; ];
}; };
@ -2883,29 +2611,54 @@ in
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";
}; };
# Mangohud
programs.mangohud = {
enable = true;
settings = {
table_columns = 2;
frametime = 0;
legacy_layout = 0;
font_scale = 0.80;
background_alpha = 0.25;
exec = ''echo $(echo $XDG_CURRENT_DESKTOP | sed 's/./\U&/') on $(cat /etc/os-release | grep PRETTY_NAME | cut -d '"' -f 2)'';
fps = true;
fps_color_change = true;
ram = true;
vram = true;
cpu_stats = true;
cpu_load_change = true;
gpu_stats = true;
gpu_load_change = true;
frame_timing = true;
};
};
# Enable Discord Music RPC
services.mpd-discord-rpc.enable = true;
# Enable NCMPCPP
programs.ncmpcpp = {
enable = true;
settings = {
browser_sort_mode = "name";
user_interface = "alternative";
};
};
# Automount with udisk2 # Automount with udisk2
services.udiskie.enable = true; services.udiskie.enable = true;
# Start defining arbitrary files # Start defining arbitrary files
home.file = { home.file = {
# Sway scripts
".config/sway/start.sh" = { text = swayStart; executable = true; };
# Cursor icon theme # Cursor icon theme
".icons/default".source = "${pkgs.simp1e-cursors}/share/icons/Simp1e-Dark"; ".icons/default".source = "${pkgs.simp1e-cursors}/share/icons/Simp1e-Dark";
# Swappy's config # Swappy's config
".config/swappy/config".text = swappyConfig; ".config/swappy/config".text = swappyConfig;
# Foot config file
".config/foot/foot.ini".text = footConf;
# Easyeffects profile # Easyeffects profile
".config/easyeffects/output/JimHeadphones.json".text = easyEffectsProfile; ".config/easyeffects/output/JimHeadphones.json".text = easyEffectsProfile;
# Mangohud config
".config/MangoHud/MangoHud.conf".text = mangoConf;
# Fastfetch config # Fastfetch config
".config/fastfetch/config.jsonc".text = neoConf; ".config/fastfetch/config.jsonc".text = neoConf;
@ -2913,21 +2666,7 @@ in
".config/pcmanfm-qt/default/settings.conf".text = pcmanConf; ".config/pcmanfm-qt/default/settings.conf".text = pcmanConf;
# Ranger config # Ranger config
".config/ranger/rc.conf".text = rangerConf;
".config/ranger/rifle.conf".text = rifleConf;
".config/ranger/scope.sh" = { text = rangerScope; executable = true; };
".local/share/ranger/bookmarks".text = rangerBookmarks; ".local/share/ranger/bookmarks".text = rangerBookmarks;
".config/ranger/plugins/devicons/devicons.py".source = "${pkgs.fetchurl {
url = "https://raw.githubusercontent.com/alexanderjeurissen/ranger_devicons/2c3c19dffb4238d01c74515c9eed5088066db243/devicons.py";
sha256 = "0girsranwhsgc6kcyh1mkwymx0bl14a2k5nzk3kyllb6ic48c33k";
}}";
".config/ranger/plugins/devicons/__init__.py".source = "${pkgs.fetchurl {
url = "https://raw.githubusercontent.com/alexanderjeurissen/ranger_devicons/2c3c19dffb4238d01c74515c9eed5088066db243/__init__.py";
sha256 = "1r086apw20ryxylqgnbynx7mzz779v1w0m40wghmmhlzw4x15fmr";
}}";
# Ncmpcpp config
".config/ncmpcpp/config".text = ncmpcppConf;
# Gnome theme # Gnome theme
".mozilla/firefox/Misc/chrome".source = "${fetchTarball { ".mozilla/firefox/Misc/chrome".source = "${fetchTarball {
@ -2982,9 +2721,9 @@ in
ls = "${pkgs.eza}/bin/eza -a --color=always --group-directories-first --icons"; ls = "${pkgs.eza}/bin/eza -a --color=always --group-directories-first --icons";
nls = "/usr/bin/env ls"; nls = "/usr/bin/env ls";
cat = "${pkgs.bat}/bin/bat --paging never"; cat = "${pkgs.bat}/bin/bat --paging never";
ncat = "/usr/bin/env cat";
copycat = "wl-copy <"; copycat = "wl-copy <";
sunshinehost = "WAYLAND_DISPLAY=wayland-1 DISPLAY=:1 sunshine -0"; sunshinehost = "WAYLAND_DISPLAY=wayland-1 DISPLAY=:1 sunshine -0";
alarmlist = "cat ${alarmScript}/bin/alarms";
seneca = "ssh jhampton1@matrix.senecapolytechnic.ca"; seneca = "ssh jhampton1@matrix.senecapolytechnic.ca";
# Curl tools # Curl tools

View file

@ -146,17 +146,23 @@ in
# Enable nftables and forwarding # Enable nftables and forwarding
nftables = { nftables = {
enable = true; enable = true;
tables.forwarding = { tables = {
forwarding = {
family = "ip"; family = "ip";
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 ${pcIP} comment "SSH from PC" tcp dport 2211 dnat to ${pcIP}:22 comment "SSH to PC"
udp dport { 27005, 27015, 7777 } dnat to ${pcIP} comment "Games from PC" udp dport { 27005, 27015, 7777 } dnat to ${pcIP} comment "Games to PC"
tcp dport { 58010, 57989, 57984 } dnat to ${pcIP} comment "Sunshine TCP from PC"
udp dport { 57998, 57999, 58000 } dnat to ${pcIP} comment "Sunshine UDP from PC" tcp dport { 58010, 57989, 57984 } dnat to ${pcIP} comment "Sunshine TCP to PC"
tcp dport { 38010, 37989, 37984 } dnat to ${vmIP} comment "Sunshine TCP from VM" udp dport { 57998, 57999, 58000 } dnat to ${pcIP} comment "Sunshine UDP to PC"
udp dport { 37998, 37999, 38000 } dnat to ${vmIP} comment "Sunshine UDP from VM"
tcp dport { 38010, 37989, 37984 } dnat to ${vmIP} comment "Sunshine TCP to VM"
udp dport { 37998, 37999, 38000 } dnat to ${vmIP} comment "Sunshine UDP to VM"
ip saddr ${secrets.freecornIP} tcp dport { 9943, 9944 } dnat to ${vmIP} comment "ALVR TCP to VM"
ip saddr ${secrets.freecornIP} udp dport { 9943, 9944 } dnat to ${vmIP} comment "ALVR UDP to VM"
} }
chain POSTROUTING { chain POSTROUTING {
type nat hook postrouting priority 100; policy accept; type nat hook postrouting priority 100; policy accept;
@ -166,6 +172,7 @@ in
}; };
}; };
}; };
};
# Boot with compatibility for IP forwarding # Boot with compatibility for IP forwarding
boot.kernel.sysctl."net.ipv4.ip_forward" = 1; boot.kernel.sysctl."net.ipv4.ip_forward" = 1;
@ -409,18 +416,13 @@ in
application stream { application stream {
record off; record off;
live on; live on;
deny play all; allow play all;
hls on; hls on;
hls_path /var/www/bloxelcomweb/landing-page/bloxelcom-cable/hls; hls_path /var/www/bloxelcomweb/landing-page/bloxelcom-cable/hls;
hls_fragment_naming system; hls_fragment_naming system;
hls_fragment 3; hls_fragment 3;
hls_playlist_length 40; hls_playlist_length 40;
} }
application forward {
record off;
live on;
allow play all;
}
} }
} }
''; '';
@ -697,7 +699,9 @@ in
systemd.services.nginx.serviceConfig = { systemd.services.nginx.serviceConfig = {
SupplementaryGroups = [ "shadow" ]; SupplementaryGroups = [ "shadow" ];
}; };
systemd.services.nginx.serviceConfig.ReadWritePaths = [ "/var/www/bloxelcomweb/landing-page/bloxelcom-cable/hls/" ]; systemd.services.nginx.serviceConfig.ReadWritePaths = [
"/var/www/bloxelcomweb/landing-page/bloxelcom-cable/hls/"
];
# Get certificates for Coturn # Get certificates for Coturn
security.acme = { security.acme = {
@ -715,7 +719,7 @@ in
nixpkgs.config.element-web.conf = { nixpkgs.config.element-web.conf = {
default_server_config = { default_server_config = {
"m.homeserver" = { "m.homeserver" = {
base_url = "https://matrix.${bloxelDomain}:443"; base_url = "https://matrix.${bloxelDomain}";
server_name = "matrix.${bloxelDomain}"; server_name = "matrix.${bloxelDomain}";
}; };
}; };
@ -751,24 +755,23 @@ in
# Generate passwords with nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt' # Generate passwords with nix-shell -p mkpasswd --run 'mkpasswd -sm bcrypt'
loginAccounts = { loginAccounts = {
"noreply@${bloxelDomain}" = { "noreply@${bloxelDomain}" = {
hashedPasswordFile = pkgs.writeText "noreply" secrets.noreplySmtpHash; hashedPasswordFile = pkgs.writeText "noreply" secrets.noreplyMailHash;
sendOnly = true; sendOnly = true;
}; };
"jimbo@${bloxelDomain}" = { "jimbo@${bloxelDomain}" = {
hashedPasswordFile = pkgs.writeText "jimbo" secrets.jimboSmtpHash; hashedPasswordFile = pkgs.writeText "jimbo" secrets.jimboMailHash;
aliases = [ "canada@${bloxelDomain}" "contact@${bloxelDomain}" ]; aliases = [ "canada@${bloxelDomain}" "contact@${bloxelDomain}" ];
}; };
"lunamoonlight@${bloxelDomain}" = { "lunamoonlight@${bloxelDomain}" = {
hashedPasswordFile = pkgs.writeText "luna" secrets.lunaSmtpHash; hashedPasswordFile = pkgs.writeText "luna" secrets.lunaMailHash;
aliases = [ "us@${bloxelDomain}" "contact@${bloxelDomain}" ]; aliases = [ "us@${bloxelDomain}" "contact@${bloxelDomain}" ];
}; };
"freecorn1854@${bloxelDomain}" = { "freecorn1854@${bloxelDomain}" = {
hashedPasswordFile = pkgs.writeText "freecorn" secrets.freecornSmtpHash; hashedPasswordFile = pkgs.writeText "freecorn" secrets.freecornMailHash;
aliases = [ "canada@${bloxelDomain}" "contact@${bloxelDomain}" ]; aliases = [ "canada@${bloxelDomain}" "contact@${bloxelDomain}" ];
}; };
"tinyattack09@${bloxelDomain}" = { "tinyattack09@${bloxelDomain}" = {
hashedPasswordFile = pkgs.writeText "tiny" secrets.tinySmtpHash; hashedPasswordFile = pkgs.writeText "tiny" secrets.tinyMailHash;
aliases = [ "smallthing@${bloxelDomain}" ];
}; };
}; };
}; };