From 84def6f0b3d7812e333a4379f9bc7c9d94e61cb2 Mon Sep 17 00:00:00 2001 From: mat ess Date: Sun, 13 Aug 2023 18:05:42 -0400 Subject: [PATCH] Update readme and fix flake build --- .gitignore | 1 + README.md | 50 +++++++++++++++++++++++++++++++------------------- flake.nix | 24 ++++++++++++++---------- 3 files changed, 46 insertions(+), 29 deletions(-) diff --git a/.gitignore b/.gitignore index 2d9b9da..ed2d16b 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ __pycache__ .coverage .hypothesis .direnv +result diff --git a/README.md b/README.md index 02bda04..5b6b17f 100644 --- a/README.md +++ b/README.md @@ -6,26 +6,38 @@ for initiative! ```bash $ roll 2d20 -1 ..... 15 -2 ..... 9 -total | 24 +throwing 2d20: +1: ┆ 8 +2: ┆ 6 +total: ╰╶╶ 14 $ roll 5d4+2 -1 ..... 2 -2 ..... 2 -3 ..... 4 -4 ..... 1 -5 ..... 3 -mod .. +2 -total | 14 +throwing 5d4+2: +1: ┆ 3 +2: ┆ 4 +3: ┆ 2 +4: ┆ 4 +5: ┆ 1 +mod: ┆ +2 +total: ╰╶╶ 16 + +$ roll # defaults to 1d20 +throwing 1d20: +1: ┆ 20 +total: ╰╶╶ 20 +critical hit! + +$ roll advantage # or roll adv, roll a +throwing 2d20 with advantage: +1: ┆ 3 +2: ┆ 14 +total: ╰╶╶ 14 + +$ roll disadvantage # or roll dis, roll d +throwing 2d20 with disadvantage: +1: ┆ 1 +2: ┆ 19 +total: ╰╶╶╶ 1 +critical miss! -$ roll 1d20 -1 ..... 1 -total | 1 ``` - -## todo - -- [x] roll with (dis)advantage -- [x] print criticals -- [x] use property testing diff --git a/flake.nix b/flake.nix index c384b5a..725ac82 100644 --- a/flake.nix +++ b/flake.nix @@ -15,11 +15,22 @@ systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; perSystem = { config, self', inputs', pkgs, system, ... }: let - package = pkgs.python3.pkgs.buildPythonApplication { + buildPkgs = builtins.attrValues { + inherit (pkgs.python311Packages) + hatchling + tomli + ; + hatch = pkgs.hatch.override { + python3 = pkgs.python311; + }; + }; + package = pkgs.python311.pkgs.buildPythonApplication { pname = "roll"; version = "0.1.0"; src = ./.; format = "pyproject"; + + nativeBuildInputs = buildPkgs; }; in { @@ -35,15 +46,7 @@ ${config.pre-commit.installationScript} echo "welcome to your python project >~(:)=====--" 1>&2 ''; - nativeBuildInputs = builtins.attrValues { - inherit (pkgs.python311Packages) - hatchling - tomli - ; - hatch = pkgs.hatch.override { - python3 = pkgs.python311; - }; - }; + nativeBuildInputs = buildPkgs; buildInputs = builtins.attrValues { inherit (pkgs) autoflake @@ -54,6 +57,7 @@ inherit (pkgs.python311Packages) ipython ; + roll = package; }; }; };