Port perception over to nix

This commit is contained in:
Nathan McCarty 2022-05-13 22:11:39 -04:00
parent 53687f25c7
commit 078dcdc2a7
Signed by: thatonelutenist
GPG Key ID: D70DA3DD4D1E9F96
4 changed files with 168 additions and 1 deletions

View File

@ -151,6 +151,26 @@
] ++ serverModules; ] ++ serverModules;
}; };
perception = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
specialArgs = {
unstable = import nixpkgs-unstable {
config = { allowUnfree = true; };
overlays = [ ];
system = "x86_64-linux";
};
fenix = fenix.packages.x86_64-linux;
};
modules = [
./hardware/perception.nix
./machines/perception.nix
./home-linux.nix
./applications/devel-rust.nix
./modules/docker.nix
./system-specific/perception/plex.nix
] ++ serverModules;
};
x86vm = nixpkgs.lib.nixosSystem { x86vm = nixpkgs.lib.nixosSystem {
system = "x86_64-linux"; system = "x86_64-linux";
specialArgs = { specialArgs = {

63
hardware/perception.nix Normal file
View File

@ -0,0 +1,63 @@
# Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{
imports =
[
(modulesPath + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "xhci_pci" "ehci_pci" "ahci" "usbhid" "usb_storage" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" =
{
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=root" ];
};
fileSystems."/boot" =
{
device = "/dev/disk/by-uuid/68FE-F04C";
fsType = "vfat";
};
fileSystems."/nix" =
{
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=nix" ];
};
fileSystems."/var" =
{
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=var" ];
};
fileSystems."/home" =
{
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=home" ];
};
fileSystems."/etc" =
{
device = "/dev/disk/by-uuid/49959c20-a0d0-4b9b-b5bc-f7601640d252";
fsType = "btrfs";
options = [ "subvol=etc" ];
};
swapDevices =
[{ device = "/dev/disk/by-uuid/522c68bd-b23b-487d-80e3-fc41e2be130f"; }];
# high-resolution display
hardware.video.hidpi.enable = lib.mkDefault true;
}

53
machines/perception.nix Normal file
View File

@ -0,0 +1,53 @@
{ config, lib, pkgs, ... }:
{
networking = {
hostName = "perception";
domain = "mccarty.io";
useDHCP = false;
interfaces.eno1 = {
useDHCP = false;
ipv4.addresses = [
{
address = "10.0.0.11";
prefixLength = 21;
}
];
};
defaultGateway = "10.0.4.1";
nameservers = [ "10.0.0.10" ];
};
# Use the systemd-boot EFI boot loader.
boot.loader.systemd-boot.enable = true;
boot.loader.efi.canTouchEfiVariables = true;
# Trust ZT interface
networking.firewall.trustedInterfaces = [ "zt5u4uutwm" ];
# add plex nfs mount
fileSystems."/var/plex" = {
device = "10.0.0.139:/mnt/tank/root/data/plex";
fsType = "nfs";
};
fileSystems."/var/scratch" = {
device = "10.0.0.139:/mnt/tank/root/scratch";
fsType = "nfs";
};
# Enable sabnzbd
services.sabnzbd = {
enable = true;
};
# Enable sonarr
services.sonarr = {
enable = true;
};
# Open firewall ports
networking.firewall = {
enable = false;
allowedTCPPorts = [ 8080 8989 9383 ];
allowedUDPPorts = [ 8080 8989 9383 ];
};
}

View File

@ -0,0 +1,31 @@
{ config, pkgs, ... }:
{
services.plex =
let
myPlexRaw = pkgs.plexRaw.overrideAttrs (x:
let
# see https://www.plex.tv/media-server-downloads/ for 64bit rpm
version = "1.26.1.5798-99a4a6ac9";
hash = "sha256-Chu4IULIvkmfMEV0LSg50i6usZJZI3UWOgCHQakbhaY=";
in
{
name = "plex-${version}";
src = pkgs.fetchurl {
url = "https://downloads.plex.tv/plex-media-server-new/${version}/debian/plexmediaserver_${version}_amd64.deb";
inherit hash;
};
}
);
myPlex = pkgs.plex.override (x: { plexRaw = myPlexRaw; });
in
{
enable = true;
openFirewall = true;
dataDir = "/var/lib/plex";
user = "nathan";
group = "users";
package = myPlex;
};
services.tautulli.enable = true;
}