]> git.scottworley.com Git - auto-upgrade-with-pinch/commitdiff
Only add pinch if not already present
authorScott Worley <scottworley@scottworley.com>
Mon, 18 May 2020 18:47:10 +0000 (11:47 -0700)
committerScott Worley <scottworley@scottworley.com>
Mon, 18 May 2020 18:48:55 +0000 (11:48 -0700)
overlays/pinch.nix

index 1b2c65f66545284feb21af06df8e1c44e9e17834..3399609f65ad8ba8ac4786da0ea1c29a2d0ae455 100644 (file)
@@ -1,9 +1,14 @@
 self: super: {
-  pinch = super.writeShellScriptBin "pinch" ''
-    exec ${self.python3}/bin/python3 ${super.fetchgit {
-      url = "https://scottworley.com/pinch.git";
-      rev = "1.1";
-      sha256 = "0ilbhvr0d83kfwkm7ak64gik44gi2axfnp9rzsa7g5cwz9qaxdbv";
-    }}/pinch.py "$@"
-  '';
+  pinch = if builtins.hasAttr "pinch" super then
+    super.pinch
+  else
+    super.writeShellScriptBin "pinch" ''
+      exec ${self.python3}/bin/python3 ${
+        super.fetchgit {
+          url = "https://scottworley.com/pinch.git";
+          rev = "1.1";
+          sha256 = "0ilbhvr0d83kfwkm7ak64gik44gi2axfnp9rzsa7g5cwz9qaxdbv";
+        }
+      }/pinch.py "$@"
+    '';
 }