Skip to content

Restore nix-shell on Ubuntu #722

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

Merged
merged 3 commits into from
Mar 5, 2025
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
14 changes: 11 additions & 3 deletions .github/workflows/nix-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@ name: Test nix-shell
on:
push:
branches:
- 'doesnt_exist'
- '*'


jobs:
nix-shell:
continue-on-error: true
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
os: [ubuntu-latest]
# os: [ubuntu-latest, macos-latest]
fail-fast: false
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -27,5 +30,10 @@ jobs:
# Use channel nixos-23.11 for Linux and nixpkgs-23.11-darwin for macOS
nix_path: nixpkgs=channel:${{ matrix.os == 'macos-latest' && 'nixpkgs-24.05-darwin' || 'nixos-24.05' }}

- name: Disable incompatible dependency of `nuls2`
run: |
sed -i.bak '/py-ed25519-bindings/ s/^[[:space:]]*/# /' pyproject.toml
rm pyproject.toml.bak

- name: Run tests
run: nix-shell --run "hatch run testing:test -- ./src/ ./test/"
run: nix-shell --run "hatch run testing:test"
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ dependencies = [
"aleph-message==0.6.1",
"aleph-nuls2==0.1",
"aleph-p2p-client @ git+https://github.com/aleph-im/p2p-service-client-python@cbfebb871db94b2ca580e66104a67cd730c5020c",
"aleph-pytezos==3.13.4",
"asyncpg==0.30",
"base58>=1.0.3",
"coincurve==20",
Expand All @@ -50,6 +49,7 @@ dependencies = [
"pycryptodome==3.21.0", # for libp2p-stubs
"pymultihash==0.8.2", # for libp2p-stubs
"pynacl==1.5",
"pytezos-crypto==3.13.4.1",
"python-dateutil==2.8.2",
"pytz==2023.3",
"pyyaml==6.0.1",
Expand All @@ -62,7 +62,7 @@ dependencies = [
"sqlalchemy-utils==0.38.3",
"substrate-interface==1.7.4",
"types-aiofiles==23.2.0.20240403",
"ujson==5.10.0", # required by aiocache
"ujson==5.10.0", # required by aiocache
"urllib3==2.3",
"uvloop==0.21",
"web3==6.11.2",
Expand Down
29 changes: 17 additions & 12 deletions shell.nix
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
{ pkgs ? import <nixpkgs> {} }:
{ }:
let
unstable = import (fetchTarball https://nixos.org/channels/nixos-unstable/nixexprs.tar.xz) {};
pkgs = import (fetchTarball "https://nixos.org/channels/nixos-24.11/nixexprs.tar.xz") {};
in
pkgs.mkShell {
buildInputs = [
pkgs.glibcLocales
pkgs.libiconv # for macos

pkgs.ps
unstable.libsodium

pkgs.postgresql
pkgs.postgresql.lib
pkgs.redis
pkgs.kubo
unstable.hatch
pkgs.hatch
pkgs.rustup

unstable.python312
unstable.python312Packages.virtualenv
unstable.python312Packages.pip
unstable.python312Packages.setuptools
pkgs.python312
pkgs.python312Packages.virtualenv
pkgs.python312Packages.pip
pkgs.python312Packages.setuptools
pkgs.python312Packages.distutils

unstable.python312Packages.fastecdsa
unstable.python312Packages.greenlet
pkgs.python312Packages.fastecdsa
pkgs.python312Packages.libnacl
pkgs.python312Packages.greenlet
];

shellHook = ''
Expand Down Expand Up @@ -65,13 +67,13 @@ pkgs.mkShell {
fi

# Install the required Python packages
./venv/bin/pip install -e .\[testing\]
./venv/bin/pip install -e ".[testing]"

# PyO3 requires a nightly or dev version of Rust.
rustup default nightly

# If config.yml does not exist, create it with the port specified in this shell.
[ -e config.yml ] || echo -e "postgres:\n port: $PG_PORT" > config.yml
echo -e "postgres:\n host: "localhost"\n port: $PG_PORT" > config.yml

# bold
echo -e "\e[1m"
Expand All @@ -88,5 +90,8 @@ pkgs.mkShell {

# Activate the virtual environment
source venv/bin/activate

# Ensure libpq.so.5 can be found.
export LD_LIBRARY_PATH=${pkgs.postgresql.lib}/lib:$LD_LIBRARY_PATH
'';
}
2 changes: 1 addition & 1 deletion src/aleph/chains/tezos.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

import aiohttp
from aleph_message.models import Chain
from aleph_pytezos.crypto.key import Key
from configmanager import Config
from nacl.exceptions import BadSignatureError
from pytezos_crypto.key import Key

import aleph.toolkit.json as aleph_json
from aleph.chains.abc import ChainReader, Verifier
Expand Down
Loading