server: do stuff
This commit is contained in:
@@ -29,6 +29,10 @@
|
|||||||
# Extras
|
# Extras
|
||||||
tangled.url = "git+https://tangled.sh/@tangled.sh/core";
|
tangled.url = "git+https://tangled.sh/@tangled.sh/core";
|
||||||
vscode-server.url = "github:nix-community/nixos-vscode-server";
|
vscode-server.url = "github:nix-community/nixos-vscode-server";
|
||||||
|
spacebar = {
|
||||||
|
url = "github:spacebarchat/server";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Required by NixOS:
|
# Required by NixOS:
|
||||||
|
|||||||
@@ -1,84 +1,109 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
imports = [
|
imports = [
|
||||||
./modules/atproto-pds.nix
|
./modules/atproto-pds.nix
|
||||||
./modules/cloudflare.nix
|
./modules/cloudflare.nix
|
||||||
./modules/tangled.nix
|
./modules/tangled.nix
|
||||||
../../modules/force.nix
|
../../modules/force.nix
|
||||||
];
|
./modules/gitea.nix
|
||||||
|
./modules/spacebar.nix
|
||||||
|
];
|
||||||
|
|
||||||
# gcc. shit breaks. wtf
|
# gcc. shit breaks. wtf
|
||||||
environment.sessionVariables.LD_LIBRARY_PATH = "${pkgs.gcc15}/lib";
|
environment.sessionVariables.LD_LIBRARY_PATH = "${pkgs.gcc15}/lib";
|
||||||
|
|
||||||
services.vscode-server.enable = true;
|
services.vscode-server.enable = true;
|
||||||
|
|
||||||
systemd.services.ocbwoy3-start-pm2 = {
|
systemd.services.ocbwoy3-start-pm2 = {
|
||||||
enable = true;
|
enable = true;
|
||||||
description = "Start PM2";
|
description = "Start PM2";
|
||||||
after = [ "network.target" ];
|
after = [ "network.target" ];
|
||||||
wantedBy = [ "multi-user.target" ];
|
wantedBy = [ "multi-user.target" ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "forking";
|
Type = "forking";
|
||||||
User = "ocbwoy3";
|
User = "ocbwoy3";
|
||||||
LimitNOFILE = "infinity";
|
LimitNOFILE = "infinity";
|
||||||
LimitNPROC = "infinity";
|
LimitNPROC = "infinity";
|
||||||
LimitCORE = "infinity";
|
LimitCORE = "infinity";
|
||||||
Environment = "PM2_HOME=/home/ocbwoy3/.pm2";
|
Environment = "PM2_HOME=/home/ocbwoy3/.pm2";
|
||||||
PIDFile = "/home/ocbwoy3/.pm2/pm2.pid";
|
PIDFile = "/home/ocbwoy3/.pm2/pm2.pid";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
|
||||||
ExecStart = "${pkgs.pm2}/bin/pm2 resurrect";
|
ExecStart = "${pkgs.pm2}/bin/pm2 resurrect";
|
||||||
ExecReload = "${pkgs.pm2}/bin/pm2 reload all";
|
ExecReload = "${pkgs.pm2}/bin/pm2 reload all";
|
||||||
ExecStop = "${pkgs.pm2}/bin/pm2 kill";
|
ExecStop = "${pkgs.pm2}/bin/pm2 kill";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.openssh.settings = {
|
services.openssh.settings = {
|
||||||
PubkeyAuthentication = "yes";
|
PubkeyAuthentication = "yes";
|
||||||
TrustedUserCAKeys = "/etc/ssh/ca.pub";
|
TrustedUserCAKeys = "/etc/ssh/ca.pub";
|
||||||
};
|
};
|
||||||
|
|
||||||
services.openssh = {
|
services.openssh = {
|
||||||
enable = lib.mkForce true;
|
enable = lib.mkForce true;
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
fastfetch
|
fastfetch
|
||||||
hyfetch
|
hyfetch
|
||||||
pm2
|
pm2
|
||||||
steam-run
|
steam-run
|
||||||
];
|
];
|
||||||
|
|
||||||
users.users.ocbwoy3 = {
|
users.users.ocbwoy3 = {
|
||||||
initialPassword = "thisisapassword42069!"; # not the type passwords i use
|
initialPassword = "thisisapassword42069!"; # not the type passwords i use
|
||||||
isNormalUser = true;
|
isNormalUser = true;
|
||||||
extraGroups = [ "wheel" "networkmanager" ];
|
extraGroups = [
|
||||||
shell = pkgs.zsh;
|
"wheel"
|
||||||
};
|
"networkmanager"
|
||||||
|
];
|
||||||
|
shell = pkgs.zsh;
|
||||||
|
};
|
||||||
|
|
||||||
virtualisation.docker.enable = true;
|
virtualisation.docker.enable = true;
|
||||||
|
|
||||||
services.mongodb = {
|
services.mongodb = {
|
||||||
enable = true;
|
enable = true;
|
||||||
enableAuth = false;
|
enableAuth = false;
|
||||||
package = pkgs.mongodb-ce;
|
package = pkgs.mongodb-ce;
|
||||||
replSetName = "rs0"; # dangerous
|
replSetName = "rs0"; # dangerous
|
||||||
bind_ip = "0.0.0.0";
|
bind_ip = "0.0.0.0";
|
||||||
};
|
};
|
||||||
|
|
||||||
networking.firewall = {
|
networking.firewall = {
|
||||||
enable = true;
|
enable = true;
|
||||||
allowedTCPPorts = [ 22 443 3000 3001 8080 25565 ];
|
allowedTCPPorts = [
|
||||||
allowedUDPPorts = [ 22 443 3000 3001 8080 25565 ];
|
22
|
||||||
};
|
443
|
||||||
|
3000
|
||||||
|
3001
|
||||||
|
8080
|
||||||
|
25565
|
||||||
|
];
|
||||||
|
allowedUDPPorts = [
|
||||||
|
22
|
||||||
|
443
|
||||||
|
3000
|
||||||
|
3001
|
||||||
|
8080
|
||||||
|
25565
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
catppuccin = {
|
catppuccin = {
|
||||||
enable = true;
|
enable = true;
|
||||||
flavor = "mocha";
|
flavor = "mocha";
|
||||||
accent = "blue";
|
accent = "blue";
|
||||||
};
|
gitea.enable = false;
|
||||||
|
};
|
||||||
|
|
||||||
system.stateVersion = "23.05"; # DO NOT TOUCH
|
system.stateVersion = "23.05"; # DO NOT TOUCH
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,26 +1,31 @@
|
|||||||
{ config, inputs, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
# Upload PDS backup to /var/lib/pds
|
# Upload PDS backup to /var/lib/pds
|
||||||
# and specify secrets in /private/atproto-pds.env
|
# and specify secrets in /private/atproto-pds.env
|
||||||
|
|
||||||
services.bluesky-pds = {
|
services.bluesky-pds = {
|
||||||
enable = true;
|
enable = true;
|
||||||
pdsadmin.enable = true;
|
pdsadmin.enable = true;
|
||||||
environmentFiles = [ "/private/atproto-pds.env" ];
|
environmentFiles = [ "/private/atproto-pds.env" ];
|
||||||
settings = {
|
settings = {
|
||||||
PDS_CRAWLERS = "https://bsky.network";
|
PDS_CRAWLERS = "https://bsky.network";
|
||||||
LOG_ENABLED = "true";
|
LOG_ENABLED = "true";
|
||||||
PDS_HOSTNAME = "pds.ocbwoy3.dev";
|
PDS_HOSTNAME = "pds.ocbwoy3.dev";
|
||||||
# PDS_VERSION = "\"ATProto PDS v69420\"";
|
# PDS_VERSION = "\"ATProto PDS v69420\"";
|
||||||
PDS_DID_PLC_URL = "https://plc.directory";
|
PDS_DID_PLC_URL = "https://plc.directory";
|
||||||
PDS_CONTACT_EMAIL_ADDRESS = "ocbwoy3@ocbwoy3.dev";
|
PDS_CONTACT_EMAIL_ADDRESS = "ocbwoy3@ocbwoy3.dev";
|
||||||
PDS_PRIVACY_POLICY_URL = "https://ocbwoy3.dev";
|
PDS_PRIVACY_POLICY_URL = "https://ocbwoy3.dev";
|
||||||
PDS_TERMS_OF_SERVICE_URL = "https://ocbwoy3.dev";
|
PDS_TERMS_OF_SERVICE_URL = "https://ocbwoy3.dev";
|
||||||
PDS_ACCEPTING_REPO_IMPORTS = "true";
|
PDS_ACCEPTING_REPO_IMPORTS = "true";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,26 @@
|
|||||||
{ config, inputs, pkgs, ... }:
|
{
|
||||||
|
config,
|
||||||
|
inputs,
|
||||||
|
pkgs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
environment.systemPackages = with pkgs; [
|
environment.systemPackages = with pkgs; [
|
||||||
cloudflared
|
cloudflared
|
||||||
];
|
];
|
||||||
|
|
||||||
# lib.mkIf (isOCbwoy3 == true)
|
# lib.mkIf (isOCbwoy3 == true)
|
||||||
services.cloudflared = {
|
services.cloudflared = {
|
||||||
enable = true;
|
enable = true;
|
||||||
tunnels = {
|
tunnels = {
|
||||||
"selfhost" = {
|
"selfhost" = {
|
||||||
# 2f83f704-e9f7-49fb-a6c4-d4a8f85d87e4
|
# 2f83f704-e9f7-49fb-a6c4-d4a8f85d87e4
|
||||||
default = "http_status:404";
|
default = "http_status:404";
|
||||||
credentialsFile = "/private/cloudflared/selfhost.json";
|
credentialsFile = "/private/cloudflared/selfhost.json";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
34
hosts/server/modules/gitea.nix
Normal file
34
hosts/server/modules/gitea.nix
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
services.gitea = {
|
||||||
|
enable = true;
|
||||||
|
|
||||||
|
database = {
|
||||||
|
type = "postgres";
|
||||||
|
};
|
||||||
|
|
||||||
|
settings = {
|
||||||
|
server = {
|
||||||
|
DOMAIN = "git.ocbwoy3.dev";
|
||||||
|
ROOT_URL = "https://git.ocbwoy3.dev/";
|
||||||
|
HTTP_PORT = 2222;
|
||||||
|
DISABLE_SSH = true;
|
||||||
|
MAX_UPLOAD_FILE_SIZE = 5242880;
|
||||||
|
};
|
||||||
|
|
||||||
|
attachment = {
|
||||||
|
MAX_SIZE = 5; # MB (this is the one causing the 1024 KiB error)
|
||||||
|
};
|
||||||
|
|
||||||
|
service = {
|
||||||
|
DISABLE_REGISTRATION = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
17
hosts/server/modules/spacebar.nix
Normal file
17
hosts/server/modules/spacebar.nix
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
config,
|
||||||
|
lib,
|
||||||
|
pkgs,
|
||||||
|
inputs,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
|
{
|
||||||
|
imports = [ inputs.spacebar.nixosModules.default ];
|
||||||
|
|
||||||
|
services.spacebarchat-server = {
|
||||||
|
enable = true;
|
||||||
|
package = inputs.spacebar.packages.${pkgs.stdenv.hostPlatform.system}.default;
|
||||||
|
extraEnvironment.PORT = 4067;
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -1,21 +1,26 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
services.tangled-knot = {
|
services.tangled.knot = {
|
||||||
enable = true;
|
enable = true;
|
||||||
server = {
|
server = {
|
||||||
listenAddr = "0.0.0.0:3003";
|
listenAddr = "0.0.0.0:3003";
|
||||||
owner = "did:plc:s7cesz7cr6ybltaryy4meb6y";
|
owner = "did:plc:s7cesz7cr6ybltaryy4meb6y";
|
||||||
hostname = "knot.ocbwoy3.dev";
|
hostname = "knot.ocbwoy3.dev";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.tangled-spindle = {
|
services.tangled.spindle = {
|
||||||
enable = true;
|
enable = true;
|
||||||
server = {
|
server = {
|
||||||
listenAddr = "0.0.0.0:3004";
|
listenAddr = "0.0.0.0:3004";
|
||||||
owner = "did:plc:s7cesz7cr6ybltaryy4meb6y";
|
owner = "did:plc:s7cesz7cr6ybltaryy4meb6y";
|
||||||
hostname = "spindle.ocbwoy3.dev";
|
hostname = "spindle.ocbwoy3.dev";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,63 +1,75 @@
|
|||||||
{ config, pkgs, lib, ... }:
|
{
|
||||||
|
config,
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
# options nvidia NVreg_PreserveVideoMemoryAllocations=1
|
# options nvidia NVreg_PreserveVideoMemoryAllocations=1
|
||||||
boot.extraModprobeConfig = ''
|
boot.extraModprobeConfig = ''
|
||||||
options nvidia_drm modeset=1 fbdev=1
|
options nvidia_drm modeset=1 fbdev=1
|
||||||
'';
|
'';
|
||||||
|
|
||||||
environment.variables = {
|
environment.variables = {
|
||||||
LIBVA_DRIVER_NAME = "nvidia";
|
LIBVA_DRIVER_NAME = "nvidia";
|
||||||
GBM_BACKEND = "nvidia-drm";
|
GBM_BACKEND = "nvidia-drm";
|
||||||
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
||||||
NVD_BACKEND = "direct";
|
NVD_BACKEND = "direct";
|
||||||
EGL_PLATFORM = "wayland";
|
EGL_PLATFORM = "wayland";
|
||||||
VDPAU_DRIVER = "va_gl";
|
VDPAU_DRIVER = "va_gl";
|
||||||
WAYLAND_DISPLAY = "wayland-1";
|
WAYLAND_DISPLAY = "wayland-1";
|
||||||
DISPLAY = ":0";
|
DISPLAY = ":0";
|
||||||
XDG_CURRENT_DESKTOP = "Hyprland";
|
XDG_CURRENT_DESKTOP = "Hyprland";
|
||||||
MOZ_ENABLE_WAYLAND = "1"; # Enable Wayland for Firefox
|
MOZ_ENABLE_WAYLAND = "1"; # Enable Wayland for Firefox
|
||||||
CHROMIUM_FLAGS = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-gpu-rasterization --enable-zero-copy"; # Enable Wayland and hardware acceleration for Chromium
|
CHROMIUM_FLAGS = "--enable-features=UseOzonePlatform --ozone-platform=wayland --enable-gpu-rasterization --enable-zero-copy"; # Enable Wayland and hardware acceleration for Chromium
|
||||||
};
|
};
|
||||||
|
|
||||||
environment.sessionVariables = {
|
environment.sessionVariables = {
|
||||||
NIXOS_OZONE_WL = 1;
|
NIXOS_OZONE_WL = 1;
|
||||||
LIBVA_DRIVER_NAME = "nvidia";
|
LIBVA_DRIVER_NAME = "nvidia";
|
||||||
GBM_BACKEND = "nvidia-drm";
|
GBM_BACKEND = "nvidia-drm";
|
||||||
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
__GLX_VENDOR_LIBRARY_NAME = "nvidia";
|
||||||
NVD_BACKEND = "direct";
|
NVD_BACKEND = "direct";
|
||||||
EGL_PLATFORM = "wayland";
|
EGL_PLATFORM = "wayland";
|
||||||
};
|
};
|
||||||
|
|
||||||
# obs moment
|
# obs moment
|
||||||
# nixpkgs.config.cudaSupport = true;
|
# nixpkgs.config.cudaSupport = true;
|
||||||
|
|
||||||
hardware.graphics = { # hardware.graphics since NixOS 24.11
|
hardware.graphics = {
|
||||||
enable = true;
|
# hardware.graphics since NixOS 24.11
|
||||||
# driSupport = true;
|
enable = true;
|
||||||
extraPackages = with pkgs; [
|
# driSupport = true;
|
||||||
nvidia-vaapi-driver
|
extraPackages = with pkgs; [
|
||||||
libvdpau-va-gl
|
nvidia-vaapi-driver
|
||||||
vaapiVdpau
|
libvdpau-va-gl
|
||||||
libvdpau
|
libva-vdpau-driver
|
||||||
];
|
libvdpau
|
||||||
};
|
];
|
||||||
|
};
|
||||||
|
|
||||||
hardware.nvidia = {
|
hardware.nvidia = {
|
||||||
modesetting.enable = true;
|
modesetting.enable = true;
|
||||||
powerManagement.enable = false;
|
powerManagement.enable = false;
|
||||||
powerManagement.finegrained = false;
|
powerManagement.finegrained = false;
|
||||||
open = true;
|
open = true;
|
||||||
nvidiaSettings = true;
|
nvidiaSettings = true;
|
||||||
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
package = config.boot.kernelPackages.nvidiaPackages.beta;
|
||||||
};
|
};
|
||||||
|
|
||||||
boot.kernelModules = [ "nvidia-uvm" "nvidia-drm" ];
|
boot.kernelModules = [
|
||||||
boot.blacklistedKernelModules = [ "nouveau" ];
|
"nvidia-uvm"
|
||||||
|
"nvidia-drm"
|
||||||
|
];
|
||||||
|
boot.blacklistedKernelModules = [ "nouveau" ];
|
||||||
|
|
||||||
boot.kernelParams = [ "nvidia-drm.modeset=1" "nvidia-drm.fbdev=1" ];
|
boot.kernelParams = [
|
||||||
|
"nvidia-drm.modeset=1"
|
||||||
|
"nvidia-drm.fbdev=1"
|
||||||
|
];
|
||||||
|
|
||||||
services.xserver.videoDrivers = ["nvidia"];
|
services.xserver.videoDrivers = [ "nvidia" ];
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user