Skip to content
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

Add Nix flake (WIP) #335

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
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
139 changes: 139 additions & 0 deletions flake.lock

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

63 changes: 63 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
description = "Cashu is a Chaumian Ecash wallet and mint for Bitcoin Lightning.";

inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-23.05";
inputs.poetry2nix = {
# the most recent poetry2nix seems to have a bug, we pin to an earlier version
url = "github:nix-community/poetry2nix/2023.10.05.49422";
inputs.nixpkgs.follows = "nixpkgs";
};

outputs = {
self,
nixpkgs,
flake-utils,
poetry2nix,
}:
flake-utils.lib.eachDefaultSystem (system: let
# see https://github.com/nix-community/poetry2nix/tree/master#api for more functions and examples.
inherit (poetry2nix.legacyPackages.${system}) mkPoetryApplication;
pkgs = import nixpkgs { inherit system; };
in {
packages = {
cashu =
(mkPoetryApplication {
projectDir = ./.;
# don't check dev deps
checkGroups = [];
overrides = pkgs.poetry2nix.overrides.withDefaults (final: prev: {
urllib3 = prev.urllib3.overridePythonAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [final.hatchling];
});
attrs = prev.attrs.overridePythonAttrs (old: {
nativeBuildInputs = old.nativeBuildInputs ++ [final.hatchling final.hatch-fancy-pypi-readme final.hatch-vcs];
});
cryptography = prev.cryptography.override {preferWheel = true;};
bip32 = prev.buildPythonPackage {
name = "bip32";
propagatedBuildInputs = with final; [coincurve base58];
nativeBuildInputs = with final; [setuptools hatchling];
src = pkgs.fetchFromGitHub {
owner = "darosior";
repo = "python-bip32";
rev = "1492d39312f1d9630363c292f6ab8beb8ceb16dd";
sha256 = "sha256-o8UKR17XDWp1wTWYeDL0DJY+D11YI4mg0UuGEAPkHxE=";
};
};
});
})
.overridePythonAttrs (old: {
propagatedBuildInputs = old.propagatedBuildInputs ++ [pkgs.python3Packages.setuptools];
nativeBuildInputs = old.nativeBuildInputs ++ [pkgs.python3Packages.pythonRelaxDepsHook ];
pythonRelaxDeps = ["setuptools"];
});
default = self.packages.${system}.cashu;
};

devShells.default = pkgs.mkShell {
packages = [poetry2nix.packages.${system}.poetry];
buildInputs = with pkgs; [pkg-config];
};
});
}
14 changes: 12 additions & 2 deletions poetry.lock

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

Loading