diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-05-16 16:10:44 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2022-05-16 16:13:11 +0000 |
commit | 513583ecbd7a9bcc83a1e8dadedf05b5cca99c43 (patch) | |
tree | 391fcae4711a7b2eba8386347eb18c6b59b3545b | |
parent | 541bdd67bf406e9d54e36401fb85b08f8c6abba9 (diff) | |
download | spectrum-513583ecbd7a9bcc83a1e8dadedf05b5cca99c43.tar spectrum-513583ecbd7a9bcc83a1e8dadedf05b5cca99c43.tar.gz spectrum-513583ecbd7a9bcc83a1e8dadedf05b5cca99c43.tar.bz2 spectrum-513583ecbd7a9bcc83a1e8dadedf05b5cca99c43.tar.lz spectrum-513583ecbd7a9bcc83a1e8dadedf05b5cca99c43.tar.xz spectrum-513583ecbd7a9bcc83a1e8dadedf05b5cca99c43.tar.zst spectrum-513583ecbd7a9bcc83a1e8dadedf05b5cca99c43.zip |
host: also get firmware from NixOS
This way, we will automatically pick up every redistributable firmware package available in Nixpkgs, which will help broaden our hardware compatibility. Using the NixOS infrastructure for this also means we'll automatically start using compressed firmware once Nixpkgs is updated.
-rw-r--r-- | host/initramfs/default.nix | 14 | ||||
-rw-r--r-- | host/rootfs/default.nix | 13 |
2 files changed, 13 insertions, 14 deletions
diff --git a/host/initramfs/default.nix b/host/initramfs/default.nix index 439b0e6..d03467d 100644 --- a/host/initramfs/default.nix +++ b/host/initramfs/default.nix @@ -6,9 +6,8 @@ }: pkgs.callPackage ( -{ lib, stdenv, makeModulesClosure, nixos, runCommand, writeReferencesToFile -, pkgsStatic, busybox, cpio, cryptsetup, linux-firmware, lvm2 -, microcodeAmd, microcodeIntel +{ lib, stdenv, makeModulesClosure, runCommand, writeReferencesToFile, pkgsStatic +, busybox, cpio, cryptsetup, lvm2, microcodeAmd, microcodeIntel }: let @@ -16,14 +15,9 @@ let linux = rootfs.kernel; - nixosAllHardware = nixos ({ modulesPath, ... }: { - imports = [ (modulesPath + "/profiles/all-hardware.nix") ]; - }); - modules = makeModulesClosure { - inherit (rootfs) kernel; - firmware = linux-firmware; - rootModules = with nixosAllHardware.config.boot.initrd; + inherit (rootfs) firmware kernel; + rootModules = with rootfs.nixosAllHardware.config.boot.initrd; availableKernelModules ++ kernelModules ++ [ "dm-verity" "loop" ]; }; diff --git a/host/rootfs/default.nix b/host/rootfs/default.nix index d4c96d9..7f5cedd 100644 --- a/host/rootfs/default.nix +++ b/host/rootfs/default.nix @@ -3,13 +3,14 @@ { pkgs ? import <nixpkgs> {} }: pkgs.pkgsStatic.callPackage ( -{ lib, stdenv, runCommand, writeReferencesToFile, s6-rc, tar2ext4 -, busybox, cloud-hypervisor, cryptsetup, execline, jq, kmod, linux-firmware +{ lib, stdenv, nixos, runCommand, writeReferencesToFile, s6-rc, tar2ext4 +, busybox, cloud-hypervisor, cryptsetup, execline, jq, kmod , mdevd, s6, s6-linux-init, socat, util-linuxMinimal, xorg }: let inherit (lib) cleanSource cleanSourceWith concatMapStringsSep hasSuffix; + inherit (nixosAllHardware.config.hardware) firmware; start-vm = import ../start-vm { pkgs = pkgs.pkgsStatic; }; @@ -45,6 +46,10 @@ let }) ] ++ (with pkgsGui; [ foot westonLite ]); + nixosAllHardware = nixos ({ modulesPath, ... }: { + imports = [ (modulesPath + "/profiles/all-hardware.nix") ]; + }); + kernel = pkgs.linux_latest.override { structuredExtraConfig = with lib.kernel; { VIRTIO = yes; @@ -64,7 +69,7 @@ let lndir -silent "$pkg" "$out/usr" done - ln -s ${kernel}/lib/modules ${linux-firmware}/lib/firmware $out/lib + ln -s ${kernel}/lib/modules ${firmware}/lib/firmware $out/lib # TODO: this is a hack and we should just build the util-linux # programs we want. @@ -100,7 +105,7 @@ stdenv.mkDerivation { enableParallelBuilding = true; - passthru = { inherit kernel; }; + passthru = { inherit firmware kernel nixosAllHardware; }; meta = with lib; { license = licenses.eupl12; |