1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-12-16 11:43:21 +03:00
mobile-nixos/modules/quirks-qualcomm.nix
2019-09-24 23:00:02 -04:00

70 lines
1.8 KiB
Nix

{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.mobile.quirks.qualcomm;
in
{
options.mobile = {
quirks.qualcomm.msm-fb-refresher.enable = mkOption {
type = types.bool;
default = false;
description = "
Enables use of `msm-fb-refresher`.
Use sparingly, it is better to patch software to flip buffers instead.
";
};
quirks.qualcomm.msm-fb-handle.enable = mkOption {
type = types.bool;
default = false;
description = "
Enables use of `msm-fb-handle`.
This tool keeps a dummy handle open to the framebuffer, useful for msm_mdss
which clears and shuts display down when all handles are closed.
";
};
};
config = mkMerge [
{
mobile.boot = mkMerge [
(mkIf cfg.msm-fb-handle.enable {
stage-1 = {
extraUtils = with pkgs; [
msm-fb-handle
];
initFramebuffer = ''
msm-fb-handle &
'';
};
})
(mkIf cfg.msm-fb-refresher.enable {
stage-1 = {
extraUtils = with pkgs; [
msm-fb-refresher
];
initFramebuffer = ''
msm-fb-refresher --loop &
'';
};
})
];
}
# With X11, the fb-handle hack doesn't work.
# Why keep fb-handle hack? Because it acts better in initrd in my testing.
(mkIf (cfg.msm-fb-handle.enable || cfg.msm-fb-refresher.enable) {
systemd.services.msm-fb-refresher = {
description = "Fixup for Qualcomm dumb stuff.";
wantedBy = [ "multi-user.target" ];
serviceConfig = {
ExecStart = ''
${pkgs.msm-fb-refresher}/bin/msm-fb-refresher --loop
'';
};
};
})
];
}