From 79985c6a39f3aa4e77ceef39afd42ee3ba0b88b9 Mon Sep 17 00:00:00 2001 From: matthieu42morin Date: Wed, 8 May 2024 15:13:30 +0200 Subject: [PATCH] init https://github.com/NixOS/templates/tree/master/python --- flake.nix | 29 +++++++++++++++++++++++++++++ pyproject.toml | 17 +++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 flake.nix create mode 100644 pyproject.toml diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..e8ecbab --- /dev/null +++ b/flake.nix @@ -0,0 +1,29 @@ +{ + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; + inputs.poetry2nix.url = "github:nix-community/poetry2nix"; + + outputs = { self, nixpkgs, poetry2nix }: + let + supportedSystems = [ "x86_64-linux" "x86_64-darwin" "aarch64-linux" "aarch64-darwin" ]; + forAllSystems = nixpkgs.lib.genAttrs supportedSystems; + pkgs = forAllSystems (system: nixpkgs.legacyPackages.${system}); + in + { + packages = forAllSystems (system: let + inherit (poetry2nix.lib.mkPoetry2Nix { pkgs = pkgs.${system}; }) mkPoetryApplication; + in { + default = mkPoetryApplication { projectDir = self; }; + }); + + devShells = forAllSystems (system: let + inherit (poetry2nix.lib.mkPoetry2Nix { pkgs = pkgs.${system}; }) mkPoetryEnv; + in { + default = pkgs.${system}.mkShellNoCC { + packages = with pkgs.${system}; [ + (mkPoetryEnv { projectDir = self; }) + poetry + ]; + }; + }); + }; +} diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..1cd6a0d --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,17 @@ +[tool.poetry] +name = "sample-project" +version = "0.1.0" +description = "" +authors = ["Author Name "] +# readme = "README.md" +# license = "BSD" +packages = [ + { include = "sample_package" } +] + +[tool.poetry.dependencies] +python = "^3.10" + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api"