Skip to content

Commit

Permalink
Cleanup Nix configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
fare committed Apr 11, 2024
1 parent 4c0ec5b commit 3f51ef2
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 83 deletions.
80 changes: 2 additions & 78 deletions default.nix
Original file line number Diff line number Diff line change
@@ -1,78 +1,2 @@
{ lib
, stdenv
, fetchFromGitHub
, autoreconfHook
, pkg-config
, util-linux
, hexdump
, autoSignDarwinBinariesHook ? null
, wrapQtAppsHook ? null
, boost
, libevent
, miniupnpc
, zeromq
, zlib
, db48
, sqlite
, qrencode
, qtbase ? null
, qttools ? null
, python3
, withGui ? false
, withWallet ? true
}:

stdenv.mkDerivation rec {
pname = if withGui then "sequentia" else "sequentiad";
version = "23.2.1";

src = ./.;

nativeBuildInputs =
[ autoreconfHook pkg-config ]
++ lib.optionals stdenv.isLinux [ util-linux ]
++ lib.optionals stdenv.isDarwin [ hexdump ]
++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ]
++ lib.optionals withGui [ wrapQtAppsHook ];

buildInputs = [ boost libevent miniupnpc zeromq zlib ]
++ lib.optionals withWallet [ db48 sqlite ]
++ lib.optionals withGui [ qrencode qtbase qttools ];

configureFlags = [
"--with-boost-libdir=${boost.out}/lib"
"--disable-bench"
] ++ lib.optionals (!doCheck) [
"--disable-tests"
"--disable-gui-tests"
] ++ lib.optionals (!withWallet) [
"--disable-wallet"
] ++ lib.optionals withGui [
"--with-gui=qt5"
"--with-qt-bindir=${qtbase.dev}/bin:${qttools.dev}/bin"
];

# fix "Killed: 9 test/test_bitcoin"
# https://github.com/NixOS/nixpkgs/issues/179474
hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "fortify" "stackprotector" ];

nativeCheckInputs = [ python3 ];

doCheck = false;

checkFlags =
[ "LC_ALL=en_US.UTF-8" ]
# QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Bitcoin's GUI.
# See also https://github.com/NixOS/nixpkgs/issues/24256
++ lib.optional withGui "QT_PLUGIN_PATH=${qtbase}/${qtbase.qtPluginPrefix}";

enableParallelBuilding = true;

meta = with lib; {
description = "Sequentia is a Bitcoin sidechain dedicated to asset tokenization and decentralized exchanges";
homepage = "https://www.github.com/SequentiaSEQ/SEQ-Core-Elements";
maintainers = [];
license = licenses.mit;
platforms = platforms.unix;
};
}
let pkgs = import ./pkgs.nix; in
pkgs.sequentia
86 changes: 84 additions & 2 deletions pkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,87 @@ let
rev = "0deaf4d5d224fac3cb2ae9c92a4e349c277be982";
sha256 = "sha256-uERpVxRrCUB7ySkGb3NtDmzEkPDn23VfkCtT2hJZty8=";
};
pkgs = import nixpkgs-repo {};
in pkgs
pkgs = import nixpkgs-repo { inherit config; };
config = {
packageOverrides = superPkgs: { inherit sequentia; } // superPkgs;
};
sequentia = pkgs.callPackage pkg {};
pkg = { lib
, stdenv
, fetchFromGitHub
, autoreconfHook
, pkg-config
, util-linux
, hexdump
, autoSignDarwinBinariesHook ? null
, wrapQtAppsHook ? null
, boost
, libevent
, miniupnpc
, zeromq
, zlib
, db48
, sqlite
, qrencode
, qtbase ? null
, qttools ? null
, python3
, withGui ? false
, withWallet ? true
}:

stdenv.mkDerivation rec {
pname = if withGui then "sequentia" else "sequentiad";
version = "23.2.1";

src = ./.;

nativeBuildInputs =
[ autoreconfHook pkg-config ]
++ lib.optionals stdenv.isLinux [ util-linux ]
++ lib.optionals stdenv.isDarwin [ hexdump ]
++ lib.optionals (stdenv.isDarwin && stdenv.isAarch64) [ autoSignDarwinBinariesHook ]
++ lib.optionals withGui [ wrapQtAppsHook ];

buildInputs = [ boost libevent miniupnpc zeromq zlib ]
++ lib.optionals withWallet [ db48 sqlite ]
++ lib.optionals withGui [ qrencode qtbase qttools ];

configureFlags = [
"--with-boost-libdir=${boost.out}/lib"
"--disable-bench"
] ++ lib.optionals (!doCheck) [
"--disable-tests"
"--disable-gui-tests"
] ++ lib.optionals (!withWallet) [
"--disable-wallet"
] ++ lib.optionals withGui [
"--with-gui=qt5"
"--with-qt-bindir=${qtbase.dev}/bin:${qttools.dev}/bin"
];

# fix "Killed: 9 test/test_bitcoin"
# https://github.com/NixOS/nixpkgs/issues/179474
hardeningDisable = lib.optionals (stdenv.isAarch64 && stdenv.isDarwin) [ "fortify" "stackprotector" ];

nativeCheckInputs = [ python3 ];

doCheck = false;

checkFlags =
[ "LC_ALL=en_US.UTF-8" ]
# QT_PLUGIN_PATH needs to be set when executing QT, which is needed when testing Bitcoin's GUI.
# See also https://github.com/NixOS/nixpkgs/issues/24256
++ lib.optional withGui "QT_PLUGIN_PATH=${qtbase}/${qtbase.qtPluginPrefix}";

enableParallelBuilding = true;

meta = with lib; {
description = "Sequentia is a Bitcoin sidechain dedicated to asset tokenization and decentralized exchanges";
homepage = "https://www.github.com/SequentiaSEQ/SEQ-Core-Elements";
maintainers = [];
license = licenses.mit;
platforms = platforms.unix;
};
}; in
pkgs
6 changes: 3 additions & 3 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
let
let
pkgs = import ./pkgs.nix;
sequentia = pkgs.callPackage ./default.nix {};
sequentia = pkgs.sequentia;
in pkgs.mkShell {
inputsFrom = [
sequentia
];
}
}

0 comments on commit 3f51ef2

Please sign in to comment.