| lockMessage = "This computer has been locked, please enter your password to continue"; |
| killUnconfinedConfinables = true; |
| boot.initrd.availableKernelModules = [ |
| boot.initrd.luks.devices = { |
| nix.device = "/dev/disk/by-label/NIX"; |
| swap.device = "/dev/disk/by-label/SWAP"; |
| hdd.device = "/dev/disk/by-label/HDD"; |
| ${pkgs.sway}/bin/swaymsg output "*" dpms off |
| ${pkgs.systemd}/bin/systemd-inhibit --why="Already locked" --what=idle --who="lock script" ${config.security.wrapperDir}/physlock -s -p "${lockMessage}" |
| while [ $(${pkgs.sway}/bin/swaymsg -t get_outputs | ${pkgs.jq}/bin/jq "[.[] | .dpms] | any") = "false" ]; do ${pkgs.coreutils}/bin/sleep 0.1; ${pkgs.sway}/bin/swaymsg output "*" dpms on; done |
| (lib.filter (line: line != "")) |
| (lib.concatStringsSep " && ") |
| (pkgs.writeScriptBin "lock" lockCommand) |