1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-15 19:23:01 +03:00
mobile-nixos/modules/initrd-vendor.nix
2020-05-24 20:13:07 -04:00

39 lines
1.1 KiB
Nix

# This module handles well-known "vendor" partitions.
#
# Relevant upstream documentation:
# * https://www.kernel.org/doc/html/v4.14/driver-api/firmware/fw_search_path.html
#
# Note that we'll be using `firmware_class.path=/vendor/firmware` on the
# command-line to make the firmware path known ASAP without requiring run-time
# configuration. The NixOS stage-2 will configure `/sys/module/firmware_class/parameters/path`
# as expected.
{ config, lib, ... }:
let
inherit (lib) types;
inherit (config.mobile.system) vendor;
in
{
options = {
mobile.system.vendor.partition = lib.mkOption {
type = types.nullOr types.str;
default = null;
description = "Path to a partition with firmware files built-in to the device";
internal = true;
};
};
config = lib.mkIf (vendor.partition != null) {
boot.kernelParams = [
"firmware_class.path=/vendor/firmware"
];
boot.specialFileSystems = {
"/vendor" = {
device = vendor.partition;
fsType = "ext4";
options = [ "ro" "nosuid" "noexec" "nodev" ];
};
};
};
}