9 cfg = config.boot.initrd.unl0kr;
10 settingsFormat = pkgs.formats.ini { };
13 options.boot.initrd.unl0kr = {
14 enable = lib.mkEnableOption "unl0kr in initrd" // {
15 description = ''Whether to enable the unl0kr on-screen keyboard in initrd to unlock LUKS.'';
18 package = lib.mkPackageOption pkgs "buffybox" { };
20 allowVendorDrivers = lib.mkEnableOption "load optional drivers" // {
21 description = ''Whether to load additional drivers for certain vendors (I.E: Wacom, Intel, etc.)'';
24 settings = lib.mkOption {
26 Configuration for `unl0kr`.
28 See `unl0kr.conf(5)` for supported values.
30 Alternatively, visit `https://gitlab.postmarketos.org/postmarketOS/buffybox/-/blob/3.2.0/unl0kr/unl0kr.conf`
33 example = lib.literalExpression ''
35 general.animations = true;
36 general.backend = "drm";
38 default = "pmos-dark";
39 alternate = "pmos-light";
44 type = lib.types.submodule { freeformType = settingsFormat.type; };
48 config = lib.mkIf cfg.enable {
49 meta.maintainers = with lib.maintainers; [ hustlerone ];
52 assertion = cfg.enable -> config.boot.initrd.systemd.enable;
53 message = "boot.initrd.unl0kr is only supported with boot.initrd.systemd.";
57 warnings = lib.mkMerge [
58 (lib.mkIf (config.hardware.amdgpu.initrd.enable) [
59 ''Use early video loading at your risk. It's not guaranteed to work with unl0kr.''
61 (lib.mkIf (config.boot.plymouth.enable) [
62 ''Upstream clearly intends unl0kr to not run with Plymouth. Good luck''
66 boot.initrd.availableKernelModules =
67 lib.optionals cfg.enable [
73 "i2c-designware-platform"
79 ++ lib.optionals cfg.allowVendorDrivers [
85 boot.initrd.systemd = {
86 contents."/etc/unl0kr.conf".source = settingsFormat.generate "unl0kr.conf" cfg.settings;
87 storePaths = with pkgs; [
90 (lib.getExe' cfg.package "unl0kr")
91 "${cfg.package}/libexec/unl0kr-agent"
98 paths.unl0kr-agent.wantedBy = [ "local-fs-pre.target" ];