about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-11-09 10:45:22 +0100
committerPatryk Niedźwiedziński <pniedzwiedzinski19@gmail.com>2020-11-09 10:45:22 +0100
commit2e0e9de80c9dd47780ec34db4074f942da1befb6 (patch)
tree6cecb0299fc28c73b5fc50d56984bf8fe87be012
parent405b4c64077d138c21e2610f54c40f36dbe7f5d3 (diff)
downloadpnpkgs-2e0e9de80c9dd47780ec34db4074f942da1befb6.tar.gz
pnpkgs-2e0e9de80c9dd47780ec34db4074f942da1befb6.zip
Add gurl
-rw-r--r--default.nix1
-rw-r--r--pkgs/gurl/default.nix66
2 files changed, 67 insertions, 0 deletions
diff --git a/default.nix b/default.nix
index 6f83bba..a684f70 100644
--- a/default.nix
+++ b/default.nix
@@ -25,6 +25,7 @@
   gemget = pkgs.callPackage ./pkgs/gemget { };
   kaiosrt = pkgs.callPackage ./pkgs/kaiosrt { };
   kaios-devenv = pkgs.callPackage ./pkgs/kaiosrt/devenv.nix { };
+  gurl = pkgs.callPackage ./pkgs/gurl { };
 
   st = pkgs.callPackage ./pkgs/larbs/st { };
   dwm = pkgs.callPackage ./pkgs/larbs/dwm { };
diff --git a/pkgs/gurl/default.nix b/pkgs/gurl/default.nix
new file mode 100644
index 0000000..e37d662
--- /dev/null
+++ b/pkgs/gurl/default.nix
@@ -0,0 +1,66 @@
+{ stdenv, fetchurl, fetchFromGitHub, zig }:
+
+## Build
+# stdenv.mkDerivation {
+#   pname = "gurl";
+#   version = "0.1";
+
+#   src = fetchFromGitHub {
+#     owner = "MasterQ32";
+#     repo = "gurl";
+#     rev = "v0.1";
+#     sha256 = "1prg7ywsd78h486lfcqhzxmnx2wai7rr3qzxldw9ggjv1mjf5laq";
+#     fetchSubmodules = true;
+#   };
+
+#   nativeBuildInputs = [ zig ];
+
+#   buildPhase = ''
+#     export XDG_CACHE_HOME=$(mktemp -d)
+#     zig build
+#     rm -rf $XDG_CACHE_HOME
+#   '';
+
+#   installPhase = ''
+#     mkdir -p $out/bin
+#     cp zig-cache/bin/gurl $out/bin
+#   '';
+# }
+
+## Prebuilt
+let
+  inherit (stdenv.hostPlatform) system;
+  throwSystem = throw "Unsupported system: ${system}";
+
+  version = "0.1";
+
+  prebuilts = let
+    base = "https://github.com/MasterQ32/gurl/releases/download";
+  in
+  {
+    x86_64-linux = {
+      url = "${base}/v${version}/gurl-x86_64-linux";
+      sha256 = "0yz3w5mqgl1spszndpbrmy6jvxpfx2n3qlmv4v8f5mp1my6kgysy";
+    };
+    aarch64-linux = {
+      url = "${base}/v${version}/gurl-aarch64-linux";
+      sha256 = "0rwscrnzl29rmg2xpzabv0ww9rc4xsj12ddiw2rn005wag9an1ci";
+    };
+  };
+
+  source = prebuilts.${system} or throwSystem;
+  bin = fetchurl source;
+
+in
+  stdenv.mkDerivation {
+    inherit version;
+    pname = "gurl";
+    unpackPhase = "true";
+
+    installPhase = ''
+      mkdir -p $out/bin
+      cp ${bin} $out/bin/gurl
+      chmod +x $out/bin/gurl
+    '';
+
+  }