Skip to content

Commit

Permalink
sunpaper: add meta.mainProgram, fix license, and other cleanup (#256437)
Browse files Browse the repository at this point in the history
* sunpaper: fix meta

* sunpaper: replace rec with finalAttrs idiom

* sunpaper: use lib.getExe

* sunpaper: fix installPhase

* sunpaper: move to pkgs/by-name
  • Loading branch information
eclairevoyant authored Sep 21, 2023
1 parent a59952d commit d126740
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,37 @@
, wallutils
}:

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

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

buildInputs = [
wallutils
sunwait
wallutils
];

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

installPhase = ''
mkdir -p "$out/bin" "$out/share/sunpaper/images"
cp sunpaper.sh $out/bin/sunpaper
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;
Expand All @@ -40,11 +44,12 @@ stdenvNoCC.mkDerivation rec {
$out/bin/sunpaper --help > /dev/null
'';

meta = with lib; {
meta = {
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;
license = lib.licenses.asl20;
mainProgram = "sunpaper";
maintainers = with lib.maintainers; [ eclairevoyant jevy ];
platforms = lib.platforms.linux;
};
}
})
2 changes: 0 additions & 2 deletions pkgs/top-level/all-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13415,8 +13415,6 @@ with pkgs;

sunwait = callPackage ../applications/misc/sunwait { };

sunpaper = callPackage ../tools/X11/sunpaper { };

surface-control = callPackage ../applications/misc/surface-control { };

syntex = callPackage ../tools/graphics/syntex { };
Expand Down

0 comments on commit d126740

Please sign in to comment.