2025-01-25 20:43:21 -05:00
|
|
|
|
# Edit this configuration file to define what should be installed on your system. Help is
|
|
|
|
|
# available in the configuration.nix(5) man page and in the NixOS manual (accessible by running
|
|
|
|
|
# nixos-help).
|
|
|
|
|
|
|
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
|
|
|
|
|
{
|
|
|
|
|
imports =
|
|
|
|
|
[ # Include the results of the hardware scan.
|
|
|
|
|
./hardware-configuration.nix
|
|
|
|
|
];
|
|
|
|
|
|
2025-01-26 17:42:45 -05:00
|
|
|
|
## This mounts the ZFS pool
|
|
|
|
|
boot.supportedFilesystems = [ "zfs" ];
|
|
|
|
|
boot.zfs.forceImportRoot = false;
|
|
|
|
|
networking.hostId = "1f72512b"; # head -c4 /dev/urandom | od -A none -t x4
|
|
|
|
|
|
2025-01-27 23:35:33 -05:00
|
|
|
|
##
|
|
|
|
|
## uncomment after formating disks
|
|
|
|
|
##
|
2025-01-25 20:43:21 -05:00
|
|
|
|
#fileSystems."/mnt/media" = {
|
2025-01-26 17:31:10 -05:00
|
|
|
|
# device = "media-pool";
|
2025-01-25 20:43:21 -05:00
|
|
|
|
# fsType = "zfs";
|
|
|
|
|
#};
|
2025-01-27 23:35:33 -05:00
|
|
|
|
#
|
2025-01-26 17:42:45 -05:00
|
|
|
|
## ZFS snapshots
|
|
|
|
|
#services.sanoid = {
|
|
|
|
|
# enable = true;
|
|
|
|
|
# templates.backup = {
|
|
|
|
|
# hourly = 36;
|
|
|
|
|
# daily = 30;
|
|
|
|
|
# monthly = 3;
|
|
|
|
|
# autoprune = true;
|
|
|
|
|
# autosnap = true;
|
|
|
|
|
# };
|
2025-01-27 23:35:33 -05:00
|
|
|
|
#
|
2025-01-26 17:42:45 -05:00
|
|
|
|
# datasets."media-pool" = {
|
|
|
|
|
# useTemplate = [ "backup" ];
|
|
|
|
|
# };
|
|
|
|
|
#};
|
2025-01-27 23:35:33 -05:00
|
|
|
|
#
|
2025-01-26 17:42:45 -05:00
|
|
|
|
#services.zfs.autoScrub = {
|
|
|
|
|
# enable = true;
|
|
|
|
|
# interval = "*-*-1,15 02:30";
|
|
|
|
|
#};
|
|
|
|
|
|
|
|
|
|
|
2025-01-25 20:43:21 -05:00
|
|
|
|
# Bootloader.
|
|
|
|
|
boot.loader.systemd-boot.enable = true;
|
|
|
|
|
boot.loader.efi.canTouchEfiVariables = true;
|
|
|
|
|
|
|
|
|
|
# makemkv fix
|
|
|
|
|
boot.initrd.kernelModules = [ "sg" ];
|
|
|
|
|
|
|
|
|
|
networking.hostName = "media-server"; # Define your hostname.
|
|
|
|
|
|
|
|
|
|
# Enable networking
|
|
|
|
|
networking.networkmanager.enable = true;
|
|
|
|
|
|
|
|
|
|
# Set your time zone.
|
|
|
|
|
time.timeZone = "America/New_York";
|
|
|
|
|
|
|
|
|
|
# Select internationalisation properties.
|
|
|
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
|
|
|
|
|
|
|
|
|
i18n.extraLocaleSettings = {
|
|
|
|
|
LC_ADDRESS = "en_US.UTF-8";
|
|
|
|
|
LC_IDENTIFICATION = "en_US.UTF-8";
|
|
|
|
|
LC_MEASUREMENT = "en_US.UTF-8";
|
|
|
|
|
LC_MONETARY = "en_US.UTF-8";
|
|
|
|
|
LC_NAME = "en_US.UTF-8";
|
|
|
|
|
LC_NUMERIC = "en_US.UTF-8";
|
|
|
|
|
LC_PAPER = "en_US.UTF-8";
|
|
|
|
|
LC_TELEPHONE = "en_US.UTF-8";
|
|
|
|
|
LC_TIME = "en_US.UTF-8";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# Configure keymap in X11
|
|
|
|
|
services.xserver.xkb = {
|
|
|
|
|
layout = "us";
|
|
|
|
|
};
|
|
|
|
|
|
2025-01-25 20:45:14 -05:00
|
|
|
|
# Define a user account. Don't forget to set a password with passwd.
|
2025-01-25 20:43:21 -05:00
|
|
|
|
programs.fish.enable = true;
|
|
|
|
|
users.users.arm = {
|
|
|
|
|
isNormalUser = true;
|
|
|
|
|
shell = pkgs.fish;
|
2025-01-25 20:45:14 -05:00
|
|
|
|
initialPassword = "changeme";
|
2025-01-25 20:43:21 -05:00
|
|
|
|
extraGroups = [ "wheel" "networkmanager" "audio" "video" "cdrom" "input" "docker" "render"];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# define Swap file
|
|
|
|
|
zramSwap.enable = true;
|
|
|
|
|
zramSwap.memoryPercent = 50;
|
|
|
|
|
|
|
|
|
|
# define jellyfin
|
|
|
|
|
services.jellyfin = {
|
|
|
|
|
enable = true;
|
|
|
|
|
};
|
|
|
|
|
# 1. enable vaapi on OS-level
|
|
|
|
|
nixpkgs.config.packageOverrides = pkgs: {
|
|
|
|
|
vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
|
|
|
|
|
};
|
|
|
|
|
hardware.graphics = {
|
|
|
|
|
enable = true;
|
|
|
|
|
extraPackages = with pkgs; [
|
|
|
|
|
intel-media-driver
|
|
|
|
|
intel-vaapi-driver # previously vaapiIntel
|
|
|
|
|
vaapiVdpau
|
|
|
|
|
libvdpau-va-gl
|
|
|
|
|
intel-compute-runtime # OpenCL filter support (hardware tonemapping and subtitle burn-in)
|
|
|
|
|
vpl-gpu-rt # QSV on 11th gen or newer
|
|
|
|
|
intel-media-sdk # QSV up to 11th gen
|
|
|
|
|
];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
# define docker containers
|
|
|
|
|
virtualisation.docker.enable = true;
|
|
|
|
|
virtualisation.oci-containers.backend = "docker";
|
|
|
|
|
virtualisation.oci-containers.containers = {
|
|
|
|
|
# define Channels DVR for Live TV
|
|
|
|
|
dvr = {
|
|
|
|
|
ports = ["8089:8089"];
|
|
|
|
|
autoStart = true;
|
|
|
|
|
extraOptions = ["--device=/dev/dri:/dev/dri"];
|
|
|
|
|
volumes = [
|
|
|
|
|
"/mnt/media/dvr-data:/channels-dvr"
|
|
|
|
|
"/mnt/media/dvr:/shares/DVR"
|
|
|
|
|
];
|
|
|
|
|
image = "fancybits/channels-dvr:tve";
|
|
|
|
|
};
|
|
|
|
|
# define Automatic Ripping Machine for importing TV shows, Movies, Music, and Data CDs and DVDs
|
|
|
|
|
arm = {
|
|
|
|
|
ports = ["8080:8080"];
|
|
|
|
|
autoStart = true;
|
|
|
|
|
volumes = [
|
|
|
|
|
"/mnt/media/arm:/home/arm"
|
|
|
|
|
"/mnt/media/arm/Music:/home/arm/Music"
|
|
|
|
|
"/mnt/media/arm/logs:/home/arm/logs"
|
|
|
|
|
"/mnt/media/arm/media:/home/arm/media"
|
|
|
|
|
"/mnt/media/arm/config:/etc/arm/config"
|
|
|
|
|
];
|
|
|
|
|
extraOptions = ["--device=/dev/sr0:/dev/sr0" "--privileged"];
|
|
|
|
|
environment = {
|
|
|
|
|
ARM_UID = "1000";
|
|
|
|
|
ARM_GID = "100";
|
|
|
|
|
};
|
|
|
|
|
image = "automaticrippingmachine/automatic-ripping-machine:latest";
|
|
|
|
|
};
|
|
|
|
|
# define youtube downloader for jellyfin
|
|
|
|
|
pinchflat = {
|
|
|
|
|
ports = ["8945:8945"];
|
|
|
|
|
autoStart = true;
|
|
|
|
|
volumes = [
|
|
|
|
|
"/mnt/media/yt-config:/config"
|
|
|
|
|
"/mnt/media/yt-downloads:/downloads"
|
|
|
|
|
];
|
|
|
|
|
image = "ghcr.io/kieraneglin/pinchflat:latest";
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
# Allow unfree packages
|
|
|
|
|
nixpkgs.config.allowUnfree = true;
|
2025-01-29 16:17:49 -05:00
|
|
|
|
nix.settings.experimental-features = [ "nix-command" "flakes" ];
|
2025-01-25 20:43:21 -05:00
|
|
|
|
# adding packaegs
|
|
|
|
|
environment.systemPackages = [
|
|
|
|
|
pkgs.jellyfin
|
|
|
|
|
pkgs.jellyfin-web
|
|
|
|
|
pkgs.jellyfin-ffmpeg
|
|
|
|
|
# cli tools
|
|
|
|
|
pkgs.btop
|
2025-01-28 16:46:43 -05:00
|
|
|
|
pkgs.git
|
|
|
|
|
(import ./format-zfs-pool.nix { inherit pkgs; })
|
2025-01-25 20:43:21 -05:00
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
# Some programs need SUID wrappers, can be configured further or are
|
|
|
|
|
# started in user sessions.
|
|
|
|
|
# programs.mtr.enable = true;
|
|
|
|
|
# programs.gnupg.agent = {
|
|
|
|
|
# enable = true;
|
|
|
|
|
# enableSSHSupport = true;
|
|
|
|
|
# };
|
|
|
|
|
|
|
|
|
|
# Enable the OpenSSH daemon.
|
|
|
|
|
services.openssh.enable = true;
|
|
|
|
|
|
|
|
|
|
# Open ports in the firewall.
|
|
|
|
|
networking.firewall.allowedTCPPorts = [
|
|
|
|
|
8080
|
|
|
|
|
8089
|
|
|
|
|
8096
|
|
|
|
|
22
|
|
|
|
|
];
|
|
|
|
|
# networking.firewall.allowedUDPPorts = [ ... ];
|
|
|
|
|
# Or disable the firewall altogether.
|
|
|
|
|
networking.firewall.enable = true;
|
|
|
|
|
|
|
|
|
|
# This value determines the NixOS release from which the default
|
|
|
|
|
# settings for stateful data, like file locations and database versions
|
|
|
|
|
# on your system were taken. It‘s perfectly fine and recommended to leave
|
|
|
|
|
# this value at the release version of the first install of this system.
|
|
|
|
|
# Before changing this value read the documentation for this option
|
|
|
|
|
# (e.g. man configuration.nix or on https://nixos.org/nixos/options.html).
|
|
|
|
|
system.stateVersion = "24.11"; # Did you read the comment?
|
|
|
|
|
|
|
|
|
|
}
|