96 lines
2.2 KiB
Nix
Raw Normal View History

2026-01-28 16:24:43 +01:00
{
description = "Logos Blockchain Circuits (GitHub Releases)";
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
};
2026-01-28 16:26:46 +01:00
outputs =
{ nixpkgs, ... }:
2026-01-28 16:24:43 +01:00
let
lib = nixpkgs.lib;
2026-01-28 16:26:46 +01:00
systems = [
"x86_64-linux"
2026-01-28 16:51:29 +01:00
"aarch64-linux"
2026-01-28 16:26:46 +01:00
"aarch64-darwin"
"x86_64-windows"
];
2026-01-28 16:24:43 +01:00
2026-01-28 16:51:29 +01:00
forAll = lib.genAttrs systems;
2026-01-28 16:24:43 +01:00
2026-01-28 16:51:29 +01:00
circuitsVersion = "0.4.1";
versions = import ./versions.nix;
circuitsHashes = versions.${circuitsVersion};
2026-01-28 16:24:43 +01:00
2026-01-28 16:26:46 +01:00
githubBase = "https://github.com/logos-blockchain/logos-blockchain-circuits/releases/download";
2026-01-28 16:24:43 +01:00
2026-01-28 16:26:46 +01:00
mkCircuits =
system:
2026-01-28 16:24:43 +01:00
let
pkgs = nixpkgs.legacyPackages.${system};
os =
2026-01-28 16:26:46 +01:00
if pkgs.stdenv.isLinux then
"linux"
else if pkgs.stdenv.isDarwin then
"macos"
else if pkgs.stdenv.isWindows then
"windows"
else
throw "Unsupported OS";
2026-01-28 16:24:43 +01:00
arch =
2026-01-28 16:26:46 +01:00
if pkgs.stdenv.isx86_64 then
"x86_64"
else if pkgs.stdenv.isAarch64 then
"aarch64"
else
throw "Unsupported architecture.";
2026-01-28 16:51:29 +01:00
sha256 =
if circuitsHashes ? ${system} then
circuitsHashes.${system}
else
throw "logos-blockchain-circuits ${circuitsVersion} does not support ${system}.";
2026-01-28 16:24:43 +01:00
in
pkgs.stdenv.mkDerivation {
pname = "logos-blockchain-circuits";
version = circuitsVersion;
phases = [ "installPhase" ];
src = pkgs.fetchurl {
url =
"${githubBase}/v${circuitsVersion}"
+ "/logos-blockchain-circuits-v${circuitsVersion}-${os}-${arch}.tar.gz";
2026-01-28 16:51:29 +01:00
inherit sha256;
2026-01-28 16:24:43 +01:00
};
installPhase = ''
mkdir -p $out
tar -xzf $src -C $out --strip-components=1
'';
meta = {
platforms = [ system ];
};
2026-01-28 16:51:29 +01:00
passthru = {
version = circuitsVersion;
};
2026-01-28 16:24:43 +01:00
};
in
{
2026-01-28 16:26:46 +01:00
packages = forAll (
system:
2026-01-28 16:24:43 +01:00
let
circuits = mkCircuits system;
in
{
inherit circuits;
default = circuits;
}
);
};
}