nixos-config/nixos/components/gui/xorg/xlock.nix

37 lines
783 B
Nix
Raw Normal View History

2019-12-20 05:54:26 +01:00
{ lib, pkgs, ... }:
2019-10-24 02:20:38 +02:00
with lib;
let
name = "lock";
# desktop file
# ------------
# makes it possible to be used by other programs
2019-12-20 05:54:26 +01:00
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
'';
};
2019-10-24 02:20:38 +02:00
# the lock program
2019-12-20 05:54:26 +01:00
lockProgram = pkgs.writeShellScriptBin "${name}" ''
${pkgs.xlockmore}/bin/xlock -mode life1d -size 1
'';
2019-10-24 02:20:38 +02:00
2021-11-01 09:20:42 +01:00
in
{
2023-02-17 00:59:29 +01:00
config = mkIf config.components.gui.enable {
environment.systemPackages = [ lockProgram desktopFile ];
};
2019-10-24 02:20:38 +02:00
}