Updated graphics to support intel and nvidia (laptop gpu without prime)

Added immich

Updated cfile and smaller changes

Updated transfer-sh password
This commit is contained in:
Jurn Wubben 2025-04-17 17:59:44 +00:00
parent dd504716d3
commit c566589cc2
10 changed files with 419 additions and 46 deletions

View file

@ -1,16 +0,0 @@
{pkgs, ...}: {
hardware.graphics = {
enable = true;
enable32Bit = true;
extraPackages = with pkgs; [
libva
vaapiVdpau
libvdpau-va-gl
];
extraPackages32 = with pkgs.pkgsi686Linux; [
vaapiVdpau
libvdpau-va-gl
];
};
}

View file

@ -3,7 +3,7 @@
imports = [
./bluetooth.nix
./commonGraphics.nix
./graphics.nix
./fingerprint.nix
./fwupd.nix
];

View file

@ -0,0 +1,59 @@
{
config,
pkgs,
lib,
...
}: let
inherit (lib) optionals mkEnableOption mkDefault;
graphics = config.niksos.graphics;
enable = graphics.enable;
nvidia = graphics.enable && graphics.nvidia;
intel = graphics.enable && graphics.intel;
in {
options.niksos.graphics = {
enable = mkEnableOption "core graphics";
intel = mkEnableOption "additional intel drivers";
nvidia = mkEnableOption "additoinal nvidia drivers";
};
config = {
niksos.graphics.enable = mkDefault true;
hardware.graphics = {
inherit enable;
enable32Bit = enable;
extraPackages = with pkgs;
[
libva
vaapiVdpau
libvdpau-va-gl
]
++ optionals intel [
pkgs.intel-media-driver
]
++ optionals nvidia [
nvidia-vaapi-driver
];
extraPackages32 = with pkgs.pkgsi686Linux;
[
libva
vaapiVdpau
libvdpau-va-gl
]
++ optionals intel [
pkgs.pkgsi686Linux.intel-media-driver
]
++ optionals nvidia [
pkgs.pkgsi686Linux.nvidia-vaapi-driver
];
};
hardware.nvidia = {
modesetting.enable = nvidia;
open = false;
};
services.xserver.videoDrivers = optionals nvidia ["nvidia"];
};
}

View file

@ -1,4 +1,4 @@
{lib, ...}: {
imports = [./caddy.nix ./transfer-sh.nix ./seafile.nix ./bot.nix];
imports = [./caddy.nix ./transfer-sh.nix ./seafile.nix ./bot.nix ./immich.nix];
options.niksos.server = lib.mkEnableOption "server servcies (such as caddy)."; #TODO: per service option.
}

57
system/server/immich.nix Normal file
View file

@ -0,0 +1,57 @@
{config, lib, ...}: let
cfg = config.niksos.server;
in {
services.immich = {
enable = cfg;
port = 9002;
machine-learning.enable = false;
settings = {
server.externalDomain = "https://photos.jsw.tf";
ffmpeg = {
crf = 23;
threads = 0;
preset = "ultrafast";
targetVideoCodec = "h264";
acceptedVideoCodecs = [
"h264"
];
targetAudioCodec = "aac";
acceptedAudioCodecs = [
"aac"
"mp3"
"libopus"
"pcm_s16le"
];
acceptedContainers = [
"mov"
"ogg"
"webm"
];
targetResolution = "720";
maxBitrate = "0";
bframes = -1;
refs = 0;
gopSize = 0;
temporalAQ = false;
cqMode = "auto";
twoPass = false;
preferredHwDevice = lib.mkDefault "auto";
transcode = "all";
tonemap = "hable";
accel = lib.mkDefault "vaapi";
accelDecode = true;
};
};
accelerationDevices = lib.mkDefault null;
};
users.users.immich.extraGroups = lib.mkIf cfg ["video" "render"];
services.caddy.virtualHosts."photos.jsw.tf" = {
extraConfig = ''
reverse_proxy localhost:9002
'';
};
}

View file

@ -1,4 +1,9 @@
{config, inputs, pkgs, ...}:{
{
config,
inputs,
pkgs,
...
}: {
services.seafile = {
enable = config.niksos.server;
seahubPackage = inputs.nixpkgs-stable.legacyPackages.${pkgs.system}.seahub;
@ -10,21 +15,21 @@
ccnetSettings.General.SERVICE_URL = "https://files.jsw.tf";
seahubExtraConf = ''
ALLOWED_HOSTS = ['.files.jsw.tf']
CSRF_COOKIE_SECURE = True
CSRF_COOKIE_SAMESITE = 'Strict'
CSRF_TRUSTED_ORIGINS = ['https://files.jsw.tf', 'https://www.files.jsw.tf']
ALLOWED_HOSTS = ['.files.jsw.tf']
CSRF_COOKIE_SECURE = True
CSRF_COOKIE_SAMESITE = 'Strict'
CSRF_TRUSTED_ORIGINS = ['https://files.jsw.tf', 'https://www.files.jsw.tf']
SITE_NAME = "JSW Cloud"
SITE_TITLE = "JSW Cloud"
SITE_NAME = "JSW Cloud"
SITE_TITLE = "JSW Cloud"
'';
seafileSettings = {
quota.default = 30;
history.keep_days = 40;
library_trash.expire_days = 14;
fileserver = {
host = "unix:/run/seafile/server.sock";
web_token_expire_time = 14400; # 4 hours
host = "unix:/run/seafile/server.sock";
web_token_expire_time = 14400; # 4 hours
};
};
};
@ -32,12 +37,12 @@ SITE_TITLE = "JSW Cloud"
services.caddy.virtualHosts."files.jsw.tf" = {
# serverAliases = ["www.share.jsw.tf"];
extraConfig = ''
handle_path /seafhttp/* {
reverse_proxy * unix//run/seafile/server.sock
}
handle_path /* {
reverse_proxy * unix//run/seahub/gunicorn.sock
}
handle_path /seafhttp/* {
reverse_proxy * unix//run/seafile/server.sock
}
handle_path /* {
reverse_proxy * unix//run/seahub/gunicorn.sock
}
'';
};
}