From f1c5d1998ef0aa6db13c99d09e404db49b3b5028 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Sun, 4 Aug 2024 16:53:25 -0400 Subject: [PATCH 1/3] added scrypted to minipc2 --- hosts/hl-bigbox1.nix | 4 +--- hosts/hl-minipc2.nix | 20 ++++++++++++++++++++ modules/network-drives.nix | 6 ++++++ modules/os/containers/docker.nix | 1 + 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/hosts/hl-bigbox1.nix b/hosts/hl-bigbox1.nix index 9ad5134..e6ca799 100644 --- a/hosts/hl-bigbox1.nix +++ b/hosts/hl-bigbox1.nix @@ -10,10 +10,8 @@ boot.loader.efi.canTouchEfiVariables = true; boot.tmp.useTmpfs = true; boot.kernelPackages = pkgs.linuxPackages_latest; - #systemd.enableUnifiedCgroupHierarchy = false; - # Containers + # Containers virtualisation.oci-containers = { - backend = "docker"; containers = { ollama = { autoStart = true; diff --git a/hosts/hl-minipc2.nix b/hosts/hl-minipc2.nix index fcb64ee..bf53680 100644 --- a/hosts/hl-minipc2.nix +++ b/hosts/hl-minipc2.nix @@ -10,5 +10,25 @@ # Special udev rule for google's coral tpu homelab.udevrules.coraltpu.enable = true; + + # Containers + virtualisation.oci-containers = { + containers = { + scrypted = { + autoStart = true; + image = "ghcr.io/koush/scrypted"; + extraOptions = [ "--network=host" ]; + volumes = [ + "/var/run/dbus:/var/run/dbus" + "/var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket" + "/opt/homelab/scrypted/db:/server/volume" + "/mnt/EightTerra/NVR:/nvr" + ]; + environment = { + SCRYPTED_NVR_VOLUME = "/nvr"; + }; + }; + }; + }; } diff --git a/modules/network-drives.nix b/modules/network-drives.nix index e110f02..09ac2c9 100644 --- a/modules/network-drives.nix +++ b/modules/network-drives.nix @@ -10,4 +10,10 @@ fsType = "nfs"; options = [ "x-systemd.automount" "noauto" ]; }; + + fileSystems."/mnt/EightTerra/NVR" = { + device = "tnas1.lab.internal:/mnt/EightTerra/NVR"; + fsType = "nfs"; + options = [ "x-systemd.automount" "noauto" ]; + }; } diff --git a/modules/os/containers/docker.nix b/modules/os/containers/docker.nix index 7a17be8..cb730fb 100644 --- a/modules/os/containers/docker.nix +++ b/modules/os/containers/docker.nix @@ -11,4 +11,5 @@ }; environment.systemPackages = with pkgs; [ docker-compose ]; users.users.${user.name}.extraGroups = [ "docker" ]; + virtualisation.oci-containers.backend = "docker"; } From 2bcf8b7964c0c824fd02f81392e01ba118b479b0 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Sun, 4 Aug 2024 21:16:39 -0400 Subject: [PATCH 2/3] added fws hl --- flake.nix | 14 +++++- hosts/hl-fws1.hardware-configuration.nix | 59 ++++++++++++++++++++++++ hosts/hl-fws1.nix | 15 ++++++ 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 hosts/hl-fws1.hardware-configuration.nix create mode 100644 hosts/hl-fws1.nix diff --git a/flake.nix b/flake.nix index 90cc37c..d47c138 100644 --- a/flake.nix +++ b/flake.nix @@ -131,7 +131,7 @@ }) ([ "hl-bigbox1" - ]); + ]); in { lib = lib; @@ -202,6 +202,18 @@ ]; }; }; + # NIXOS Framework Homelab + # ------------- + hl-fws1 = makeHLService { + hostName = "hl-fws1"; + configuration = { ... }: { + imports = [ + nixos-hardware.nixosModules.framework-11th-gen-intel + (import (./hosts/hl-fws1.nix) { user = user; }) + ]; + }; + systemStateVersion = "24.05"; + }; } // (builtins.listToAttrs homeLabModulesUsingStable) // (builtins.listToAttrs homeLabModulesUsingUnStable); }; } diff --git a/hosts/hl-fws1.hardware-configuration.nix b/hosts/hl-fws1.hardware-configuration.nix new file mode 100644 index 0000000..b69bba4 --- /dev/null +++ b/hosts/hl-fws1.hardware-configuration.nix @@ -0,0 +1,59 @@ +# 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" "thunderbolt" "nvme" "usbhid" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { + device = "/dev/disk/by-uuid/2d96049a-938b-4f08-b73a-5baae8eaef2a"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { + device = "/dev/disk/by-uuid/0B62-BBC0"; + fsType = "vfat"; + }; + + fileSystems."/var/lib/docker/overlay2/0bc719adc0cba6bb20f7a41e6284358ae241ce12b5061bc41a91a9cd90af4b09/merged" = + { + device = "overlay"; + fsType = "overlay"; + }; + + fileSystems."/mnt/EightTerra/NVR" = + { + device = "tnas1.lab.internal:/mnt/EightTerra/NVR"; + fsType = "nfs4"; + }; + + swapDevices = + [{ device = "/dev/disk/by-uuid/cf34dac4-3757-44a8-9458-14943c60d418"; }]; + + # 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..useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.br-47d44751bed1.useDHCP = lib.mkDefault true; + # networking.interfaces.br-91bbed946990.useDHCP = lib.mkDefault true; + # networking.interfaces.docker0.useDHCP = lib.mkDefault true; + # networking.interfaces.enp0s13f0u4.useDHCP = lib.mkDefault true; + # networking.interfaces.tailscale0.useDHCP = lib.mkDefault true; + # networking.interfaces.veth767cf6c.useDHCP = lib.mkDefault true; + # networking.interfaces.wlp170s0.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} diff --git a/hosts/hl-fws1.nix b/hosts/hl-fws1.nix new file mode 100644 index 0000000..0aff934 --- /dev/null +++ b/hosts/hl-fws1.nix @@ -0,0 +1,15 @@ +{ user }: +{ pkgs, lib, config, ... }: { + imports = [ ./hl-minipc1.hardware-configuration.nix ]; + + # firmware updater + services.fwupd.enable = true; + hardware.framework.enableKmod = true; + homelab.nix.remote-builder.enable = true; + + # Bootloader. + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + boot.tmp.useTmpfs = true; +} + From 9c4d0c0ea321c233281c1e22d077812f0d3ccd59 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Mon, 5 Aug 2024 11:16:44 -0400 Subject: [PATCH 3/3] Removed display link drivers --- hosts/fwbook.nix | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/hosts/fwbook.nix b/hosts/fwbook.nix index 73b195b..ee87d96 100644 --- a/hosts/fwbook.nix +++ b/hosts/fwbook.nix @@ -31,20 +31,17 @@ in rocmPackages.llvm.clang amdgpu_top amdctl - # Display Libraries - displaylink # python python312 ]; - # Opengl + # # Opengl hardware.opengl = { driSupport = true; driSupport32Bit = true; extraPackages = [ pkgs.amdvlk ]; extraPackages32 = [ pkgs.driversi686Linux.amdvlk ]; }; - # Gaming - programs.gamescope.enable = true; + # # Gaming programs.steam = { enable = true; extest.enable = true; @@ -57,23 +54,20 @@ in listenAddress = "0.0.0.0:11434"; package = unstable.ollama; }; - # Brother Printer + # # Brother Printer hardware.sane.brscan5.enable = true; - # Display Managers + # # Display Managers services.xserver.videoDrivers = - [ "displaylink" "modesetting" "amdgpu" "fbdev" ]; - services.xserver.displayManager.sessionCommands = '' - ${lib.getBin pkgs.xorg.xrandr}/bin/xrandr --setprovideroutputsource 2 0 - ''; + [ "modesetting" "amdgpu" "fbdev" ]; # Kernel boot.kernelPackages = pkgs.linuxPackages_zen; - boot.initrd.kernelModules = [ "amdgpu" "evdi" ]; + boot.initrd.kernelModules = [ "amdgpu" ]; # Add Functions home-manager.users.${user.name}.programs.zsh.initExtra = '' source ${zshFunctions} ''; environment.localBinInPath = true; - homelab.nix.remote-builder.enable = true; + # homelab.nix.remote-builder.enable = true; # Advance Power Management powerManagement.powertop.enable = true; powerManagement.enable = true;