initial commit

This commit is contained in:
Henry Hiles 2026-12-03 13:50:41 -05:00
commit 4e5eca1925
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs

72
module.nix Normal file
View file

@ -0,0 +1,72 @@
{
config,
lib,
pkgs,
...
}:
let
cfg = config.services.qseecom-supplicant;
in
{
options.services.qseecom-supplicant = {
enable = lib.mkEnableOption "the listeners for Qualcomm QSEE trusted apps, for the QSEECOM TEE driver";
package = lib.mkOption {
type = lib.types.package;
default = pkgs.callPackage ./package.nix { };
defaultText = lib.literalMD "qseecom-supplicant from this flake";
description = "The qseecom-supplicant package.";
};
root = lib.mkOption {
type = lib.types.str;
default = "/var/lib/qseecom";
description = ''
The directory the apps' Android paths are served from, where they keep their data.
Under /var/lib, it's the service's state directory.
'';
};
firmwareDirectory = lib.mkOption {
type = lib.types.str;
default = "/run/current-system/firmware";
description = "Where the apps to load are, as `<name>.mdt` and its `.bNN` segments.";
};
apps = lib.mkOption {
type = lib.types.listOf lib.types.str;
default = [ ];
example = [ "gfp9508" ];
description = ''
The apps to load and keep loaded. Apps the firmware loads itself, like keymaster64,
don't go here, but are served all the same.
'';
};
};
config = lib.mkIf cfg.enable {
systemd.services.qseecom-supplicant = {
description = "Listeners for QSEE trusted apps";
wantedBy = [ "multi-user.target" ];
# Its devices come with modules loaded as they're found, so it keeps
# trying until they're all there
startLimitIntervalSec = 0;
serviceConfig = {
ExecStart = lib.escapeShellArgs (
[
(lib.getExe cfg.package)
cfg.root
cfg.firmwareDirectory
]
++ cfg.apps
);
StateDirectory = lib.mkIf (lib.hasPrefix "/var/lib/" cfg.root) (
lib.removePrefix "/var/lib/" cfg.root
);
StateDirectoryMode = "0700";
Restart = "on-failure";
RestartSec = 5;
};
};
};
}