From 0a1de7c023f9e69ef36eb93b45173e39145b064f Mon Sep 17 00:00:00 2001 From: Christopher James Hayward Date: Sat, 19 Jun 2021 06:46:18 -0400 Subject: [PATCH] Move boot into hardware config --- README.org | 92 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 77 insertions(+), 15 deletions(-) diff --git a/README.org b/README.org index 5fc923b..f06eff3 100644 --- a/README.org +++ b/README.org @@ -394,10 +394,6 @@ This is a basic default configuration that specified the indended default config { config, pkgs, inputs, ... }: { - boot.loader.grub.enable = true; - boot.loader.grub.version = 2; - boot.loader.grub.device = "/dev/sda"; - time.timeZone = "America/Toronto"; networking.hostName = "nixos"; @@ -435,6 +431,10 @@ The file system for this host is a single 24GB QCOW file, a format for disk imag boot.kernelModules = [ ]; boot.extraModulePackages = [ ]; + boot.loader.grub.enable = true; + boot.loader.grub.version = 2; + boot.loader.grub.device = "/dev/sda"; + fileSystems."/" = { device = "/dev/disk/by-uuid/fddc37ff-a442-41fa-afc4-abf878be7c5a"; fsType = "ext4"; @@ -508,9 +508,6 @@ This configuration is nearly identical to the default, except for a few key diff { config, pkgs, inputs, ... }: { - boot.loader.systemd-boot.enable = true; - boot.loader.efi.canTouchEfiVariables = true; - time.timeZone = "America/Toronto"; networking.hostName = "acernitro"; @@ -523,6 +520,7 @@ This configuration is nearly identical to the default, except for a few key diff <> + services.xserver.dpi = 96; services.openssh.enable = true; services.printing.enable = true; @@ -532,8 +530,8 @@ This configuration is nearly identical to the default, except for a few key diff users.users.chris = { shell = pkgs.fish; - isNormalUser = true; - extraGroups = [ "wheel" ]; + isnormaluser = true; + extragroups = [ "wheel" ]; }; } #+END_SRC @@ -558,12 +556,13 @@ This configuration is nearly identical to the default, except for a few key diff boot.kernelModules = [ "kvm-intel" ]; boot.extraModulePackages = [ ]; + boot.loader.systemd-boot.enable = true; + boot.loader.efi.canTouchEfiVariables = true; + sound.enable = true; hardware.pulseaudio.enable = true; hardware.pulseaudio.support32Bit = true; - services.xserver.dpi = 96; - fileSystems."/" = { device = "/dev/disk/by-uuid/2f548eb9-47ce-4280-950f-9c6d1d162852"; fsType = "ext4"; @@ -690,19 +689,82 @@ Deploy this configuration with ~sudo nixos-rebuild switch --flake /etc/dotfiles/ } #+END_SRC -*** TODO Configuration +*** Configuration #+BEGIN_SRC nix :noweb yes :tangle hosts/raspberry/configuration.nix # <> -{ # TODO +{ config, pkgs, ... }: + +{ + networking.hostName = "raspberry"; + networking.firewall.enable = false; + networking.wireless.enable = true; + networking.wireless.userControlled.enable = true; + + <> + + environment.systemPackages = [ + pkgs.libraspberrypi + pkgs.raspberrypi-eeprom + ]; + + programs.fish.enable = true; + programs.gnupg.agent.enable = true; + + users.users.chris = { + shell = pkgs.fish; + isnormaluser = true; + extragroups = [ "wheel" ]; + }; } #+END_SRC -*** TODO Hardware +*** Hardware #+BEGIN_SRC nix :noweb yes :tangle hosts/raspberry/hardware.nix # <> -{ # TODO +{ config, pkgs, lib, inputs, ... }: + +{ + imports = [ + inputs.nixos-hardware.nixosModules.raspberry-pi.4 + ]; + + boot.kernelPackages = pkgs.linuxPackages_rpi4; + boot.tmpOnTmpfs = true; + boot.initrd.availableKernelModules = [ "usbhid" "usb_storage" ]; + boot.kernelParams = [ + "8250.nr_uarts=1" + "console=ttyAMA0,115200" + "console=tty1" + "cma=128M" + ]; + + boot.loader.grub.enable = false; + boot.loader.generic-extlinux-compatible.enable = true; + boot.loader.raspberryPi = { + enable = true; + version = 4; + firmwareConfig = '' + dtparam=sd_poll_once=on + dtparam=audio=on + ''; + }; + + sound.enable = true; + hardware.pulseaudio.enable = true; + hardware.enableRedistributableFirmware = true; + hardware.raspberry-pi."4".fkms-3d.enable = true; + + fileSystems = { + "/" = { + device = "/dev/disk/by-label/NIXOS_SD"; + fsType = "ext4"; + options = [ "noatime" ]; + }; + }; + + powerManagement.cpuFreqGovernor = "ondemand"; } #+END_SRC