commit a82649c2d32d14e6bdc45b4cb0239843e5f410fe Author: Makussu Date: Thu Oct 31 15:21:55 2024 +0100 init diff --git a/README.md b/README.md new file mode 100644 index 0000000..9eb258b --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# lol diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..c61f7fd --- /dev/null +++ b/flake.nix @@ -0,0 +1,56 @@ +{ + description = "A basic flake using pyproject.toml project metadata"; + + inputs = { + pyproject-nix = { + url = "github:nix-community/pyproject.nix"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = + { nixpkgs, pyproject-nix, ... }: + let + inherit (nixpkgs) lib; + + project = pyproject-nix.lib.project.loadPyproject { + # Read & unmarshal pyproject.toml relative to this project root. + # projectRoot is also used to set `src` for renderers such as buildPythonPackage. + projectRoot = ./.; + }; + + # This example is only using x86_64-linux + pkgs = nixpkgs.legacyPackages.x86_64-linux; + + python = pkgs.python3; + + in + { + devShells.x86_64-linux.default = + let + # Returns a function that can be passed to `python.withPackages` + arg = project.renderers.withPackages { inherit python; }; + + # Returns a wrapped environment (virtualenv like) with all our packages + pythonEnv = python.withPackages arg; + + in + # Create a devShell like normal. + pkgs.mkShell { packages = [ pythonEnv ]; }; + + # Build our package using `buildPythonPackage + packages.x86_64-linux.default = + let + # Returns an attribute set that can be passed to `buildPythonPackage`. + attrs = project.renderers.buildPythonPackage { inherit python; }; + in + # Pass attributes to buildPythonPackage. + # Here is a good spot to add on any missing or custom attributes. + python.pkgs.buildPythonPackage ( + attrs + // { + env.CUSTOM_ENVVAR = "hello"; + } + ); + }; +} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..0c313a2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,20 @@ +[build-system] +requires = ["setuptools", "setuptools-scm"] +build-backend = "setuptools.build_meta" + +[project] +name = "stock-script" +authors = [ + {name = "Example Author", email = "author@example.com"} +] +description = "package description" +version = "0.0.1" +readme = "README.md" +requires-python = ">=3.7" +dependencies = [ + "requests > 2.26.0", + "pandas" +] + +[project.scripts] +stock = "stock:main"