about summary refs log tree commit diff
path: root/pkgs/by-name/su/sunpaper/package.nix
blob: 54d8d3d871ac664b7aa6f82e4d5968838dde8b2b (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
51
52
53
54
55
{ lib
, stdenvNoCC
, fetchFromGitHub
, sunwait
, wallutils
}:

stdenvNoCC.mkDerivation (finalAttrs: {
  pname = "sunpaper";
  version = "2.0";

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

  buildInputs = [
    sunwait
    wallutils
  ];

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

  installPhase = ''
    runHook preInstall

    install -Dm555 sunpaper.sh $out/bin/sunpaper
    mkdir -p "$out/share/sunpaper/images"
    cp -R images $out/share/sunpaper/

    runHook postInstall
  '';

  doInstallCheck = true;

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

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