nixos-config/nixos/components/gui/xorg/xlock.nix
2023-02-17 00:59:29 +01:00

36 lines
783 B
Nix

{ lib, pkgs, ... }:
with lib;
let
name = "lock";
# desktop file
# ------------
# makes it possible to be used by other programs
desktopFile = pkgs.writeTextFile {
name = "${name}.desktop";
destination = "/share/applications/${name}.desktop";
text = ''
[Desktop Entry]
Categories=Application;Utility;
Comment=Screen Saver
Encoding=UTF-8
Exec=${lockProgram}/bin/${name}
Icon=gnome-lockscreen
Name=${name}
Terminal=false
Type=Application
'';
};
# the lock program
lockProgram = pkgs.writeShellScriptBin "${name}" ''
${pkgs.xlockmore}/bin/xlock -mode life1d -size 1
'';
in
{
config = mkIf config.components.gui.enable {
environment.systemPackages = [ lockProgram desktopFile ];
};
}