nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchFromSourcehut,
4 buildGoModule,
5 nix-update-script,
6 nixosTests,
7}:
8
9buildGoModule rec {
10 pname = "systemd-lock-handler";
11 version = "2.4.2";
12
13 src = fetchFromSourcehut {
14 owner = "~whynothugo";
15 repo = "systemd-lock-handler";
16 rev = "v${version}";
17 hash = "sha256-sTVAabwWtyvHuDp/+8FKNbfej1x/egoa9z1jLIMJuBg=";
18 };
19
20 vendorHash = "sha256-dWzojV3tDA5lLdpAQNC9NaADGyvV7dNOS3x8mfgNNtA=";
21
22 passthru = {
23 updateScript = nix-update-script { };
24 tests = nixosTests.systemd-lock-handler;
25 };
26
27 # The Makefile expects to find the binary in the source root. Make
28 # the one built by `buildGoModule` available so that `make install`
29 # doesn’t try to build it again.
30 postBuild = ''
31 cp -a $GOPATH/bin/* .
32 '';
33
34 installPhase = ''
35 runHook preInstall
36
37 substituteInPlace systemd-lock-handler.service \
38 --replace /usr/lib/ $out/lib/
39
40 make install DESTDIR= PREFIX=$out
41
42 runHook postInstall
43 '';
44
45 meta = {
46 homepage = "https://git.sr.ht/~whynothugo/systemd-lock-handler";
47 description = "Translates systemd-system lock/sleep signals into systemd-user target activations";
48 license = lib.licenses.isc;
49 maintainers = with lib.maintainers; [ liff ];
50 platforms = lib.platforms.linux;
51 };
52}