More server changes and generalization of the waybar

This commit is contained in:
Jimbo 2024-12-12 06:37:05 -05:00
parent 7540a2156a
commit ba65a9a177
36 changed files with 213 additions and 402 deletions

View file

@ -1 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIC2lMkUd+BbXITE5LTg94hEzmA6UKsIIbaf5YOjGoLzl ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBk6ALxn+zKrRys6/c1oYSoWJaUUEo3nAM224ElhjJQR

View file

@ -1,7 +1,4 @@
{ ... }: { ... }:
{ {
imports = [ imports = [ ./unstable ];
./packages
./unstable
];
} }

View file

@ -1,9 +0,0 @@
{ pkgs, ... }:
{
nixpkgs.overlays = [
(final: _prev: {
xash3d = pkgs.callPackage ./xash3d {};
hlsdk = pkgs.callPackage ./hlsdk {};
})
];
}

View file

@ -1,52 +0,0 @@
{ lib
, pkgs
, stdenv
, fetchFromGitHub
, gamedir ? "valve"
, enableGoldsourceSupport ? true
, enableVgui ? false
, enableVoicemgr ? false
, enableBugfixes ? false
, enableCrowbarIdleAnim ? false
}:
stdenv.mkDerivation {
pname = "fwgs-hlsdk";
version = "2023-03-01";
nativeBuildInputs = with pkgs; [cmake];
src = fetchFromGitHub {
owner = "FWGS";
repo = "hlsdk-portable";
rev = "d11f853464ee5d951e25ce9d0eea001780b92196";
sha256 = if enableVgui then "sha256-Qd+SUie+jlfxo6aefordYw665ZaNaR3TxufntfIaoCo=" else "sha256-WU+I+mmoyXvW1pvqJLddPaA8/tod3TtvqzVPYJRbGz4=";
fetchSubmodules = enableVgui;
};
cmakeFlags = let
optionals = lib.optionals;
optional = (cond: val: optionals cond [val]);
cmakeBool = (x: if x then "ON" else "OFF");
in [
"-DUSE_VGUI=${cmakeBool enableVgui}"
"-DGOLDSOURCE_SUPPORT=${cmakeBool enableGoldsourceSupport}"
"-DUSE_VOICEMGR=${cmakeBool enableVoicemgr}"
"-DBARNACLE_FIX_VISIBILITY=${cmakeBool enableBugfixes}"
"-DCROWBAR_DELAY_FIX=${cmakeBool enableBugfixes}"
"-DCROWBAR_FIX_RAPID_CROWBAR=${cmakeBool enableBugfixes}"
"-DGAUSS_OVERCHARGE_FIX=${cmakeBool enableBugfixes}"
"-DTRIPMINE_BEAM_DUPLICATION_FIX=${cmakeBool enableBugfixes}"
"-DHANDGRENADE_DEPLOY_FIX=${cmakeBool enableBugfixes}"
"-DWEAPONS_ANIMATION_TIMES_FIX=${cmakeBool enableBugfixes}"
"-DCROWBAR_IDLE_ANIM=${cmakeBool enableCrowbarIdleAnim}"
] ++ (optional (gamedir != "valve") "-DGAMEDIR=${gamedir}")
++ (optional stdenv.is64bit "-D64BIT=ON");
meta = with lib; {
description = "Portable Half-Life SDK. GoldSource and Xash3D. Crossplatform.";
homepage = "https://github.com/FWGS/hlsdk-portable";
license = with licenses; [ unfree ];
# maintainers = with maintainers; [ chayleaf ];
};
}

View file

@ -1,17 +0,0 @@
diff --git a/scripts/waifulib/zip.py b/scripts/waifulib/zip.py
index 6e903ba7..d47f1754 100644
--- a/scripts/waifulib/zip.py
+++ b/scripts/waifulib/zip.py
@@ -25,7 +25,11 @@ class ziparchive(Task.Task):
arcfile = src.path_from(self.relative_to)
Logs.debug('%s: %s <- %s as %s', self.__class__.__name__, outfile, infile, arcfile)
- zf.write(infile, arcfile)
+
+ arcfile = zipfile.ZipInfo(filename=arcfile, date_time=(1980, 1, 1, 0, 0, 0))
+
+ with open(infile, 'rb') as f:
+ zf.writestr(arcfile, f.read())
@TaskGen.feature('zip')
def create_zip_archive(self):

View file

@ -1,68 +0,0 @@
{ lib
, pkgs
, stdenv
, fetchFromGitHub
, dedicated ? false # dedicated server
, gamedir ? "valve"
, enableBsp2 ? false # bsp2 support (for quake)
, enableGles1 ? false # gles1 renderer (nanogl)
, enableGles2 ? false # gles2 renderer (glwes)
, enableGl4es ? false # gles2 renderer (gl4es)
, enableGl ? true # opengl renderer
, enableSoft ? true # soft renderer
, enableUtils ? false # mdldec
}:
stdenv.mkDerivation {
pname = "xash3d-fwgs";
version = "2023-03-01";
nativeBuildInputs = with pkgs; [python3 pkg-config makeWrapper];
buildInputs = with pkgs; [SDL2 libopus freetype fontconfig];
src = fetchFromGitHub {
owner = "FWGS";
repo = "xash3d-fwgs";
rev = "7e9d46689ca76d6bf1669ada6344fc724dd683cf";
sha256 = "sha256-rvONYm1Gz9PpK8KY6RIIJ82FtxGcWe/4YoT2eV4sCOc=";
fetchSubmodules = true;
};
patches = [ ./change-zip-date.patch ];
configurePhase = let
optionals = lib.optionals;
optional = (cond: val: optionals cond [val]);
flags = ["-8" "-P" "--prefix=/"]
++ (optional dedicated "-d")
++ (optionals (gamedir != "valve") ["--gamedir" gamedir])
++ (optional enableBsp2 "--enable-bsp2")
++ (optional enableGles1 "--enable-gles1")
++ (optional enableGles2 "--enable-gles2")
++ (optional enableGl4es "--enable-gl4es")
++ (optional (!enableGl) "--disable-gl")
++ (optional (!enableSoft) "--disable-soft")
++ (optional enableUtils "--enable-utils")
;
in ''
python3 ./waf configure -T release ${lib.strings.escapeShellArgs flags}
'';
buildPhase = ''
python3 ./waf build
'';
installPhase = ''
python3 ./waf install "--destdir=$out"
mkdir $out/bin
makeWrapper $out/lib/xash3d/xash3d $out/bin/xash3d --set XASH3D_EXTRAS_PAK1 $out/share/xash3d/valve/extras.pk3
'';
meta = with lib; {
description = "Xash3D FWGS engine";
homepage = "https://github.com/FWGS/xash3d-fwgs";
# this is a mess because of vendoring...
# maybe the correct thing to do use to simply use `[ unfree gpl3Plus ]` instead
license = with licenses; [ unfree gpl2Plus gpl3Plus lgpl3Plus mit bsd3 ];
# maintainers = with maintainers; [ chayleaf ];
};
}

View file

@ -125,19 +125,15 @@
}; };
home.packages = with pkgs; [ home.packages = with pkgs; [
(pkgs.writeScriptBin "rofiscripts" '' (pkgs.writeScriptBin "rofiscratch" ''
# Scratchpad function
scratchpads() {
SCRATCHPADS=$(echo -e "Btop\nMusic\nSound\nEasyEffects" | rofi -dmenu -i -p "Scratchpads") SCRATCHPADS=$(echo -e "Btop\nMusic\nSound\nEasyEffects" | rofi -dmenu -i -p "Scratchpads")
case $SCRATCHPADS in case $SCRATCHPADS in
Btop) foot -a btop -T Btop btop;; Btop) foot -a btop -T Btop btop;;
Music) foot -a music -T Music ncmpcpp;; Music) foot -a music -T Music ncmpcpp;;
Sound) foot -a sound -T Sound pulsemixer;; Sound) foot -a sound -T Sound pulsemixer;;
esac esac
} '')
(pkgs.writeScriptBin "rofipower" ''
# Lock menu
power() {
POWER=$(echo -e "Shutdown\nReboot\nSleep\nLock\nKill" | rofi -dmenu -i -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;;
@ -146,16 +142,6 @@
Lock) swaylock &;; Lock) swaylock &;;
Kill) pkill -9 $XDG_CURRENT_DESKTOP;; Kill) pkill -9 $XDG_CURRENT_DESKTOP;;
esac esac
}
# Check for command-line arguments
if [ "$1" == "--scratchpads" ]; then
scratchpads
elif [ "$1" == "--power" ]; then
power
else
echo "Please --scratchpads or --power."
fi
'') '')
rofi-bluetooth rofi-bluetooth
bemoji bemoji

View file

@ -1,5 +1,7 @@
{ pkgs, ... }: { pkgs, ... }:
{ {
home.packages = with pkgs; [ spotdl ]; home = {
programs.zsh.shellAliases.spotdl = "spotdl --m3u --format opus"; packages = with pkgs; [ spotdl ];
shellAliases.spotdl = "spotdl --m3u --format opus";
};
} }

View file

@ -1,7 +1,6 @@
{ ... }: { ... }:
{ {
programs = { programs.yt-dlp = {
yt-dlp = {
enable = true; enable = true;
settings = { settings = {
add-metadata = true; add-metadata = true;
@ -11,10 +10,10 @@
output = ''"%(artist)s - %(title)s.%(ext)s"''; output = ''"%(artist)s - %(title)s.%(ext)s"'';
}; };
}; };
zsh.shellAliases = {
home.shellAliases = {
ytm3u = "yt-dlp -gS proto:m3u8"; ytm3u = "yt-dlp -gS proto:m3u8";
opusdl = ''yt-dlp -f ba -x --audio-quality 0''; opusdl = ''yt-dlp -f ba -x --audio-quality 0'';
spotdl = "spotdl --m3u --format opus"; spotdl = "spotdl --m3u --format opus";
}; };
};
} }

View file

@ -2,7 +2,6 @@
{ {
imports = [ imports = [
./launchers ./launchers
./games
./emulators ./emulators
]; ];
} }

View file

@ -1,4 +0,0 @@
{ pkgs, ... }:
{
home.packages = with pkgs; [ xash3d ];
}

View file

@ -21,7 +21,7 @@
# Prime + key # Prime + key
"${primeMod}, s, exec, rofi -show run -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}, x, exec, rofiscripts --power" "${primeMod}, x, exec, rofipower"
"${primeMod}, b, exec, pkill -USR1 waybar" "${primeMod}, b, exec, pkill -USR1 waybar"
"${primeMod}, Return, exec, foot" "${primeMod}, Return, exec, foot"
@ -33,7 +33,7 @@
"${primeMod} Shift, Return, exec, foot ranger" "${primeMod} Shift, Return, exec, foot ranger"
# Prime + ctrl + key # Prime + ctrl + key
"${primeMod} Ctrl, s, exec, rofiscripts --scratchpads" "${primeMod} Ctrl, s, exec, rofiscratch"
''${primeMod} Ctrl, c, exec, wlpicker && notify-send "Color copied to clipboard"'' ''${primeMod} Ctrl, c, exec, wlpicker && notify-send "Color copied to clipboard"''
## Media ## Media

View file

@ -20,7 +20,7 @@
// Prime + key // Prime + key
${primeMod}+s { spawn "sh" "-c" "rofi -show run -p Command"; } ${primeMod}+s { spawn "sh" "-c" "rofi -show run -p Command"; }
${primeMod}+c { spawn "sh" "-c" "clipman pick -t rofi"; } ${primeMod}+c { spawn "sh" "-c" "clipman pick -t rofi"; }
${primeMod}+x { spawn "sh" "-c" "rofiscripts --power"; } ${primeMod}+x { spawn "sh" "-c" "rofipower"; }
${primeMod}+b { spawn "sh" "-c" "pkill -USR1 waybar"; } ${primeMod}+b { spawn "sh" "-c" "pkill -USR1 waybar"; }
${primeMod}+Return { spawn "sh" "-c" "foot"; } ${primeMod}+Return { spawn "sh" "-c" "foot"; }
@ -32,7 +32,7 @@
${primeMod}+Shift+Return { spawn "sh" "-c" "foot ranger"; } ${primeMod}+Shift+Return { spawn "sh" "-c" "foot ranger"; }
// Prime + ctrl + key // Prime + ctrl + key
${primeMod}+Ctrl+s { spawn "sh" "-c" "rofiscripts --scratchpads"; } ${primeMod}+Ctrl+s { spawn "sh" "-c" "rofiscratch"; }
${primeMod}+Ctrl+c { spawn "sh" "-c" "wlpicker && notify-send \"Color copied to clipboard\""; } ${primeMod}+Ctrl+c { spawn "sh" "-c" "wlpicker && notify-send \"Color copied to clipboard\""; }
//// Media //// Media

View file

@ -248,7 +248,7 @@
"sway/scratchpad" = scratchpadModule; "sway/scratchpad" = scratchpadModule;
"tray" = trayModule; "tray" = trayModule;
"bluetooth" = bluetoothModule; "bluetooth" = bluetoothModule;
"network" = networkModule // { interface = "enp*"; }; "network" = networkModule;
}; };
display2 = { display2 = {

View file

@ -23,7 +23,7 @@
# Prime + key # Prime + key
"${primeMod}+s" = ''exec rofi -show run -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}+x" = ''exec rofiscripts --power''; "${primeMod}+x" = ''exec rofipower'';
"${primeMod}+b" = ''exec pkill -USR1 waybar''; "${primeMod}+b" = ''exec pkill -USR1 waybar'';
"${primeMod}+Return" = ''exec foot''; "${primeMod}+Return" = ''exec foot'';
@ -36,7 +36,7 @@
# Prime + ctrl + key # Prime + ctrl + key
"${primeMod}+Ctrl+x" = ''exec prop-sway''; "${primeMod}+Ctrl+x" = ''exec prop-sway'';
"${primeMod}+Ctrl+s" = ''exec rofiscripts --scratchpads''; "${primeMod}+Ctrl+s" = ''exec rofiscratch'';
"${primeMod}+Ctrl+c" = ''exec wlpicker && notify-send "Color copied to clipboard"''; "${primeMod}+Ctrl+c" = ''exec wlpicker && notify-send "Color copied to clipboard"'';
## Media ## Media

View file

@ -1,7 +1,6 @@
{ pkgs, config, ... }: { pkgs, config, ... }:
{ {
users.users = { users.users.jimbo = {
jimbo = {
description = "Jimbo"; description = "Jimbo";
hashedPassword = config.secrets.jimboAccPass; hashedPassword = config.secrets.jimboAccPass;
isNormalUser = true; isNormalUser = true;
@ -36,7 +35,6 @@
uid = 1000; uid = 1000;
shell = pkgs.zsh; shell = pkgs.zsh;
}; };
};
home-manager.users.jimbo = import ../../../../home; home-manager.users.jimbo = import ../../../../home;
} }

View file

@ -1,7 +1,8 @@
{ config, pkgs, ... }: { lib, config, pkgs, ... }:
{ {
config = lib.mkIf config.system.desktop.enable {
services.pipewire = { services.pipewire = {
enable = config.system.desktop.enable; enable = true;
wireplumber = { wireplumber = {
enable = true; enable = true;
configPackages = [ configPackages = [
@ -17,4 +18,5 @@
pulse.enable = true; pulse.enable = true;
#jack.enable = true; #jack.enable = true;
}; };
};
} }

View file

@ -1,7 +1,9 @@
{ config, ... }: { lib, config, ... }:
{ {
config = lib.mkIf config.system.desktop.enable {
programs = { programs = {
light.enable = config.system.desktop.enable; light.enable = true;
kbdlight.enable = config.system.desktop.enable; kbdlight.enable = true;
};
}; };
} }

View file

@ -1,9 +1,10 @@
{ config, lib, ... }: { config, lib, ... }:
{ {
config = lib.mkIf config.system.desktop.enable {
programs = { programs = {
sway.enable = config.system.desktop.enable; sway.enable = true;
niri.enable = config.system.desktop.enable; niri.enable = true;
hyprland.enable = config.system.desktop.enable; hyprland.enable = true;
xwayland.enable = lib.mkForce true; xwayland.enable = lib.mkForce true;
}; };
@ -12,6 +13,7 @@
NIXOS_OZONE_WL = "1"; NIXOS_OZONE_WL = "1";
}; };
services.dbus.enable = config.system.desktop.enable; services.dbus.enable = true;
security.pam.services.swaylock = {}; security.pam.services.swaylock = {};
};
} }

View file

@ -1,9 +1,11 @@
{ config, ... }: { config, lib, ... }:
{ {
config = lib.mkIf config.system.desktop.enable {
programs.gamemode = { programs.gamemode = {
enable = config.system.desktop.enable; enable = true;
settings.general.renice = 10; settings.general.renice = 10;
}; };
hardware.steam-hardware.enable = config.system.desktop.enable; hardware.steam-hardware.enable = config.system.desktop.enable;
};
} }

View file

@ -1,7 +1,8 @@
{ config, pkgs, ... }: { config, pkgs, lib, ... }:
{ {
config = lib.mkIf config.system.desktop.enable {
services.greetd = { services.greetd = {
enable = config.system.desktop.enable; enable = true;
restart = true; restart = true;
settings = { settings = {
terminal = { terminal = {
@ -31,4 +32,5 @@
Exec=Hyprland Exec=Hyprland
''; '';
}; };
};
} }

View file

@ -1,7 +1,7 @@
{ config, ... }: { config, lib, ... }:
{ {
services = { services = lib.mkIf config.system.desktop.enable {
gvfs.enable = config.system.desktop.enable; gvfs.enable = true;
udisks2.enable = config.system.desktop.enable; udisks2.enable = true;
}; };
} }

View file

@ -1,8 +1,9 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
{ {
config = lib.mkIf config.system.desktop.enable {
xdg.portal = { xdg.portal = {
wlr = { wlr = {
enable = lib.mkForce config.system.desktop.enable; enable = lib.mkForce true;
settings.screencast = { settings.screencast = {
max_fps = 60; max_fps = 60;
chooser_type = "simple"; chooser_type = "simple";
@ -14,4 +15,5 @@
xdg-desktop-portal-hyprland xdg-desktop-portal-hyprland
]; ];
}; };
};
} }

View file

@ -1,4 +1,4 @@
{ lib, ... }: { ... }:
{ {
services.tlp.enable = true; services.tlp.enable = true;
} }

View file

@ -20,7 +20,7 @@
# Advertise to Windows # Advertise to Windows
samba-wsdd = { samba-wsdd = {
enable = config.system.server.enable; enable = config.services.samba.enable;
openFirewall = true; openFirewall = true;
}; };
}; };

View file

@ -1,7 +1,4 @@
{ ... }: { ... }:
{ {
imports = [ imports = [ ./nextcloud ];
./nextcloud
./photoprism
];
} }

View file

@ -1,6 +1,6 @@
{ config, ... }: { lib, config, ... }:
{ {
services.nginx.virtualHosts."cloud.${config.domains.jim1}" = { services.nginx.virtualHosts."cloud.${config.domains.jim1}" = lib.mkIf config.services.nextcloud.enable {
enableACME = true; enableACME = true;
addSSL = true; addSSL = true;
onlySSL = true; onlySSL = true;

View file

@ -1,22 +0,0 @@
{ config, ... }:
{
imports = [ ./nginx ];
services.photoprism = {
enable = config.system.server.enable;
port = 2342;
originalsPath = "/var/lib/private/photoprism/originals";
address = "0.0.0.0";
settings = {
PHOTOPRISM_ADMIN_USER = "jimbo";
PHOTOPRISM_ADMIN_PASSWORD = "${config.secrets.prismAdminPass}";
PHOTOPRISM_DEFAULT_LOCALE = "en";
PHOTOPRISM_DATABASE_DRIVER = "mysql";
PHOTOPRISM_DATABASE_NAME = "photoprism";
PHOTOPRISM_DATABASE_SERVER = "/run/mysqld/mysqld.sock";
PHOTOPRISM_DATABASE_USER = "photoprism";
PHOTOPRISM_SITE_URL = "https://gallery.${config.domains.jim1}";
PHOTOPRISM_SITE_TITLE = "Jimbo's PhotoPrism";
};
};
}

View file

@ -1,11 +0,0 @@
{ config, ... }:
{
services.nginx.virtualHosts."gallery.${config.domains.jim1}" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://127.0.0.1:2342";
proxyWebsockets = true;
};
};
}

View file

@ -2,8 +2,9 @@
{ {
imports = [ ./nginx ]; imports = [ ./nginx ];
config = lib.mkIf config.system.server.enable {
services.forgejo = { services.forgejo = {
enable = config.system.server.enable; enable = true;
settings = { settings = {
server = { server = {
DOMAIN = "git.${config.domains.jim1}"; DOMAIN = "git.${config.domains.jim1}";
@ -12,9 +13,6 @@
SSH_PORT = 2299; SSH_PORT = 2299;
START_SSH_SERVER = true; START_SSH_SERVER = true;
}; };
ui = {
DEFAULT_THEME = "forgejo-dark";
};
mailer = { mailer = {
ENABLED = true; ENABLED = true;
SMTP_ADDR = "mx.${config.domains.jim1}"; SMTP_ADDR = "mx.${config.domains.jim1}";
@ -27,8 +25,10 @@
REGISTER_EMAIL_CONFIRM = true; REGISTER_EMAIL_CONFIRM = true;
DISABLE_REGISTRATION = true; DISABLE_REGISTRATION = true;
}; };
ui.DEFAULT_THEME = "forgejo-dark";
}; };
}; };
networking.firewall.allowedTCPPorts = [ 2299 ]; networking.firewall.allowedTCPPorts = [ 2299 ];
};
} }

View file

@ -1,6 +1,6 @@
{ config, ... }: { lib, config, ... }:
{ {
services.nginx.virtualHosts."git.${config.domains.jim1}" = { services.nginx.virtualHosts."git.${config.domains.jim1}" = lib.mkIf config.services.forgejo.enable {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {

View file

@ -1,6 +1,6 @@
{ config, ... }: { lib, config, ... }:
{ {
services.nginx.virtualHosts."icecast.${config.domains.jim1}" = { services.nginx.virtualHosts."icecast.${config.domains.jim1}" = lib.mkIf services.icecast.enable {
enableACME = true; enableACME = true;
forceSSL = true; forceSSL = true;
locations."/" = { locations."/" = {

View file

@ -6,7 +6,7 @@
]; ];
mailserver = rec { mailserver = rec {
enable = config.system.mailserver.enable; enable = true;
domains = [ domains = [
"${config.domains.jim1}" "${config.domains.jim1}"
"${config.domains.jim2}" "${config.domains.jim2}"

View file

@ -0,0 +1,4 @@
{ ... }:
{
services.snowflake-proxy.enable = true;
}

View file

@ -1,7 +1,7 @@
{ config, ... }: { config, lib, ... }:
{ {
security = { security = lib.mkIf config.system.desktop.enable {
polkit.enable = config.system.desktop.enable; polkit.enable = true;
rtkit.enable = config.system.desktop.enable; rtkit.enable = true;
}; };
} }

View file

@ -1,6 +1,6 @@
{ ... }: { lib, config, ... }:
{ {
security.pam.loginLimits = [ security.pam.loginLimits = lib.mkIf config.system.desktop.enable [
{ {
domain = "@users"; domain = "@users";
item = "rtprio"; item = "rtprio";