1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2025-01-08 12:48:50 +03:00
mobile-nixos/modules/mobile-device.nix
Samuel Dionne-Riel 832acb8979 modules/mobile-device: Use generic names when Mobile NixOS config is disabled
This is used to facilitate inclusion of the Mobile NixOS machinery in a
NixOS config, but opting-in into only a few components (e.g. stage-1)
2022-05-29 22:39:11 -04:00

46 lines
1.3 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
{
options.mobile.device = {
name = mkOption {
type = types.str;
description = "The device's codename. Must match the device folder.";
};
identity = {
name = mkOption {
type = types.str;
description = "The device's name as advertised by the manufacturer.";
};
manufacturer = mkOption {
type = types.str;
description = "The device's manufacturer name.";
};
};
firmware = mkOption {
type = types.package;
description = ''
Informal option that the end-user can use to get their device's firmware package
The device configuration may provide this option so the user can simply
use `hardware.firmware = [ config.mobile.device.firmware ];`.
Note that not all devices provide a firmware bundle, in this case the
user should not add the previous example to their configuration.
This is not added automatically to the system firmwares as most device
firmware bundles will be unredistributable.
'';
};
};
config = mkIf (!config.mobile.enable) {
mobile.device.name = mkOptionDefault "generic";
mobile.device.identity.name = mkOptionDefault "generic";
mobile.device.identity.manufacturer = mkOptionDefault "generic";
};
}