diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..3550a30 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake diff --git a/.gitignore b/.gitignore index 9e6dc0d..ffc8aa3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,8 @@ +# CIRCUITPY /.Trashes /.fseventsd /.metadata_never_index /boot_out.txt + +# nix flake +/.direnv diff --git a/code.py b/code.py index b9c8fe6..b821b4e 100644 --- a/code.py +++ b/code.py @@ -1,3 +1,4 @@ from adafruit_datetime import datetime, date, time -print("Hello World!") +print("Hello, Mom!") +print("Cur datetime:", datetime.now()) diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..51d80fa --- /dev/null +++ b/flake.lock @@ -0,0 +1,175 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_2": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1694529238, + "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nix-github-actions": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1698974481, + "narHash": "sha256-yPncV9Ohdz1zPZxYHQf47S8S0VrnhV7nNhCawY46hDA=", + "owner": "nix-community", + "repo": "nix-github-actions", + "rev": "4bb5e752616262457bc7ca5882192a564c0472d2", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nix-github-actions", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1700794826, + "narHash": "sha256-RyJTnTNKhO0yqRpDISk03I/4A67/dp96YRxc86YOPgU=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "5a09cb4b393d58f9ed0d9ca1555016a8543c2ac8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "poetry2nix": { + "inputs": { + "flake-utils": "flake-utils_2", + "nix-github-actions": "nix-github-actions", + "nixpkgs": [ + "nixpkgs" + ], + "systems": "systems_3", + "treefmt-nix": "treefmt-nix" + }, + "locked": { + "lastModified": 1700890240, + "narHash": "sha256-AKbWnuDzDuXaYSXHXSj0Sa1DSmUm1KaFNJhf2MEhoS0=", + "owner": "nix-community", + "repo": "poetry2nix", + "rev": "674fc0ef18bb62f3aea7684e09f20046a3cdfedf", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "poetry2nix", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs", + "poetry2nix": "poetry2nix" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_3": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "id": "systems", + "type": "indirect" + } + }, + "treefmt-nix": { + "inputs": { + "nixpkgs": [ + "poetry2nix", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1699786194, + "narHash": "sha256-3h3EH1FXQkIeAuzaWB+nK0XK54uSD46pp+dMD3gAcB4=", + "owner": "numtide", + "repo": "treefmt-nix", + "rev": "e82f32aa7f06bbbd56d7b12186d555223dc399d1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "treefmt-nix", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..4412137 --- /dev/null +++ b/flake.nix @@ -0,0 +1,34 @@ +{ + description = "Application packaged using poetry2nix"; + + inputs = { + flake-utils.url = "github:numtide/flake-utils"; + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + poetry2nix = { + url = "github:nix-community/poetry2nix"; + 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. + pkgs = nixpkgs.legacyPackages.${system}; + inherit (poetry2nix.lib.mkPoetry2Nix {inherit pkgs;}) mkPoetryApplication; + in { + packages = { + myapp = mkPoetryApplication {projectDir = self;}; + default = self.packages.${system}.myapp; + }; + + devShells.default = pkgs.mkShell { + inputsFrom = [self.packages.${system}.myapp]; + packages = with pkgs; [poetry] ++ (with pkgs.python311Packages; [python-lsp-server]); + }; + }); +} diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..a703e15 --- /dev/null +++ b/poetry.lock @@ -0,0 +1,156 @@ +# This file is automatically @generated by Poetry 1.7.0 and should not be changed by hand. + +[[package]] +name = "adafruit-blinka" +version = "8.25.0" +description = "CircuitPython APIs for non-CircuitPython versions of Python such as CPython on Linux and MicroPython." +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "Adafruit-Blinka-8.25.0.tar.gz", hash = "sha256:4cae1655a60c341d97e59108c0fa4f3963e8373b6195381e3b7f76ce1f4c2a5b"}, + {file = "Adafruit_Blinka-8.25.0-py3-none-any.whl", hash = "sha256:6ccb124143bfc1073af7225445c75781e5415ecb97484bd24a9e0d9dbfb90816"}, +] + +[package.dependencies] +adafruit-circuitpython-typing = "*" +Adafruit-PlatformDetect = ">=3.53.0" +Adafruit-PureIO = ">=1.1.7" +pyftdi = ">=0.40.0" + +[[package]] +name = "adafruit-circuitpython-busdevice" +version = "5.2.6" +description = "CircuitPython bus device classes to manage bus sharing." +optional = false +python-versions = "*" +files = [ + {file = "adafruit-circuitpython-busdevice-5.2.6.tar.gz", hash = "sha256:ed06f5552e5567b0c89589c5bc6ef3adcac67d59eb505ce9127af99f33c2bc90"}, + {file = "adafruit_circuitpython_busdevice-5.2.6-py3-none-any.whl", hash = "sha256:9f25577843f0a338a0936a1b57436f4451f7783b38e3cf46160b6be78faeaa44"}, +] + +[package.dependencies] +Adafruit-Blinka = ">=7.0.0" +adafruit-circuitpython-typing = "*" + +[[package]] +name = "adafruit-circuitpython-datetime" +version = "1.2.6" +description = "Subset of CPython datetime module" +optional = false +python-versions = "*" +files = [ + {file = "adafruit-circuitpython-datetime-1.2.6.tar.gz", hash = "sha256:f54867c184d8ae8295c66085893870370470350afebe720a52f715124f556236"}, + {file = "adafruit_circuitpython_datetime-1.2.6-py3-none-any.whl", hash = "sha256:47c70ac4ed63b070136b1a211d3c47e1cce7ae99a5fced4d03b804cbd6db08f1"}, +] + +[package.dependencies] +Adafruit-Blinka = "*" + +[[package]] +name = "adafruit-circuitpython-requests" +version = "2.0.2" +description = "A requests-like library for web interfacing" +optional = false +python-versions = "*" +files = [ + {file = "adafruit-circuitpython-requests-2.0.2.tar.gz", hash = "sha256:fec34d21be9d721a44bd1471e3651630eb7d394ce806de2fb39536dac73408aa"}, + {file = "adafruit_circuitpython_requests-2.0.2-py3-none-any.whl", hash = "sha256:91e7634cd223ee3adf22ca3cf6e8f34713a56a3809031f37ec31b90a3a9f503f"}, +] + +[package.dependencies] +Adafruit-Blinka = "*" + +[[package]] +name = "adafruit-circuitpython-typing" +version = "1.9.5" +description = "Types needed for type annotation that are not in `typing`" +optional = false +python-versions = "*" +files = [ + {file = "adafruit-circuitpython-typing-1.9.5.tar.gz", hash = "sha256:6a2a7a4f60d54348f3c4aad8f4dd0d0f0aaf9c854ddd1761b20d5146440faa1d"}, + {file = "adafruit_circuitpython_typing-1.9.5-py3-none-any.whl", hash = "sha256:02625de1f8fdeb42db5a88999d2dc7a905339b30c673f7a2d8608b840e8520cc"}, +] + +[package.dependencies] +Adafruit-Blinka = "*" +adafruit-circuitpython-busdevice = "*" +adafruit-circuitpython-requests = "*" +typing-extensions = ">=4.0,<5.0" + +[[package]] +name = "adafruit-platformdetect" +version = "3.54.0" +description = "Platform detection for use by libraries like Adafruit-Blinka." +optional = false +python-versions = "*" +files = [ + {file = "Adafruit-PlatformDetect-3.54.0.tar.gz", hash = "sha256:3fe7fb781a83d3f28812bcbff34edd4100afb68901d9c62ee22d07e824d82168"}, + {file = "Adafruit_PlatformDetect-3.54.0-py3-none-any.whl", hash = "sha256:fecae7a6612bbcd32d1f40c2d2f1aa263c554be5e52cc6fa4eebaf8b80c33519"}, +] + +[[package]] +name = "adafruit-pureio" +version = "1.1.11" +description = "Pure python (i.e. no native extensions) access to Linux IO including I2C and SPI. Drop in replacement for smbus and spidev modules." +optional = false +python-versions = ">=3.5.0" +files = [ + {file = "Adafruit_PureIO-1.1.11-py3-none-any.whl", hash = "sha256:281ab2099372cc0decc26326918996cbf21b8eed694ec4764d51eefa029d324e"}, + {file = "Adafruit_PureIO-1.1.11.tar.gz", hash = "sha256:c4cfbb365731942d1f1092a116f47dfdae0aef18c5b27f1072b5824ad5ea8c7c"}, +] + +[[package]] +name = "pyftdi" +version = "0.55.0" +description = "FTDI device driver (pure Python)" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pyftdi-0.55.0-py3-none-any.whl", hash = "sha256:6af7b6c73da1256fd5140076fe77a616c13e44dd0779dd561dac1b5981dbd43f"}, + {file = "pyftdi-0.55.0.tar.gz", hash = "sha256:a747bbbccc4eeea26cefa2c8bd3d2b8bef8c94ecb6969bb9c75a63640887519a"}, +] + +[package.dependencies] +pyserial = ">=3.0" +pyusb = ">=1.0.0,<1.2.0 || >1.2.0" + +[[package]] +name = "pyserial" +version = "3.5" +description = "Python Serial Port Extension" +optional = false +python-versions = "*" +files = [ + {file = "pyserial-3.5-py2.py3-none-any.whl", hash = "sha256:c4451db6ba391ca6ca299fb3ec7bae67a5c55dde170964c7a14ceefec02f2cf0"}, + {file = "pyserial-3.5.tar.gz", hash = "sha256:3c77e014170dfffbd816e6ffc205e9842efb10be9f58ec16d3e8675b4925cddb"}, +] + +[package.extras] +cp2110 = ["hidapi"] + +[[package]] +name = "pyusb" +version = "1.2.1" +description = "Python USB access module" +optional = false +python-versions = ">=3.6.0" +files = [ + {file = "pyusb-1.2.1-py3-none-any.whl", hash = "sha256:2b4c7cb86dbadf044dfb9d3a4ff69fd217013dbe78a792177a3feb172449ea36"}, + {file = "pyusb-1.2.1.tar.gz", hash = "sha256:a4cc7404a203144754164b8b40994e2849fde1cfff06b08492f12fff9d9de7b9"}, +] + +[[package]] +name = "typing-extensions" +version = "4.8.0" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +files = [ + {file = "typing_extensions-4.8.0-py3-none-any.whl", hash = "sha256:8f92fc8806f9a6b641eaa5318da32b44d401efaac0f6678c9bc448ba3605faa0"}, + {file = "typing_extensions-4.8.0.tar.gz", hash = "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.11" +content-hash = "222a24d7a18347e2035b793fd793724c3457b8b2a897e2385917d6ee0b063c71" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..333472f --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,15 @@ +[tool.poetry] +name = "macropad" +version = "1.0.0-alpha" +description = "" +authors = ["Daniel Flanagan "] +license = "GPL" +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.11" +adafruit-circuitpython-datetime = "^1.2.6" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api"