1{
2 lib,
3 fetchFromGitLab,
4 buildGoModule,
5 scdoc,
6 nix-update-script,
7}:
8
9buildGoModule rec {
10 pname = "darkman";
11 version = "2.0.1";
12
13 src = fetchFromGitLab {
14 owner = "WhyNotHugo";
15 repo = "darkman";
16 rev = "v${version}";
17 hash = "sha256-FaEpVy/0PqY5Bmw00hMyFZb9wcwYwEuCKMatYN8Xk3o=";
18 };
19
20 patches = [
21 ./go-mod.patch
22 ./makefile.patch
23 ];
24
25 postPatch = ''
26 substituteInPlace darkman.service \
27 --replace-fail /usr/bin/darkman $out/bin/darkman
28 substituteInPlace contrib/dbus/nl.whynothugo.darkman.service \
29 --replace-fail /usr/bin/darkman $out/bin/darkman
30 substituteInPlace contrib/dbus/org.freedesktop.impl.portal.desktop.darkman.service \
31 --replace-fail /usr/bin/darkman $out/bin/darkman
32 '';
33
34 vendorHash = "sha256-3lILSVm7mtquCdR7+cDMuDpHihG+gDJTcQa1cM2o7ZU=";
35 nativeBuildInputs = [ scdoc ];
36
37 buildPhase = ''
38 runHook preBuild
39 make build
40 runHook postBuild
41 '';
42
43 installPhase = ''
44 runHook preInstall
45 install -Dm755 darkman -t $out/bin
46 make PREFIX=$out install
47 runHook postInstall
48 '';
49
50 passthru.updateScript = nix-update-script { };
51
52 meta = with lib; {
53 description = "Framework for dark-mode and light-mode transitions on Linux desktop";
54 homepage = "https://gitlab.com/WhyNotHugo/darkman";
55 license = licenses.isc;
56 maintainers = [ maintainers.ajgrf ];
57 platforms = platforms.linux;
58 mainProgram = "darkman";
59 };
60}