about summary refs log tree commit diff
diff options
context:
space:
mode:
authorWeijia Wang <9713184+wegank@users.noreply.github.com>2023-04-19 16:50:16 +0300
committerWeijia Wang <9713184+wegank@users.noreply.github.com>2023-04-19 16:50:16 +0300
commitb344f6cee011f6e46514e25ba81d747021b2fa4c (patch)
tree1b64f025a5c471ec964b5e4981e7cbfad120f4b0
parent5608f9dbad40f3a0495a351eceb8c4debb9e6099 (diff)
rectangle: refactor
-rw-r--r--pkgs/os-specific/darwin/rectangle/default.nix24
1 files changed, 19 insertions, 5 deletions
diff --git a/pkgs/os-specific/darwin/rectangle/default.nix b/pkgs/os-specific/darwin/rectangle/default.nix
index 884a50dc64342..e9eb6e5dc4e33 100644
--- a/pkgs/os-specific/darwin/rectangle/default.nix
+++ b/pkgs/os-specific/darwin/rectangle/default.nix
@@ -1,6 +1,11 @@
-{ lib, stdenv, fetchurl, cpio, xar, undmg, ... }:
+{ lib
+, stdenvNoCC
+, fetchurl
+, undmg
+, gitUpdater
+}:
 
-stdenv.mkDerivation rec {
+stdenvNoCC.mkDerivation rec {
   pname = "rectangle";
   version = "0.67";
 
@@ -9,15 +14,24 @@ stdenv.mkDerivation rec {
     hash = "sha256-tvxGDfpHu86tZt7M055ehEG/lDdmdPmZwrDc2F/yUjk=";
   };
 
-  sourceRoot = "Rectangle.app";
+  sourceRoot = ".";
 
   nativeBuildInputs = [ undmg ];
 
   installPhase = ''
-    mkdir -p $out/Applications/Rectangle.app
-    cp -R . $out/Applications/Rectangle.app
+    runHook preInstall
+
+    mkdir -p $out/Applications
+    mv Rectangle.app $out/Applications
+
+    runHook postInstall
   '';
 
+  passthru.updateScript = gitUpdater {
+    url = "https://github.com/rxhanson/Rectangle";
+    rev-prefix = "v";
+  };
+
   meta = with lib; {
     description = "Move and resize windows in macOS using keyboard shortcuts or snap areas";
     homepage = "https://rectangleapp.com/";