I guess i forgot to add networking

This commit is contained in:
botalex 2025-08-15 21:53:02 +02:00
parent f358915432
commit d022103d82
18 changed files with 528 additions and 77 deletions

31
modules/de.nix Normal file
View file

@ -0,0 +1,31 @@
{pkgs, ...}:{
# Enable the X11 windowing system.
services.xserver.enable = true;
# Enable the XFCE Desktop Environment.
services.xserver.displayManager.lightdm.enable = true;
services.xserver.desktopManager.xfce.enable = true;
# Enable touchpad support (enabled default in most desktopManager).
services.xserver.libinput.enable = true;
# Enable automatic login for the user.
services.displayManager.autoLogin.enable = true;
services.displayManager.autoLogin.user = "botserver";
# Enable sound with pipewire.
services.pulseaudio.enable = false;
security.rtkit.enable = true;
services.pipewire = {
enable = true;
alsa.enable = true;
alsa.support32Bit = true;
pulse.enable = true;
# If you want to use JACK applications, uncomment this
#jack.enable = true;
# use the example session manager (no others are packaged yet so this is enabled by default,
# no need to redefine it in your config for now)
#media-session.enable = true;
};
}

44
modules/displayOff.nix Normal file
View file

@ -0,0 +1,44 @@
{ config, pkgs, ... }:
{
systemd.services.blank-tty1 = {
description = "Blank the active console (defaults to tty1)";
wants = [ "getty@tty1.service" ];
after = [ "getty@tty1.service" ];
unitConfig.ConditionPathExists = "/dev/tty1";
# Put `setterm` in PATH
path = [ pkgs.kbd ];
serviceConfig = {
Type = "oneshot";
};
# Do exactly what worked for you, with a small fallback
script = ''
set -e
# Prefer the active VT if available; otherwise use tty1
TTY="$(cat /sys/class/tty/tty0/active 2>/dev/null || echo tty1)"
# Try setterm on that TTY (same redirections as your manual command)
if ! setterm --term linux --blank force </dev/"$TTY" >/dev/"$TTY" 2>/dev/null; then
# Fallback: ask the framebuffer to blank (driver-dependent)
for fb in /sys/class/graphics/fb*/blank; do
[ -w "$fb" ] && echo 1 > "$fb" && break
done
fi
'';
};
systemd.timers.blank-tty1 = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnActiveSec = "30s"; # 30s after the timer is activated at boot
AccuracySec = "1s";
Persistent = true;
Unit = "blank-tty1.service";
};
};
}

View file

@ -0,0 +1,66 @@
{
config,
pkgs,
lib,
...
}: {
nixpkgs.config.nvidia.acceptLicense = true;
services.xserver.videoDrivers = ["nvidia"];
boot.kernelParams = ["nvidia.NVreg_PreserveVideoMemoryAllocations=1"];
hardware.graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
nvidia-vaapi-driver
];
};
hardware.nvidia = {
package = config.boot.kernelPackages.nvidiaPackages.stable;
modesetting.enable = true;
open = false;
nvidiaSettings = true;
dynamicBoost.enable = false;
powerManagement = {
enable = true;
finegrained = true;
};
prime = {
sync.enable = false;
intelBusId = "PCI:0:2:0";
nvidiaBusId = "PCI:1:0:0";
offload = {
enable = true;
enableOffloadCmd = true;
};
};
};
specialisation = {
Battery.configuration = {
system.nixos.tags = ["Battery"];
boot.extraModprobeConfig = ''
blacklist nouveau
options nouveau modeset=0
'';
services.udev.extraRules = ''
# Remove NVIDIA USB xHCI Host Controller devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA USB Type-C UCSI devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA Audio devices, if present
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1"
# Remove NVIDIA VGA/3D controller devices
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1"
'';
boot.blacklistedKernelModules = ["nouveau" "nvidia" "nvidia_drm" "nvidia_modeset"];
};
};
}

6
modules/fishShell.nix Normal file
View file

@ -0,0 +1,6 @@
{pkgs, ...} : {
programs.fish.enable = true;
documentation.man.generateCaches = false;
users.users."botserver".shell = pkgs.fish;
}

44
modules/lowGPU.nix Normal file
View file

@ -0,0 +1,44 @@
{ config, pkgs, ... }:
{
systemd.services.blank-tty1 = {
description = "Blank the active console (defaults to tty1)";
wants = [ "getty@tty1.service" ];
after = [ "getty@tty1.service" ];
unitConfig.ConditionPathExists = "/dev/tty1";
# Put `setterm` in PATH
path = [ pkgs.kbd ];
serviceConfig = {
Type = "oneshot";
};
# Do exactly what worked for you, with a small fallback
script = ''
set -e
# Prefer the active VT if available; otherwise use tty1
TTY="$(cat /sys/class/tty/tty0/active 2>/dev/null || echo tty1)"
# Try setterm on that TTY (same redirections as your manual command)
if ! setterm --term linux --blank force </dev/"$TTY" >/dev/"$TTY" 2>/dev/null; then
# Fallback: ask the framebuffer to blank (driver-dependent)
for fb in /sys/class/graphics/fb*/blank; do
[ -w "$fb" ] && echo 1 > "$fb" && break
done
fi
'';
};
systemd.timers.blank-tty1 = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnActiveSec = "30s"; # 30s after the timer is activated at boot
AccuracySec = "1s";
Persistent = true;
Unit = "blank-tty1.service";
};
};
}

8
modules/nodejs.nix Normal file
View file

@ -0,0 +1,8 @@
{ pkgs, ... }:
{
environment.systemPackages = with pkgs; [
nodejs_22
nodePackages.live-server
nodePackages.serve
];
}

View file

@ -97,10 +97,17 @@ in
extraLuaPackages = ls: with ls; [ luarocks ];
};
xdg.configFile."nvim".source = pkgs.fetchFromGitHub {
owner = "MagicBOTAlex";
repo = "NVimConfigs";
rev = "2927ce8e62e47b0b542ae18623cb6dbee6c32add";
hash = "sha256-f45NJYaiBLAQ9RmjzEPzI6LBrlj/vdA+ONkdRAzAIjQ=";
# Screw declarative here
xdg.configFile."nvim".source = builtins.fetchGit {
url = "https://github.com/MagicBOTAlex/NVimConfigs";
ref = "master"; # change if the default branch is different
# submodules = true; # uncomment if needed
};
# xdg.configFile."nvim".source = pkgs.fetchFromGitHub {
# owner = "MagicBOTAlex";
# repo = "NVimConfigs";
# rev = "2927ce8e62e47b0b542ae18623cb6dbee6c32add";
# hash = "sha256-f45NJYaiBLAQ9RmjzEPzI6LBrlj/vdA+ONkdRAzAIjQ=";
# };
}

13
modules/python.nix Normal file
View file

@ -0,0 +1,13 @@
{pkgs, ...}: {
environment.systemPackages = with pkgs; [
# ...
(python3.withPackages (python-pkgs: with python-pkgs; [
pandas
requests
spotipy
python-dotenv
fastapi
uvicorn
]))
];
}