Add configuration.nix

This commit is contained in:
batvin321 2025-01-25 20:43:21 -05:00
parent fef073b8b5
commit f087e78aae

175
configuration.nix Normal file
View File

@ -0,0 +1,175 @@
# 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
];
# This mounts the ZFS pool
#fileSystems."/mnt/media" = {
# device = "zpool_name";
# fsType = "zfs";
#};
# 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";
};
# Define a user account. Don't forget to set a password with passwd.
programs.fish.enable = true;
users.users.arm = {
isNormalUser = true;
shell = pkgs.fish;
initialHashedPassword = "$y$j9T$0PPbSXGEwyGq6ZFvJMhmE/$D5ZlKOwR/4NCDD8eaxWiQiG1TTRSK4PfbQe/Tm60Id/";
extraGroups = [ "wheel" "networkmanager" "audio" "video" "cdrom" "input" "docker" "render"];
};
# define Swap file
zramSwap.enable = true;
zramSwap.memoryPercent = 50;
# define jellyfin
services.jellyfin = {
enable = true;
openFirewall = 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;
# adding packaegs
environment.systemPackages = [
pkgs.jellyfin
pkgs.jellyfin-web
pkgs.jellyfin-ffmpeg
# cli tools
pkgs.btop
];
# 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. Its 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?
}