Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Merge main branch #10

Merged
merged 17 commits into from
May 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/workflows/fetch-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: fetching-releases
on:
schedule:
- cron: '0 */12 * * *'
workflow_dispatch:
jobs:
update-sources:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: ./fetch-releases.py
- uses: stefanzweifel/[email protected]
with:
commit_message: "ci: Update sources.json"
11 changes: 11 additions & 0 deletions .github/workflows/nix-flake-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
on: [push, pull_request]
name: nix-flake-check
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v26
with:
nix_path: nixpkgs=channel:nixos-unstable
- run: nix flake check --all-systems
48 changes: 48 additions & 0 deletions default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
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";

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};

sourceRoot = ".";

installPhase = ''
runHook preInstall

mkdir -p $out/bin
cp surreal $out/bin/surreal

runHook postInstall
'';

postFixup = ''
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" "$out/bin/surreal" || true
patchelf --set-rpath ${rpath} "$out/bin/surreal" || true
'';

meta = with super.lib; {
description =
"A scalable, distributed, collaborative, document-graph database, for the realtime web";
homepage = "https://surrealdb.com/";
mainProgram = "surreal";
license = licenses.bsl11;
};
};
};
}
40 changes: 40 additions & 0 deletions fetch-releases.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /usr/bin/env nix-shell
#! nix-shell -i python3.11 -p python311 python311Packages.requests

import requests
import json


def get_all_releases(owner, repo):
url = f"https://api.github.com/repos/{owner}/{repo}/releases"
releases = []
page = 1

while True:
response = requests.get(url, params={"page": page})
if response.status_code == 200:
releases_page = json.loads(response.text)
if not releases_page:
break # ページが空の場合、ループを終了します。
releases.extend(releases_page)
page += 1
else:
print(f"Failed to fetch releases: {response.status_code} - {response.text}")
break

return releases


def save_to_json(releases, filename):
with open(filename, "w") as file:
json.dump(releases, file, indent=2)


if __name__ == "__main__":
owner = "surrealdb" # リポジトリの所有者のユーザー名または組織名
repo = "surrealdb" # リポジトリ名

releases = get_all_releases(owner, repo)
if releases:
save_to_json(releases, "sources.json")
print(f"Releases of {repo} saved to sources.json!!")
77 changes: 77 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 26 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
description = "An overlay for Godot";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs/23.11";
treefmt-nix.url = "github:numtide/treefmt-nix";
};

outputs = { self, systems, nixpkgs, treefmt-nix }:
let
eachSystem = f:
nixpkgs.lib.genAttrs (import systems)
(system: f nixpkgs.legacyPackages.${system});
treefmtEval =
eachSystem (pkgs: treefmt-nix.lib.evalModule pkgs ./treefmt.nix);
in {
# Use `nix fmt`
formatter =
eachSystem (pkgs: treefmtEval.${pkgs.system}.config.build.wrapper);

# Use `nix flake check`
checks = eachSystem (pkgs: {
formatting = treefmtEval.${pkgs.system}.config.build.check self;
});
};
}
Loading