about summary refs log tree commit diff
diff options
context:
space:
mode:
authorGabriel Fontes <hi@m7.rs>2023-11-28 13:20:23 -0300
committerGabriel Fontes <hi@m7.rs>2024-03-26 08:59:00 -0300
commitd3f916b237e5ee4f2c515dab667ebfd6d0559bd9 (patch)
tree7e4d3f01e3cce66fbf374cbf2fc7c706a21d8c06
parent491af1f1cc28df11dfbff049da4134c37d58aee9 (diff)
downloadnixlib-d3f916b237e5ee4f2c515dab667ebfd6d0559bd9.tar
nixlib-d3f916b237e5ee4f2c515dab667ebfd6d0559bd9.tar.gz
nixlib-d3f916b237e5ee4f2c515dab667ebfd6d0559bd9.tar.bz2
nixlib-d3f916b237e5ee4f2c515dab667ebfd6d0559bd9.tar.lz
nixlib-d3f916b237e5ee4f2c515dab667ebfd6d0559bd9.tar.xz
nixlib-d3f916b237e5ee4f2c515dab667ebfd6d0559bd9.tar.zst
nixlib-d3f916b237e5ee4f2c515dab667ebfd6d0559bd9.zip
pureref: download source automatically
Mentioned in https://github.com/NixOS/nixpkgs/issues/250520
-rw-r--r--pkgs/applications/graphics/pureref/default.nix14
1 files changed, 8 insertions, 6 deletions
diff --git a/pkgs/applications/graphics/pureref/default.nix b/pkgs/applications/graphics/pureref/default.nix
index 5a0774a09f43..825ea4c51e19 100644
--- a/pkgs/applications/graphics/pureref/default.nix
+++ b/pkgs/applications/graphics/pureref/default.nix
@@ -1,14 +1,16 @@
-{ lib, appimageTools, requireFile }:
+{ lib, appimageTools, runCommand, curl, gnugrep, cacert }:
 
 appimageTools.wrapType1 rec {
   pname = "pureref";
   version = "1.11.1";
 
-  src = requireFile {
-    name = "PureRef-${version}_x64.Appimage";
-    sha256 = "05naywdgykqrsgc3xybskr418cyvbx7vqs994yv9w8zf98gxvbvm";
-    url = "https://www.pureref.com/download.php";
-  };
+  src = runCommand "PureRef-${version}_x64.Appimage" {
+    nativeBuildInputs = [ curl gnugrep cacert ];
+    outputHash = "sha256-da/dH0ruI562JylpvE9f2zMUSJ56+T7Y0xlP/xr3yhY=";
+  } ''
+    key="$(curl "https://www.pureref.com/download.php" --silent | grep '%3D%3D' | cut -d '"' -f2)"
+    curl "https://www.pureref.com/files/build.php?build=LINUX64.Appimage&version=${version}&downloadKey=$key" --output $out
+  '';
 
   extraInstallCommands = ''
     mv $out/bin/${pname}-${version} $out/bin/${pname}