2023-02-13 23:23:27 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
2024-05-05 07:13:06 +02:00
|
|
|
let
|
|
|
|
cfg = config.hardware.librem5;
|
|
|
|
linuxPackages_librem5 = pkgs.linuxPackagesFor (pkgs.callPackage ./kernel.nix { });
|
|
|
|
ubootLibrem5 = pkgs.callPackage ./u-boot { };
|
2023-02-13 23:23:27 +01:00
|
|
|
in {
|
|
|
|
options = {
|
|
|
|
hardware.librem5 = {
|
2024-05-05 07:13:06 +02:00
|
|
|
package = lib.mkOption {
|
|
|
|
type = lib.types.package;
|
|
|
|
default = pkgs.callPackage ./librem5-base { };
|
|
|
|
};
|
2023-02-13 23:23:27 +01:00
|
|
|
wifiCard = lib.mkOption {
|
|
|
|
type = lib.types.enum [ "redpine" "sparklan" "none" ];
|
2024-07-29 23:37:28 +02:00
|
|
|
description = ''
|
2023-02-13 23:23:27 +01:00
|
|
|
Which wi-fi card is installed in your phone.
|
|
|
|
|
2023-03-29 15:21:51 +02:00
|
|
|
Phones shipped before January 2023 have redpine, newer phones have sparklan.
|
2023-02-13 23:23:27 +01:00
|
|
|
'';
|
|
|
|
default = "redpine";
|
|
|
|
};
|
2024-07-29 23:37:28 +02:00
|
|
|
customInitrdModules = lib.mkEnableOption "use of custom kernel modules in the initrd.";
|
|
|
|
installUdevPackages = lib.mkEnableOption "installation of udev packages from librem5-base.";
|
|
|
|
lockdownFix = lib.mkEnableOption "fix for orientation and proximity sensors not working after lockdown.";
|
2023-08-16 00:23:36 +02:00
|
|
|
audio = lib.mkOption {
|
2024-07-29 23:37:28 +02:00
|
|
|
description = ''
|
2023-08-16 00:23:36 +02:00
|
|
|
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 23:23:27 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2023-08-16 00:23:36 +02:00
|
|
|
imports = [
|
|
|
|
./audio.nix
|
|
|
|
./initrd.nix
|
|
|
|
./wifi.nix
|
|
|
|
./lockdown-fix.nix
|
|
|
|
];
|
2023-02-13 23:23:27 +01: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;
|
|
|
|
};
|
|
|
|
|
2024-05-05 07:13:06 +02:00
|
|
|
kernelPackages = lib.mkDefault linuxPackages_librem5;
|
2023-02-13 23:23:27 +01:00
|
|
|
};
|
|
|
|
|
2024-05-05 07:13:06 +02:00
|
|
|
services.udev.packages = lib.mkIf cfg.installUdevPackages [ config.hardware.librem5.package ];
|
2023-09-10 12:31:17 +02:00
|
|
|
|
2024-05-05 07:13:06 +02:00
|
|
|
environment.systemPackages = [ ubootLibrem5 ];
|
2023-02-13 23:23:27 +01:00
|
|
|
};
|
|
|
|
}
|