diff --git a/hosts/harmonica/configuration.nix b/hosts/harmonica/configuration.nix index 888579e..ae9418c 100644 --- a/hosts/harmonica/configuration.nix +++ b/hosts/harmonica/configuration.nix @@ -8,6 +8,7 @@ imports = [ ./sd-image.nix "${inputs.nixpkgs}/nixos/modules/installer/sd-card/sd-image-aarch64.nix" + ./hardware-configuration.nix ../../modules inputs.agenix.nixosModules.default inputs.home-manager.nixosModules.home-manager @@ -24,84 +25,9 @@ i18n.inputMethod.enable = lib.mkForce false; # no need for japanese input method - - # Some packages (ahci fail... this bypasses that) https://discourse.nixos.org/t/does-pkgs-linuxpackages-rpi3-build-all-required-kernel-modules/42509 - nixpkgs.overlays = [ - (final: super: { - makeModulesClosure = x: - super.makeModulesClosure (x // {allowMissing = true;}); - }) - ]; - - nixpkgs.hostPlatform = "aarch64-linux"; - # ! Need a trusted user for deploy-rs. system.stateVersion = "25.05"; - zramSwap = { - enable = true; - algorithm = "zstd"; - }; - - sdImage = { - # bzip2 compression takes loads of time with emulation, skip it. Enable this if you're low on space. - compressImage = false; - imageName = "zero2.img"; - - extraFirmwareConfig = { - # Give up VRAM for more Free System Memory - # - Disable camera which automatically reserves 128MB VRAM - start_x = 0; - # - Reduce allocation of VRAM to 16MB minimum for non-rotated (32MB for rotated) - gpu_mem = 16; - - # Configure display to 800x600 so it fits on most screens - # * See: https://elinux.org/RPi_Configuration - hdmi_group = 2; - hdmi_mode = 8; - }; - }; - - hardware = { - enableRedistributableFirmware = lib.mkForce false; - firmware = [pkgs.raspberrypiWirelessFirmware]; # Keep this to make sure wifi works - i2c.enable = true; - deviceTree.filter = "bcm2837-rpi-zero*.dtb"; - deviceTree.overlays = [ - { - name = "enable-i2c"; - dtsText = '' - /dts-v1/; - /plugin/; - / { - compatible = "brcm,bcm2837"; - fragment@0 { - target = <&i2c1>; - __overlay__ { - status = "okay"; - }; - }; - }; - ''; - } - ]; - }; - - boot = { - kernelPackages = pkgs.linuxPackages_rpi02w; - - initrd.availableKernelModules = ["xhci_pci" "usbhid" "usb_storage"]; - loader = { - grub.enable = false; - generic-extlinux-compatible.enable = true; - }; - extraModprobeConfig = '' - options brcmfmac roamoff=1 feature_disable=0x82000 - ''; - - # Avoids warning: mdadm: Neither MAILADDR nor PROGRAM has been set. This will cause the `mdmon` service to crash. - # See: https://github.com/NixOS/nixpkgs/issues/254807 - swraid.enable = lib.mkForce false; - }; + networking.hostName = "harmonica"; # networking = { # interfaces."wlan0".useDHCP = true; @@ -116,7 +42,7 @@ # }; # }; # }; - networking.hostName = "harmonica"; + networking.networkmanager.ensureProfiles = { environmentFiles = [ config.age.secrets.nm-secrets.path @@ -171,7 +97,6 @@ # NTP time sync. services.timesyncd.enable = true; - security.sudo = { enable = true; wheelNeedsPassword = false; diff --git a/hosts/harmonica/hardware-configuration.nix b/hosts/harmonica/hardware-configuration.nix new file mode 100644 index 0000000..e92338f --- /dev/null +++ b/hosts/harmonica/hardware-configuration.nix @@ -0,0 +1,79 @@ +{pkgs, lib, ...}: { + + # Some packages (ahci fail... this bypasses that) https://discourse.nixos.org/t/does-pkgs-linuxpackages-rpi3-build-all-required-kernel-modules/42509 + nixpkgs.overlays = [ + (final: super: { + makeModulesClosure = x: + super.makeModulesClosure (x // {allowMissing = true;}); + }) + ]; + + zramSwap = { + enable = true; + algorithm = "zstd"; + }; + + sdImage = { + # bzip2 compression takes loads of time with emulation, skip it. Enable this if you're low on space. + compressImage = false; + imageName = "zero2.img"; + + extraFirmwareConfig = { + # Give up VRAM for more Free System Memory + # - Disable camera which automatically reserves 128MB VRAM + start_x = 0; + # - Reduce allocation of VRAM to 16MB minimum for non-rotated (32MB for rotated) + gpu_mem = 16; + + # Configure display to 800x600 so it fits on most screens + # * See: https://elinux.org/RPi_Configuration + hdmi_group = 2; + hdmi_mode = 8; + }; + }; + + hardware = { + enableRedistributableFirmware = lib.mkForce false; + firmware = [pkgs.raspberrypiWirelessFirmware]; # Keep this to make sure wifi works + i2c.enable = true; + deviceTree.filter = "bcm2837-rpi-zero*.dtb"; + deviceTree.overlays = [ + { + name = "enable-i2c"; + dtsText = '' + /dts-v1/; + /plugin/; + / { + compatible = "brcm,bcm2837"; + fragment@0 { + target = <&i2c1>; + __overlay__ { + status = "okay"; + }; + }; + }; + ''; + } + ]; + }; + + boot = { + kernelPackages = pkgs.linuxPackages_rpi02w; + + initrd.availableKernelModules = ["xhci_pci" "usbhid" "usb_storage"]; + loader = { + grub.enable = false; + generic-extlinux-compatible.enable = true; + }; + extraModprobeConfig = '' + options brcmfmac roamoff=1 feature_disable=0x82000 + ''; + + # Avoids warning: mdadm: Neither MAILADDR nor PROGRAM has been set. This will cause the `mdmon` service to crash. + # See: https://github.com/NixOS/nixpkgs/issues/254807 + swraid.enable = lib.mkForce false; + }; + + + nixpkgs.hostPlatform = "aarch64-linux"; +} \ No newline at end of file