nixos-hardware/purism/librem/5r4/default.nix

68 lines
2 KiB
Nix
Raw Normal View History

2023-02-13 22:23:27 +00:00
{ config, pkgs, lib, ... }:
let
cfg = config.hardware.librem5;
linuxPackages_librem5 = pkgs.linuxPackagesFor (pkgs.callPackage ./kernel.nix { });
ubootLibrem5 = pkgs.callPackage ./u-boot { };
2023-02-13 22:23:27 +00:00
in {
options = {
hardware.librem5 = {
package = lib.mkOption {
type = lib.types.package;
default = pkgs.callPackage ./librem5-base { };
};
2023-02-13 22:23:27 +00:00
wifiCard = lib.mkOption {
type = lib.types.enum [ "redpine" "sparklan" "none" ];
description = lib.mdDoc ''
Which wi-fi card is installed in your phone.
2023-03-29 13:21:51 +00:00
Phones shipped before January 2023 have redpine, newer phones have sparklan.
2023-02-13 22:23:27 +00:00
'';
default = "redpine";
};
customInitrdModules = lib.mkEnableOption (lib.mdDoc "use of custom kernel modules in the initrd.");
installUdevPackages = lib.mkEnableOption (lib.mdDoc "installation of udev packages from librem5-base.");
lockdownFix = lib.mkEnableOption (lib.mdDoc "fix for orientation and proximity sensors not working after lockdown.");
audio = lib.mkOption {
description = lib.mdDoc ''
Whether to enable and configure PulseAudio for the Librem5 modem.
This is required for audio during calls to work at all.
'';
type = lib.types.bool;
default = true;
example = false;
};
2023-02-13 22:23:27 +00:00
};
};
imports = [
./audio.nix
./initrd.nix
./wifi.nix
./lockdown-fix.nix
];
2023-02-13 22:23:27 +00:00
config = {
hardware.librem5 = {
customInitrdModules = lib.mkDefault true;
installUdevPackages = lib.mkDefault true;
lockdownFix = lib.mkDefault true;
};
boot = {
kernelParams = [ "rootwait" ];
loader = {
generic-extlinux-compatible.enable = lib.mkDefault true;
grub.enable = false;
};
kernelPackages = lib.mkDefault linuxPackages_librem5;
2023-02-13 22:23:27 +00:00
};
services.udev.packages = lib.mkIf cfg.installUdevPackages [ config.hardware.librem5.package ];
environment.systemPackages = [ ubootLibrem5 ];
2023-02-13 22:23:27 +00:00
};
}