Skip to content

Commit

Permalink
Revert "update cometbft"
Browse files Browse the repository at this point in the history
This reverts commit 414cf7d.
  • Loading branch information
yihuang committed Oct 30, 2024
1 parent 414cf7d commit c58109c
Show file tree
Hide file tree
Showing 5 changed files with 245 additions and 263 deletions.
8 changes: 4 additions & 4 deletions flake.lock

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

200 changes: 90 additions & 110 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/release-24.05";
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
nix-bundle-exe = {
url = "github:3noch/nix-bundle-exe";
Expand All @@ -13,126 +13,106 @@
};
};

outputs =
{
self,
nixpkgs,
nix-bundle-exe,
gomod2nix,
flake-utils,
}:
outputs = { self, nixpkgs, nix-bundle-exe, gomod2nix, flake-utils }:
let
rev = self.shortRev or "dirty";
mkApp = drv: {
type = "app";
program = "${drv}/bin/${drv.meta.mainProgram}";
};
in
(flake-utils.lib.eachDefaultSystem (
system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
(import ./nix/build_overlay.nix)
gomod2nix.overlays.default
self.overlay
];
config = { };
};
in
rec {
packages = pkgs.chain-main-matrix;
apps = {
chain-maind = mkApp packages.chain-maind;
chain-maind-testnet = mkApp packages.chain-maind-testnet;
update-gomod2nix = {
type = "app";
program = "${packages.chain-maind.updateScript}";
};
};
defaultPackage = packages.chain-maind;
defaultApp = apps.chain-maind;
devShells = {
chain-maind = pkgs.mkShell {
buildInputs = [
defaultPackage.go
pkgs.gomod2nix
pkgs.rocksdb
(flake-utils.lib.eachDefaultSystem
(system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [
(import ./nix/build_overlay.nix)
gomod2nix.overlays.default
self.overlay
];
config = { };
};
};
devShell = devShells.chain-maind;
legacyPackages = pkgs;
}
))
// {
overlay =
final: prev:
{
bundle-exe = final.pkgsBuildBuild.callPackage nix-bundle-exe { };
# make-tarball don't follow symbolic links to avoid duplicate file, the bundle should have no external references.
# reset the ownership and permissions to make the extract result more normal.
make-tarball =
drv:
final.runCommand "tarball-${drv.name}"
{
nativeBuildInputs = with final.buildPackages; [
gnutar
gzip
];
}
''
tar cfv - -C "${drv}" \
--owner=0 --group=0 --mode=u+rw,uga+r --hard-dereference . \
| gzip -9 > $out
'';
bundle-win-exe = drv: final.callPackage ./nix/bundle-win-exe.nix { chain-maind = drv; };
}
// (
with final;
let
matrix = lib.cartesianProductOfSets {
network = [
"mainnet"
"testnet"
];
pkgtype = [
"nix" # normal nix package
"bundle" # relocatable bundled package
"tarball" # tarball of the bundle, for distribution and checksum
in
rec {
packages = pkgs.chain-main-matrix;
apps = {
chain-maind = mkApp packages.chain-maind;
chain-maind-testnet = mkApp packages.chain-maind-testnet;
update-gomod2nix = {
type = "app";
program = "${packages.chain-maind.updateScript}";
};
};
defaultPackage = packages.chain-maind;
defaultApp = apps.chain-maind;
devShells = {
chain-maind = pkgs.mkShell {
buildInputs = with pkgs; [
go_1_22
rocksdb
];
};
binaries = builtins.listToAttrs (
builtins.map (
{ network, pkgtype }:
{
name = builtins.concatStringsSep "-" (
[ "chain-maind" ]
++ lib.optional (network != "mainnet") network
++ lib.optional (pkgtype != "nix") pkgtype
);
value =
let
chain-maind = callPackage ./. {
inherit rev network;
};
bundle =
if stdenv.hostPlatform.isWindows then bundle-win-exe chain-maind else bundle-exe chain-maind;
in
if pkgtype == "bundle" then
bundle
else if pkgtype == "tarball" then
make-tarball bundle
else
chain-maind;
}
) matrix
);
in
};
devShell = devShells.chain-maind;
legacyPackages = pkgs;
}
)
) // {
overlay = final: prev: {
bundle-exe = final.pkgsBuildBuild.callPackage nix-bundle-exe { };
# make-tarball don't follow symbolic links to avoid duplicate file, the bundle should have no external references.
# reset the ownership and permissions to make the extract result more normal.
make-tarball = drv: final.runCommand "tarball-${drv.name}"
{
chain-main-matrix = binaries;
}
);
nativeBuildInputs = with final.buildPackages; [ gnutar gzip ];
} ''
tar cfv - -C "${drv}" \
--owner=0 --group=0 --mode=u+rw,uga+r --hard-dereference . \
| gzip -9 > $out
'';
bundle-win-exe = drv: final.callPackage ./nix/bundle-win-exe.nix { chain-maind = drv; };
} // (with final;
let
matrix = lib.cartesianProductOfSets {
network = [ "mainnet" "testnet" ];
pkgtype = [
"nix" # normal nix package
"bundle" # relocatable bundled package
"tarball" # tarball of the bundle, for distribution and checksum
];
};
binaries = builtins.listToAttrs (builtins.map
({ network, pkgtype }: {
name = builtins.concatStringsSep "-" (
[ "chain-maind" ] ++
lib.optional (network != "mainnet") network ++
lib.optional (pkgtype != "nix") pkgtype
);
value =
let
chain-maind = callPackage ./. {
inherit rev network;
};
bundle =
if stdenv.hostPlatform.isWindows then
bundle-win-exe chain-maind
else
bundle-exe chain-maind;
in
if pkgtype == "bundle" then
bundle
else if pkgtype == "tarball" then
make-tarball bundle
else
chain-maind;
})
matrix
);
in
{
chain-main-matrix = binaries;
}
);
};
}
Loading

0 comments on commit c58109c

Please sign in to comment.