add poetry template

This commit is contained in:
Noah Masur
2022-06-20 23:34:24 -04:00
parent f5ab31dd82
commit b7788431d2
7 changed files with 136 additions and 3 deletions

1
templates/poetry/.envrc Normal file
View File

@ -0,0 +1 @@
use flake . --no-use-registries

4
templates/poetry/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
.direnv
result
*.pyc
.DS_Store

92
templates/poetry/flake.lock generated Normal file
View File

@ -0,0 +1,92 @@
{
"nodes": {
"flake-utils": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"locked": {
"lastModified": 1653893745,
"narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1655779787,
"narHash": "sha256-Z5VL2AANN3Rk92xFs/3pPVyDQVTIcmNAIeTQNFOJnNE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ce83dc760cd3428ce9938aa711a0c7c81f55c567",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1655779787,
"narHash": "sha256-Z5VL2AANN3Rk92xFs/3pPVyDQVTIcmNAIeTQNFOJnNE=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "ce83dc760cd3428ce9938aa711a0c7c81f55c567",
"type": "github"
},
"original": {
"owner": "NixOS",
"repo": "nixpkgs",
"type": "github"
}
},
"poetry2nix": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1655482677,
"narHash": "sha256-IGTwio1b4C7Etn4gBb76NILDS+8BsOmDlG8+dhfZL40=",
"owner": "nix-community",
"repo": "poetry2nix",
"rev": "ea3bd4eb70a3f9ead0dd88dab23e42c542e69c07",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "poetry2nix",
"type": "github"
}
},
"root": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs",
"poetry2nix": "poetry2nix"
}
}
},
"root": "root",
"version": 7
}

View File

@ -0,0 +1,27 @@
{
description = "Python project flake";
inputs.flake-utils.url = "github:numtide/flake-utils";
inputs.nixpkgs.url = "github:NixOS/nixpkgs";
inputs.poetry2nix.url = "github:nix-community/poetry2nix";
outputs = { self, nixpkgs, flake-utils, poetry2nix }:
flake-utils.lib.eachDefaultSystem (system:
let
pkgs = import nixpkgs {
inherit system;
overlays = [ poetry2nix.overlay ];
};
projectDir = ./.;
in {
defaultPackage =
pkgs.poetry2nix.mkPoetryApplication { inherit projectDir; };
devShells.default = pkgs.mkShell {
buildInputs = [
(pkgs.poetry2nix.mkPoetryEnv { inherit projectDir; })
pkgs.poetry
];
};
});
}