nixos/unl0kr: add a package option (#361865)

This commit is contained in:
Aleksana 2024-12-05 16:10:43 +08:00 committed by GitHub
commit 302d3d791c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -15,6 +15,8 @@ in
description = ''Whether to enable the unl0kr on-screen keyboard in initrd to unlock LUKS.''; description = ''Whether to enable the unl0kr on-screen keyboard in initrd to unlock LUKS.'';
}; };
package = lib.mkPackageOption pkgs "unl0kr" { };
allowVendorDrivers = lib.mkEnableOption "load optional drivers" // { allowVendorDrivers = lib.mkEnableOption "load optional drivers" // {
description = ''Whether to load additional drivers for certain vendors (I.E: Wacom, Intel, etc.)''; description = ''Whether to load additional drivers for certain vendors (I.E: Wacom, Intel, etc.)'';
}; };
@ -85,7 +87,7 @@ in
libinput libinput
xkeyboard_config xkeyboard_config
"${config.boot.initrd.systemd.package}/lib/systemd/systemd-reply-password" "${config.boot.initrd.systemd.package}/lib/systemd/systemd-reply-password"
"${pkgs.unl0kr}/bin/unl0kr" (lib.getExe' cfg.package "unl0kr")
]; ];
services = { services = {
unl0kr-ask-password = { unl0kr-ask-password = {
@ -112,7 +114,7 @@ in
do do
for file in `ls $DIR/ask.*`; do for file in `ls $DIR/ask.*`; do
socket="$(cat "$file" | ${pkgs.gnugrep}/bin/grep "Socket=" | cut -d= -f2)" socket="$(cat "$file" | ${pkgs.gnugrep}/bin/grep "Socket=" | cut -d= -f2)"
${pkgs.unl0kr}/bin/unl0kr -v -C "/etc/unl0kr.conf" | ${config.boot.initrd.systemd.package}/lib/systemd/systemd-reply-password 1 "$socket" ${lib.getExe' cfg.package "unl0kr"} -v -C "/etc/unl0kr.conf" | ${config.boot.initrd.systemd.package}/lib/systemd/systemd-reply-password 1 "$socket"
done done
done done
''; '';