feat: migrate home-server to LattePanda 3 Delta

This commit is contained in:
Felix Schröter 2022-08-03 03:15:06 +02:00
parent 9fbea3db5c
commit 9693e762df
Signed by: felschr
GPG key ID: 671E39E6744C807D
10 changed files with 112 additions and 42 deletions

View file

@ -142,12 +142,11 @@
}; };
nixosConfigurations.home-server = nixpkgs.lib.nixosSystem { nixosConfigurations.home-server = nixpkgs.lib.nixosSystem {
system = "aarch64-linux"; system = "x86_64-linux";
modules = [ modules = [
nixpkgs.nixosModules.notDetected nixpkgs.nixosModules.notDetected
nixos-hardware.nixosModules.raspberry-pi-4
(lib.createSystem "home-server" { (lib.createSystem "home-server" {
hardwareConfig = ./hardware/rpi4.nix; hardwareConfig = ./hardware/lattepanda.nix;
config = ./home-server.nix; config = ./home-server.nix;
}) })
lib.createMediaGroup lib.createMediaGroup
@ -168,7 +167,7 @@
hostname = "192.168.1.102"; hostname = "192.168.1.102";
profiles.system = { profiles.system = {
user = "felschr"; user = "felschr";
path = deploy-rs.lib.aarch64-linux.activate.nixos path = deploy-rs.lib.x86_64-linux.activate.nixos
self.nixosConfigurations.home-server; self.nixosConfigurations.home-server;
}; };
}; };

View file

@ -10,10 +10,4 @@
services.smartd.enable = true; services.smartd.enable = true;
services.smartd.notifications.x11.enable = true; services.smartd.notifications.x11.enable = true;
# Bluetooth
hardware.bluetooth.enable = true;
hardware.bluetooth.settings = {
General = { Enable = "Source,Sink,Media,Socket"; };
};
} }

8
hardware/bluetooth.nix Normal file
View file

@ -0,0 +1,8 @@
{ config, lib, pkgs, ... }:
{
hardware.bluetooth.enable = true;
hardware.bluetooth.settings = {
General = { Enable = "Source,Sink,Media,Socket"; };
};
}

View file

@ -1,13 +1,22 @@
{ config, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
hardware.opengl = { boot.initrd.kernelModules = [ "i915" ];
driSupport32Bit = true;
extraPackages = with pkgs; [ vaapiIntel vaapiVdpau libvdpau-va-gl ]; nixpkgs.config.packageOverrides = pkgs: {
extraPackages32 = with pkgs.pkgsi686Linux; [ vaapiIntel = pkgs.vaapiIntel.override { enableHybridCodec = true; };
vaapiIntel
libvdpau-va-gl
vaapiVdpau
];
}; };
environment.variables = {
VDPAU_DRIVER =
lib.mkIf config.hardware.opengl.enable (lib.mkDefault "va_gl");
};
hardware.opengl.extraPackages = with pkgs; [
vaapiIntel
vaapiVdpau
libvdpau-va-gl
intel-media-driver
intel-compute-runtime
];
} }

69
hardware/lattepanda.nix Normal file
View file

@ -0,0 +1,69 @@
{ config, lib, pkgs, modulesPath, ... }:
{
boot.initrd.availableKernelModules = [
"xhci_pci"
"ahci"
"nvme"
"usbhid"
"usb_storage"
"sd_mod"
"sdhci_pci"
"rtsx_usb_sdmmc"
];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
fileSystems."/" = {
device = "/dev/disk/by-uuid/70f03d67-e248-42f6-a204-c02e4f180531";
fsType = "btrfs";
options = [ "subvol=@" "compress-force=zstd:1" "noatime" ];
};
boot.initrd.luks.devices."enc".device =
"/dev/disk/by-uuid/d3b12d0e-7e8e-4130-9a8f-680abcdc9682";
fileSystems."/home" = {
device = "/dev/disk/by-uuid/70f03d67-e248-42f6-a204-c02e4f180531";
fsType = "btrfs";
options = [ "subvol=@home" "compress-force=zstd:1" "noatime" ];
};
fileSystems."/.swap" = {
device = "/dev/disk/by-uuid/70f03d67-e248-42f6-a204-c02e4f180531";
fsType = "btrfs";
options = [ "subvol=@swap" "nodatacow" "noatime" ];
neededForBoot = true;
};
fileSystems."/.snapshots" = {
device = "/dev/disk/by-uuid/70f03d67-e248-42f6-a204-c02e4f180531";
fsType = "btrfs";
options = [ "subvol=@snapshots" "compress-force=zstd:1" "noatime" ];
};
fileSystems."/boot" = {
device = "/dev/disk/by-uuid/95FC-D4E5";
fsType = "vfat";
};
swapDevices = [{
device = "/.swap/swapfile";
size = 8096;
}];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking.useDHCP = lib.mkDefault true;
# networking.interfaces.enp2s0.useDHCP = lib.mkDefault true;
# networking.interfaces.wlo1.useDHCP = lib.mkDefault true;
powerManagement.cpuFreqGovernor = lib.mkDefault "powersave";
hardware.cpu.intel.updateMicrocode =
lib.mkDefault config.hardware.enableRedistributableFirmware;
# high-resolution display
hardware.video.hidpi.enable = lib.mkDefault true;
}

View file

@ -4,6 +4,7 @@
imports = [ imports = [
./hardware/base.nix ./hardware/base.nix
./hardware/gpu-amd.nix ./hardware/gpu-amd.nix
./hardware/bluetooth.nix
./hardware/steam.nix ./hardware/steam.nix
./hardware/ledger.nix ./hardware/ledger.nix
./system/desktop.nix ./system/desktop.nix

View file

@ -10,8 +10,8 @@ let
}]; }];
in with builtins; { in with builtins; {
imports = [ imports = [
# ./hardware/base.nix ./hardware/base.nix
./hardware/gpu-rpi4.nix ./hardware/gpu-intel.nix
./system/server.nix ./system/server.nix
./modules/emailNotify.nix ./modules/emailNotify.nix
./services/mail.nix ./services/mail.nix
@ -34,16 +34,6 @@ in with builtins; {
nixpkgs.config.allowUnfree = true; nixpkgs.config.allowUnfree = true;
boot.loader.systemd-boot.enable = true;
boot.loader.generic-extlinux-compatible.enable = false;
# boot.loader.efi.canTouchEfiVariables = true;
boot.tmpOnTmpfs = true;
# rpi4 base config
boot.kernelPackages = pkgs.linuxPackages_rpi4;
boot.kernelParams =
[ "8250.nr_uarts=1" "console=ttyAMA0,115200" "console=tty1" "cma=128" ];
# improve memory performance # improve memory performance
zramSwap.enable = true; zramSwap.enable = true;
zramSwap.algorithm = "zstd"; zramSwap.algorithm = "zstd";
@ -101,7 +91,7 @@ in with builtins; {
extraConfig = with pkgs; '' extraConfig = with pkgs; ''
usev6=cmdv6, cmdv6=${ usev6=cmdv6, cmdv6=${
pkgs.writeScript "get-ipv6" '' pkgs.writeScript "get-ipv6" ''
${iproute2}/bin/ip --brief addr show eth0 mngtmpaddr \ ${iproute2}/bin/ip --brief addr show enp2s0 mngtmpaddr \
| ${gawk}/bin/awk '{print $(NF)}' \ | ${gawk}/bin/awk '{print $(NF)}' \
| sed 's/\/.*//' | sed 's/\/.*//'
'' ''

View file

@ -1,4 +1,4 @@
{ config, pkgs, ... }: { config, lib, pkgs, ... }:
{ {
services.jellyfin.enable = true; services.jellyfin.enable = true;
@ -6,7 +6,12 @@
services.jellyfin.openFirewall = true; services.jellyfin.openFirewall = true;
# for hardware acceleration # for hardware acceleration
users.users.jellyfin.extraGroups = [ "video" "render" ]; users.users.${config.services.jellyfin.user}.extraGroups =
[ "video" "render" ];
systemd.services.jellyfin.serviceConfig = {
PrivateDevices = lib.mkForce false;
DeviceAllow = lib.mkForce [ "/dev/dri/renderD128" ];
};
services.nginx = { services.nginx = {
virtualHosts."media.felschr.com" = { virtualHosts."media.felschr.com" = {

View file

@ -12,9 +12,7 @@ in {
virtualisation.oci-containers.containers = { virtualisation.oci-containers.containers = {
owntracks-recorder = { owntracks-recorder = {
# official image does not support aarch64 image = "owntracks/recorder";
# image = "owntracks/recorder";
image = "easypi/ot-recorder-arm";
ports = [ "8083:8083" ]; ports = [ "8083:8083" ];
environment = { environment = {
OTR_HOST = "localhost"; OTR_HOST = "localhost";
@ -23,11 +21,7 @@ in {
}; };
# provide OTR_PASS # provide OTR_PASS
environmentFiles = [ config.age.secrets.owntracks-recorder-env.path ]; environmentFiles = [ config.age.secrets.owntracks-recorder-env.path ];
# easypi/ot-recorder-arm uses different store location volumes = [ "/var/lib/owntracks/recorder/store:/store" ];
# volumes = [ "/var/lib/owntracks/recorder/store:/store" ];
volumes = [
"/var/lib/owntracks/recorder/store:/var/spool/owntracks/recorder/store"
];
extraOptions = [ "--network=host" ]; extraOptions = [ "--network=host" ];
}; };

View file

@ -4,6 +4,7 @@
imports = [ imports = [
./hardware/base.nix ./hardware/base.nix
./hardware/gpu-intel.nix ./hardware/gpu-intel.nix
./hardware/bluetooth.nix
./system ./system
./desktop ./desktop
./virtualisation/docker.nix ./virtualisation/docker.nix