about summary refs log tree commit diff
path: root/pkgs/tools/X11/sunpaper/default.nix
blob: 116b0225ab0f93031c5d4078b6fb23fb51634004 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
{ lib
, stdenvNoCC
, fetchFromGitHub
, sunwait
, wallutils
}:

stdenvNoCC.mkDerivation rec {
  pname = "sunpaper";
  version = "2.0";

  src = fetchFromGitHub {
    owner = "hexive";
    repo = "sunpaper";
    rev = "v${version}";
    sha256 = "sha256-8s7SS79wCS0nRR7IpkshP5QWJqqKEeBu6EtFPDM+2cM=";
  };

  buildInputs = [
    wallutils
    sunwait
  ];

  postPatch = ''
    substituteInPlace sunpaper.sh \
      --replace "sunwait" "${sunwait}/bin/sunwait" \
      --replace "setwallpaper" "${wallutils}/bin/setwallpaper" \
      --replace '$HOME/sunpaper/images/' "$out/share/sunpaper/images/"
  '';

  installPhase = ''
    mkdir -p "$out/bin" "$out/share/sunpaper/images"
    cp sunpaper.sh $out/bin/sunpaper
    cp -R images $out/share/sunpaper/
  '';

  doInstallCheck = true;

  installCheckPhase = ''
    $out/bin/sunpaper --help > /dev/null
  '';

  meta = with lib; {
    description = "A utility to change wallpaper based on local weather, sunrise and sunset times";
    homepage = "https://github.com/hexive/sunpaper";
    license = lib.licenses.unfree;
    maintainers = with maintainers; [ jevy ];
    platforms = platforms.unix;
  };
}