Skip to content

Commit

Permalink
style: Init mkBinaryInstall (#12)
Browse files Browse the repository at this point in the history
* chore: Init mkBinaryInstall function

* chore: Edit mkBinaryInstall

* feat: Init surrealdb v1.4.2 without sha256

* chore: Init example dir

* feat: Init sha256

* style: nix-fmt
  • Loading branch information
haruki7049 authored Jul 1, 2024
1 parent f16dd36 commit 162df00
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 21 deletions.
39 changes: 18 additions & 21 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,24 +1,13 @@
self: super: {
surrealdb = {
"1.4.2" = let
inherit (super.stdenv.hostPlatform) system;
rpath = super.lib.makeLibraryPath [ super.pkgs.gcc-unwrapped ];
in super.stdenv.mkDerivation rec {
pname = "surrealdb";
version = "1.4.2";
self: super:
let
lib = super.lib;
fetchurl = super.fetchurl;
rpath = super.lib.makeLibraryPath [ super.pkgs.gcc-unwrapped ];
mkBinaryInstall = { pname ? "surrealdb", version, url, sha256 }:
super.stdenv.mkDerivation rec {
inherit pname version;

src = {
x86_64-linux = super.fetchurl {
url =
"https://github.com/surrealdb/surrealdb/releases/download/v${version}/surreal-v${version}.linux-amd64.tgz";
hash = "sha256-JaHfiAZFgKP5RS0GCQBakYKHPnIqOtds1J65yTznGoI=";
};
aarch64-linux = super.fetchurl {
url =
"https://github.com/surrealdb/surrealdb/releases/download/v${version}/surreal-v${version}.linux-arm64.tgz";
hash = "sha256-hlMtgEaonW41TTd2Ilrx3oXY5mdnZjfccPmg4x/6qnU=";
};
}.${system};
src = fetchurl { inherit url sha256; };

sourceRoot = ".";

Expand All @@ -36,13 +25,21 @@ self: super: {
patchelf --set-rpath ${rpath} "$out/bin/surreal" || true
'';

meta = with super.lib; {
meta = with lib; {
description =
"A scalable, distributed, collaborative, document-graph database, for the realtime web";
homepage = "https://surrealdb.com/";
mainProgram = "surreal";
license = licenses.bsl11;
};
};
in {
surrealdb = {
"1.4.2" = mkBinaryInstall {
version = "1.4.2";
url =
"https://github.com/surrealdb/surrealdb/releases/download/v1.4.2/surreal-v1.4.2.linux-arm64.tgz";
sha256 = "0xdaz8gy787rf3f3frk7czkdi1fyy5d24xip9lsnx7d88s02slw6";
};
};
}
4 changes: 4 additions & 0 deletions example/v1.4.2.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{ pkgs ? import <nixpkgs> { inherit overlays; }
, overlays ? [ (import ../default.nix) ], mkShell ? pkgs.mkShell }:

mkShell { packages = [ pkgs.surrealdb."1.4.2" ]; }

0 comments on commit 162df00

Please sign in to comment.