nixpkgs/pkgs/by-name/su/sunpaper/package.nix
R. Ryantm 88396a022b
sunpaper: 2.0 -> 2.1
Co-authored-by: eclairevoyant <contactmeongithubinstead@proton.me>
2024-08-11 17:44:49 -04:00

57 lines
1.3 KiB
Nix

{ lib
, stdenvNoCC
, fetchFromGitHub
, sunwait
, wallutils
}:
stdenvNoCC.mkDerivation (finalAttrs: {
pname = "sunpaper";
version = "2.1";
src = fetchFromGitHub {
owner = "hexive";
repo = "sunpaper";
rev = "v${finalAttrs.version}";
hash = "sha256-koCK0ntzRf8OXoUj5DJdPWsFDD8EAMjnGdM1B5oeBBc=";
};
buildInputs = [
sunwait
wallutils
];
postPatch = ''
substituteInPlace sunpaper.sh \
--replace-fail "sunwait" "${lib.getExe sunwait}" \
--replace-fail "setwallpaper" "${lib.getExe' wallutils "setwallpaper"}" \
--replace-fail '$HOME/sunpaper/images/' "$out/share/sunpaper/images/" \
--replace-fail '/usr/share' '/etc'
'';
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 = "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;
};
})