support Nix and NixOS

Quick Start for BTC:

    $ git clone https://github.com/mmgen/mmgen-wallet
    $ git clone https://github.com/mmgen/mmgen-node-tools
    $ cd mmgen-node-tools
    $ test/init.sh
    $ nix-shell --pure nix

Enable altcoins and additional packages:

    # From the mmgen-node-tools repository root:
    $ mkdir -p ~/.mmgen
    $ cp ../mmgen-wallet/nix/user-packages.nix ~/.mmgen
    # ... edit ~/.mmgen/user-packages.nix as required ...
    $ nix-shell --pure nix

For NixOS installation and other information, see:

    nix/README.node-tools
    ../mmgen-wallet/nix/README
This commit is contained in:
The MMGen Project 2025-01-03 16:42:11 +03:00
commit bec7df1d6b
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
8 changed files with 121 additions and 2 deletions

View file

@ -1 +1 @@
3.5.dev3
3.5.dev4

11
nix/README.node-tools Normal file
View file

@ -0,0 +1,11 @@
Nix configuration directory for the MMGen Node Tools suite
Usage is as described in ‘nix/README’ in the mmgen-wallet repository, with the
following differences:
a) all commands are executed from the repository root of mmgen-node-tools
instead of mmgen-wallet
b) for NixOS, complete the steps as described up until the rebuild step.
Copy the contents of this directory to ‘/etc/nixos/mmgen-project’ (this
will overwrite ‘default.nix’), and continue with the rebuild step.

6
nix/default.nix Normal file
View file

@ -0,0 +1,6 @@
import (
if builtins.pathExists ./merged-packages.nix then
./merged-packages.nix
else
../../mmgen-wallet/nix/merged-packages.nix
) { add_pkgs_path = ./node-tools-packages.nix; }

View file

@ -0,0 +1,12 @@
{ pkgs, python }:
{
system-packages = with pkgs; {
cacert = cacert; # ticker (curl)
};
python-packages = with python.pkgs; {
yahooquery = (pkgs.callPackage ./yahooquery.nix {}); # ticker
pyyaml = pyyaml; # ticker
};
}

1
nix/shell.nix Normal file
View file

@ -0,0 +1 @@
import ../../mmgen-wallet/nix/shell.nix { add_pkgs_path = ./node-tools-packages.nix; }

View file

@ -0,0 +1,45 @@
diff --git a/pyproject.toml b/pyproject.toml
index 9d3fb29..399c215 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -10,24 +10,24 @@ readme = "README.md"
[tool.poetry.dependencies]
python = ">=3.8.1,<4.0"
-requests = "^2.31.0"
-pandas = "^2.0.3"
-requests-futures = "^1.0.1"
-tqdm = "^4.65.0"
-lxml = "^4.9.3"
-selenium = {version = "^4.10.0", optional = true}
-beautifulsoup4 = "^4.12.2"
+requests = ">=2.31.0"
+pandas = ">=2.0.3"
+requests-futures = ">=1.0.1"
+tqdm = ">=4.65.0"
+lxml = ">=4.9.3"
+selenium = {version = ">=4.10.0", optional = true}
+beautifulsoup4 = ">=4.12.2"
[tool.poetry.dev-dependencies]
-pytest = "^7.4.0"
-isort = "^5.0.0"
-flake8 = "^6.0.0"
-mypy = "^1.4.1"
-pytest-cov = "^4.1.0"
-black = "^23.7.0"
-pre-commit = "^3.3.3"
-ipython = "^8.0.0"
-mkdocs-material = "^9.1.18"
+pytest = ">=7.4.0"
+isort = ">=5.0.0"
+flake8 = ">=6.0.0"
+mypy = ">=1.4.1"
+pytest-cov = ">=4.1.0"
+black = ">=23.7.0"
+pre-commit = ">=3.3.3"
+ipython = ">=8.0.0"
+mkdocs-material = ">=9.1.18"
[build-system]
requires = ["poetry-core>=1.0.0"]

44
nix/yahooquery.nix Normal file
View file

@ -0,0 +1,44 @@
{
lib,
pkgs,
fetchFromGitHub,
}:
with pkgs.python312.pkgs;
buildPythonPackage rec {
pname = "yahooquery";
version = "2.3.7";
pyproject = true;
disabled = pythonOlder "3.8.1";
src = fetchFromGitHub {
owner = "dpguthrie";
repo = "yahooquery";
rev = "refs/tags/v${version}";
hash = "sha256-Iyuni1SoTB6f7nNFhN5A8Gnv9kV78frjpqvvW8qd+/M=";
};
patches = [ ./yahooquery-noversioning.patch ];
build-system = [ poetry-core ];
dependencies = [
requests # ^2.31.0
pandas # ^2.0.3
requests-futures # ^1.0.1
tqdm # ^4.65.0
lxml # ^4.9.3
selenium # {version = ^4.10.0, optional = true}
beautifulsoup4 # ^4.12.2
];
doCheck = false; # skip tests
meta = with lib; {
description = "Python wrapper for an unofficial Yahoo Finance API";
homepage = "https://yahooquery.dpguthrie.com";
license = licenses.mit;
};
}

View file

@ -38,7 +38,7 @@ python_requires = >=3.9
include_package_data = True
install_requires =
mmgen-wallet>=15.1.dev6
mmgen-wallet>=15.1.dev9
pyyaml
yahooquery