Skip to content

Commit

Permalink
add Nix flake
Browse files Browse the repository at this point in the history
remove setuptools override (relaxDeps takes care of it); remove empty extras

use nativebuildInputs instead of propagated for hatchling, which is a build dep

add comments, desc; update flake.lock

set nixos to 23.05, poetry2nix picks up bug on unstable

fix by including python-nostr and overriding python3 version with it, and fix its name; update lockfile

remove hack around nostr lib, remove nostr dependency from project files

remove nostr build from flake as the lib is now local to the repo
  • Loading branch information
jurraca committed Oct 15, 2023
1 parent 3e58670 commit 93dfdf0
Show file tree
Hide file tree
Showing 3 changed files with 214 additions and 2 deletions.
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.

0 comments on commit 93dfdf0

Please sign in to comment.