1{
2 lib,
3 stdenv,
4 fetchurl,
5 writeText,
6 xorgproto,
7 libX11,
8 libXext,
9 libXrandr,
10 libxcrypt,
11 # default header can be obtained from
12 # https://git.suckless.org/slock/tree/config.def.h
13 conf ? null,
14 # update script dependencies
15 gitUpdater,
16}:
17
18stdenv.mkDerivation (finalAttrs: {
19 pname = "slock";
20 version = "1.5";
21
22 src = fetchurl {
23 url = "https://dl.suckless.org/tools/slock-${finalAttrs.version}.tar.gz";
24 hash = "sha256-ruHj+/aid/tiWjg4BzuXm2SD57rKTOgvVt4f8ZLbDk0=";
25 };
26
27 buildInputs = [
28 xorgproto
29 libX11
30 libXext
31 libXrandr
32 libxcrypt
33 ];
34
35 installFlags = [ "PREFIX=$(out)" ];
36
37 postPatch = "sed -i '/chmod u+s/d' Makefile";
38
39 preBuild = lib.optionalString (conf != null) ''
40 cp ${writeText "config.def.h" conf} config.def.h
41 '';
42
43 makeFlags = [ "CC:=$(CC)" ];
44
45 passthru.updateScript = gitUpdater {
46 url = "git://git.suckless.org/slock";
47 };
48
49 meta = with lib; {
50 homepage = "https://tools.suckless.org/slock";
51 description = "Simple X display locker";
52 mainProgram = "slock";
53 longDescription = ''
54 Simple X display locker. This is the simplest X screen locker.
55 '';
56 license = licenses.mit;
57 maintainers = with maintainers; [
58 qusic
59 ];
60 platforms = platforms.linux;
61 };
62})