nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 cmake,
5 extra-cmake-modules,
6 plasma-framework,
7 kwindowsystem,
8 redshift,
9 fetchFromGitHub,
10 fetchpatch,
11}:
12
13let
14 version = "1.0.18";
15in
16
17stdenv.mkDerivation {
18 pname = "redshift-plasma-applet";
19 inherit version;
20
21 src = fetchFromGitHub {
22 owner = "kotelnik";
23 repo = "plasma-applet-redshift-control";
24 rev = "v${version}";
25 sha256 = "122nnbafa596rxdxlfshxk45lzch8c9342bzj7kzrsjkjg0xr9pq";
26 };
27
28 patches = [
29 # This patch fetches from out-of-source repo because the GitHub copy is frozen,
30 # the active fork is now on invent.kde.org. Remove this patch when a new version is released and src is updated
31 # Redshift version >= 1.12 requires the -P option to clear the existing effects before applying shading.
32 # Without it scrolling makes the screen gets darker and darker until it is impossible to see anything.
33 (fetchpatch {
34 url = "https://invent.kde.org/plasma/plasma-redshift-control/-/commit/898c3a4cfc6c317915f1e664078d8606497c4049.patch";
35 sha256 = "0b6pa3fcj698mgqnc85jbbmcl3qpf418mh06qgsd3c4v237my0nv";
36 })
37 ];
38
39 patchPhase = ''
40 substituteInPlace package/contents/ui/main.qml \
41 --replace "redshiftCommand: 'redshift'" \
42 "redshiftCommand: '${redshift}/bin/redshift'" \
43 --replace "redshiftOneTimeCommand: 'redshift -O " \
44 "redshiftOneTimeCommand: '${redshift}/bin/redshift -O "
45
46 substituteInPlace package/contents/ui/config/ConfigAdvanced.qml \
47 --replace "'redshift -V'" \
48 "'${redshift}/bin/redshift -V'"
49 '';
50
51 nativeBuildInputs = [
52 cmake
53 extra-cmake-modules
54 ];
55
56 buildInputs = [
57 plasma-framework
58 kwindowsystem
59 ];
60
61 dontWrapQtApps = true;
62
63 meta = with lib; {
64 description = "KDE Plasma 5 widget for controlling Redshift";
65 homepage = "https://github.com/kotelnik/plasma-applet-redshift-control";
66 license = licenses.gpl2Plus;
67 platforms = platforms.linux;
68 maintainers = with maintainers; [
69 benley
70 zraexy
71 ];
72 };
73}