about summary refs log tree commit diff
path: root/pkgs/by-name/su
diff options
context:
space:
mode:
authoréclairevoyant <848000+eclairevoyant@users.noreply.github.com>2023-09-21 16:38:24 -0400
committerGitHub <noreply@github.com>2023-09-21 22:38:24 +0200
commitd126740fe55b81881abf908b5b4020a9a5af7a64 (patch)
tree8e45dfb436284f05e1824d0a4c561b603e4df295 /pkgs/by-name/su
parenta59952ded851c8914aa5cdf6c2408f8a71e5fa0f (diff)
sunpaper: add meta.mainProgram, fix license, and other cleanup (#256437)
* sunpaper: fix meta

* sunpaper: replace rec with finalAttrs idiom

* sunpaper: use lib.getExe

* sunpaper: fix installPhase

* sunpaper: move to pkgs/by-name
Diffstat (limited to 'pkgs/by-name/su')
-rw-r--r--pkgs/by-name/su/sunpaper/package.nix55
1 files changed, 55 insertions, 0 deletions
diff --git a/pkgs/by-name/su/sunpaper/package.nix b/pkgs/by-name/su/sunpaper/package.nix
new file mode 100644
index 0000000000000..54d8d3d871ac6
--- /dev/null
+++ b/pkgs/by-name/su/sunpaper/package.nix
@@ -0,0 +1,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;
+  };
+})