diff --git a/hosts/common/boot.nix b/hosts/common/boot.nix new file mode 100644 index 00000000..4abe9254 --- /dev/null +++ b/hosts/common/boot.nix @@ -0,0 +1,50 @@ +{ lib, pkgs, ... }: +{ + boot.initrd.supportedFilesystems = [ "ext4" "btrfs" "ext2" "ext3" "vfat" ]; + # useful emergency utils + boot.initrd.extraUtilsCommands = '' + copy_bin_and_libs ${pkgs.btrfs-progs}/bin/btrfstune + copy_bin_and_libs ${pkgs.util-linux}/bin/{cfdisk,lsblk,lscpu} + copy_bin_and_libs ${pkgs.gptfdisk}/bin/{cgdisk,gdisk} + copy_bin_and_libs ${pkgs.smartmontools}/bin/smartctl + copy_bin_and_libs ${pkgs.e2fsprogs}/bin/resize2fs + '' + lib.optionalString pkgs.stdenv.hostPlatform.isx86_64 '' + copy_bin_and_libs ${pkgs.nvme-cli}/bin/nvme # doesn't cross compile + ''; + boot.kernelParams = [ + "boot.shell_on_fail" + #v experimental full pre-emption for hopefully better call/audio latency on moby. + # also toggleable at runtime via /sys/kernel/debug/sched/preempt + # defaults to preempt=voluntary + # "preempt=full" + ]; + # other kernelParams: + # "boot.trace" + # "systemd.log_level=debug" + # "systemd.log_target=console" + + # moby has to run recent kernels (defined elsewhere). + # meanwhile, kernel variation plays some minor role in things like sandboxing (landlock) and capabilities. + # simpler to keep near the latest kernel on all devices, + # and also makes certain that any weird system-level bugs i see aren't likely to be stale kernel bugs. + # servo needs zfs though, which doesn't support every kernel. + boot.kernelPackages = lib.mkDefault pkgs.zfs.latestCompatibleLinuxPackages; + + # hack in the `boot.shell_on_fail` arg since that doesn't always seem to work. + boot.initrd.preFailCommands = "allowShell=1"; + + # default: 4 (warn). 7 is debug + boot.consoleLogLevel = 7; + + boot.loader.grub.enable = lib.mkDefault false; + boot.loader.generic-extlinux-compatible.enable = lib.mkDefault true; + + # non-free firmware + hardware.enableRedistributableFirmware = true; + + # default is 252274, which is too low particularly for servo. + # manifests as spurious "No space left on device" when trying to install watches, + # e.g. in dyn-dns by `systemctl start dyn-dns-watcher.path`. + # see: + boot.kernel.sysctl."fs.inotify.max_user_watches" = 1048576; +} diff --git a/hosts/common/default.nix b/hosts/common/default.nix index ab473cc8..8ce08ac0 100644 --- a/hosts/common/default.nix +++ b/hosts/common/default.nix @@ -1,6 +1,7 @@ { config, lib, pkgs, ... }: { imports = [ + ./boot.nix ./feeds.nix ./fs.nix ./hardware diff --git a/hosts/common/hardware/default.nix b/hosts/common/hardware/default.nix index f88c31e5..02534cb7 100644 --- a/hosts/common/hardware/default.nix +++ b/hosts/common/hardware/default.nix @@ -5,36 +5,6 @@ ./x86_64.nix ]; - boot.initrd.supportedFilesystems = [ "ext4" "btrfs" "ext2" "ext3" "vfat" ]; - # useful emergency utils - boot.initrd.extraUtilsCommands = '' - copy_bin_and_libs ${pkgs.btrfs-progs}/bin/btrfstune - copy_bin_and_libs ${pkgs.util-linux}/bin/{cfdisk,lsblk,lscpu} - copy_bin_and_libs ${pkgs.gptfdisk}/bin/{cgdisk,gdisk} - copy_bin_and_libs ${pkgs.smartmontools}/bin/smartctl - copy_bin_and_libs ${pkgs.e2fsprogs}/bin/resize2fs - '' + lib.optionalString pkgs.stdenv.hostPlatform.isx86_64 '' - copy_bin_and_libs ${pkgs.nvme-cli}/bin/nvme # doesn't cross compile - ''; - boot.kernelParams = [ - "boot.shell_on_fail" - #v experimental full pre-emption for hopefully better call/audio latency on moby. - # also toggleable at runtime via /sys/kernel/debug/sched/preempt - # defaults to preempt=voluntary - # "preempt=full" - ]; - # other kernelParams: - # "boot.trace" - # "systemd.log_level=debug" - # "systemd.log_target=console" - - # moby has to run recent kernels (defined elsewhere). - # meanwhile, kernel variation plays some minor role in things like sandboxing (landlock) and capabilities. - # simpler to keep near the latest kernel on all devices, - # and also makes certain that any weird system-level bugs i see aren't likely to be stale kernel bugs. - # servo needs zfs though, which doesn't support every kernel. - boot.kernelPackages = lib.mkDefault pkgs.zfs.latestCompatibleLinuxPackages; - # TODO: remove after linux 6.9. see: # - # - @@ -45,24 +15,6 @@ export UV_USE_IO_URING=0 ''; - # hack in the `boot.shell_on_fail` arg since that doesn't always seem to work. - boot.initrd.preFailCommands = "allowShell=1"; - - # default: 4 (warn). 7 is debug - boot.consoleLogLevel = 7; - - boot.loader.grub.enable = lib.mkDefault false; - boot.loader.generic-extlinux-compatible.enable = lib.mkDefault true; - - # non-free firmware - hardware.enableRedistributableFirmware = true; - - # default is 252274, which is too low particularly for servo. - # manifests as spurious "No space left on device" when trying to install watches, - # e.g. in dyn-dns by `systemctl start dyn-dns-watcher.path`. - # see: - boot.kernel.sysctl."fs.inotify.max_user_watches" = 1048576; - # powertop will default to putting USB devices -- including HID -- to sleep after TWO SECONDS powerManagement.powertop.enable = false; # linux CPU governor: