From 746cfd25717d4df5d3c1bbd551990ee8758d9870 Mon Sep 17 00:00:00 2001 From: minipc2 Date: Fri, 26 Jul 2024 17:20:08 -0400 Subject: [PATCH 1/4] added hwd for minipc2 --- hosts/hl-minipc2.hardware-configuration.nix | 28 +++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 hosts/hl-minipc2.hardware-configuration.nix diff --git a/hosts/hl-minipc2.hardware-configuration.nix b/hosts/hl-minipc2.hardware-configuration.nix new file mode 100644 index 0000000..354eb73 --- /dev/null +++ b/hosts/hl-minipc2.hardware-configuration.nix @@ -0,0 +1,28 @@ +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/installer/scan/not-detected.nix") + ]; + + boot.initrd.availableKernelModules = [ "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-intel" ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = + { device = "/dev/disk/by-uuid/2c1a9e86-5b82-4545-bea1-c1b6b688fdf8"; + fsType = "ext4"; + }; + + fileSystems."/boot" = + { device = "/dev/disk/by-uuid/6583-1C43"; + fsType = "vfat"; + options = [ "fmask=0022" "dmask=0022" ]; + }; + + swapDevices = [ ]; + networking.useDHCP = lib.mkDefault true; + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} From 3e6f43894aef4dcb2c07780afcfce00c520c1962 Mon Sep 17 00:00:00 2001 From: Ari Sosnovsky Date: Fri, 26 Jul 2024 17:29:07 -0400 Subject: [PATCH 2/4] Common bigbox --- flake.nix | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/flake.nix b/flake.nix index 3d5033a..259c6e1 100644 --- a/flake.nix +++ b/flake.nix @@ -65,7 +65,7 @@ system = system; config = { allowUnfree = true; }; }); - makeHLService = lib.makeNixOsModuleMaker { + hlCommonSettings = { system = "x86_64-linux"; user = user; localNixCaches = localNixCaches; @@ -88,6 +88,7 @@ }; }; }; + makeHLService = lib.makeNixOsModuleMaker hlCommonSettings; in { lib = lib; @@ -159,10 +160,7 @@ # NIXOS Homelab - BIGBOX1 # ------------- - nixosConfigurations."hl-bigbox1" = unstableLib.makeNixOsModule { - system = "x86_64-linux"; - user = user; - localNixCaches = localNixCaches; + nixosConfigurations."hl-bigbox1" = unstableLib.makeNixOsModule (hlCommonSettings // { systemStateVersion = "24.05"; hostName = "hl-bigbox1"; home-manager = { @@ -170,20 +168,8 @@ enableDevelopmentKit = false; version = "24.11"; }; - enableNetworkDrives = true; - os = { - enable = true; - firewall = { enable = false; }; - enableFonts = true; - hardware = { enable = false; }; - enablePrometheusExporters = true; - containers = { - runtime = "docker"; - localDockerRegistries = localDockerRegistries; - }; - }; configuration = (import ./hosts/hl-bigbox1.nix { user = user; }); - }; + }); # NIXOS Homelab - minipc1 # ------------- From 33a27faf92f721751350d38c0a95a448174c32c9 Mon Sep 17 00:00:00 2001 From: minipc2 Date: Sat, 27 Jul 2024 12:15:36 -0400 Subject: [PATCH 3/4] Added Coral TPU Dev rules --- hosts/hl-minipc2.nix | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hosts/hl-minipc2.nix b/hosts/hl-minipc2.nix index 3507bb6..a841521 100644 --- a/hosts/hl-minipc2.nix +++ b/hosts/hl-minipc2.nix @@ -6,5 +6,10 @@ # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; + # Special udev rule (coral tpu) + services.udev.extraRules = '' + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a6e", ATTRS{idProduct}=="089a", MODE="0664", TAG+="uaccess", SYMLINK+="coraltpu" + SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="9302", MODE="0664", TAG+="uaccess", SYMLINK+="coraltpu" + ''; } From 85068ac330b22c5d3ac1303a2d222c9a035a5aed Mon Sep 17 00:00:00 2001 From: minipc2 Date: Sat, 27 Jul 2024 12:21:43 -0400 Subject: [PATCH 4/4] new rules --- hosts/hl-minipc2.nix | 7 ++----- modules/hl-services/coral-tpu-udev.nix | 22 ++++++++++++++++++++++ modules/hl-services/default.nix | 1 + 3 files changed, 25 insertions(+), 5 deletions(-) create mode 100644 modules/hl-services/coral-tpu-udev.nix diff --git a/hosts/hl-minipc2.nix b/hosts/hl-minipc2.nix index a841521..3084d27 100644 --- a/hosts/hl-minipc2.nix +++ b/hosts/hl-minipc2.nix @@ -6,10 +6,7 @@ # Bootloader. boot.loader.systemd-boot.enable = true; boot.loader.efi.canTouchEfiVariables = true; - # Special udev rule (coral tpu) - services.udev.extraRules = '' - SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a6e", ATTRS{idProduct}=="089a", MODE="0664", TAG+="uaccess", SYMLINK+="coraltpu" - SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="9302", MODE="0664", TAG+="uaccess", SYMLINK+="coraltpu" - ''; + # Special udev rule for google's coral tpu + homelab.udevrules.coraltpu.enable = true; } diff --git a/modules/hl-services/coral-tpu-udev.nix b/modules/hl-services/coral-tpu-udev.nix new file mode 100644 index 0000000..6c32f25 --- /dev/null +++ b/modules/hl-services/coral-tpu-udev.nix @@ -0,0 +1,22 @@ +{ config, lib, ... }: +with lib; +let cfg = config.homelab.udevrules.coraltpu; +in { + options = { + homelab.udevrules.coraltpu = { + enable = mkEnableOption + "Enable Coral TPU Udev rules"; + symlinkName = mkOption { + description = "The special symlink to give to the coral tpu"; + type = types.str; + default = "coral1"; + }; + }; + }; + config = mkIf cfg.enable { + services.udev.extraRules = '' + SUBSYSTEMS=="usb", ATTRS{idVendor}=="1a6e", ATTRS{idProduct}=="089a", MODE="0664", TAG+="uaccess", SYMLINK+="${cfg.symlinkName}" + SUBSYSTEMS=="usb", ATTRS{idVendor}=="18d1", ATTRS{idProduct}=="9302", MODE="0664", TAG+="uaccess", SYMLINK+="${cfg.symlinkName}" + ''; + }; +} diff --git a/modules/hl-services/default.nix b/modules/hl-services/default.nix index 47b5ff0..17f1289 100644 --- a/modules/hl-services/default.nix +++ b/modules/hl-services/default.nix @@ -2,5 +2,6 @@ { imports = [ ./audiobookshelf.nix + ./coral-tpu-udev.nix ]; }