Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- { config, lib, pkgs, ... }: {
- containers.mediaplayers = {
- ephemeral = true;
- autoStart = true;
- bindMounts = {
- "/mnt/data/media" = {
- hostPath = "/mnt/data/media";
- isReadOnly = false;
- };
- "/dev/dri" = {
- hostPath = "/dev/dri";
- isReadOnly = false;
- };
- "/dev/nvidia0" = {
- hostPath = "/dev/nvidia0";
- isReadOnly = false;
- };
- "/dev/nvidiactl" = {
- hostPath = "/dev/nvidiactl";
- isReadOnly = false;
- };
- "/dev/nvidia-modeset" = {
- hostPath = "/dev/nvidia-modeset";
- isReadOnly = false;
- };
- "/dev/nvidia-uvm" = {
- hostPath = "/dev/nvidia-uvm";
- isReadOnly = false;
- };
- "/dev/nvidia-uvm-tools" = {
- hostPath = "/dev/nvidia-uvm-tools";
- isReadOnly = false;
- };
- "/dev/nvidia-caps/nvidia-cap1" = {
- hostPath = "/dev/nvidia-caps/nvidia-cap1";
- isReadOnly = false;
- };
- "/dev/nvidia-caps/nvidia-cap2" = {
- hostPath = "/dev/nvidia-caps/nvidia-cap2";
- isReadOnly = false;
- };
- "/run/opengl-driver" = {
- hostPath = "/run/opengl-driver";
- isReadOnly = false;
- };
- };
- extraFlags = [
- "--system-call-filter=@resources"
- "--system-call-filter=@system-service"
- "--capability=CAP_SYS_ADMIN"
- "--bind-ro=/sys/bus/pci/devices"
- ];
- privateNetwork = true;
- hostAddress = "192.168.100.2";
- localAddress = "192.168.100.33";
- config = { config, pkgs, ... }: {
- nixpkgs.config.allowUnfree = true;
- networking.firewall.enable = false;
- environment.systemPackages = with pkgs; [ audiobookshelf jellyfin ];
- hardware.graphics = { enable = true; };
- services.xserver.videoDrivers = [ "nvidia" ];
- hardware.nvidia = {
- modesetting.enable = true;
- powerManagement.enable = false;
- powerManagement.finegrained = false;
- open = false;
- package = config.boot.kernelPackages.nvidiaPackages.stable;
- };
- hardware.opengl = {
- enable = true;
- extraPackages = with pkgs; [ cudaPackages.cudatoolkit ];
- };
- users.users.**** = {
- isNormalUser = true;
- description = "****";
- uid = 1000;
- extraGroups = [ "networkmanager" "wheel" "video" "render" ];
- };
- # jellyfin
- # services.jellyfin = {
- # enable = true;
- # user = "methots";
- # group = "users";
- # dataDir = "/mnt/data/media/.config/jellyfin/data";
- # configDir = "/mnt/data/media/.config/jellyfin";
- # cacheDir = "/mnt/data/media/.config/jellyfin/cache";
- # };
- systemd.services.jellyfin = {
- description = "Jellyfin Media Server";
- after = [ "network-online.target" ];
- wants = [ "network-online.target" ];
- wantedBy = [ "multi-user.target" ];
- serviceConfig = {
- Type = "simple";
- User = "*****";
- Group = "users";
- UMask = "0077";
- WorkingDirectory = /mnt/data/media/.config/jellyfin/data;
- ExecStart =
- "${pkgs.jellyfin}/bin/jellyfin --datadir /mnt/data/media/.config/jellyfin/data --configdir /mnt/data/media/.config/jellyfin --cachedir /mnt/data/media/.config/jellyfin/cache --logdir /mnt/data/media/.config/jellyfin";
- Restart = "on-failure";
- TimeoutSec = 15;
- SuccessExitStatus = [ "0" "143" ];
- Environment =
- [ "NVIDIA_VISIBLE_DEVICES=all" "NVIDIA_DRIVER_CAPABILITIES=all" ];
- };
- };
- system.stateVersion = "24.11";
- };
- };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement