From c17d3f21d7725df77f8651747d082d2383f7f00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Moritz=20B=C3=B6hme?= Date: Fri, 3 Nov 2023 14:14:39 +0100 Subject: [PATCH] feat: add python template --- flake.nix | 6 ++++++ templates/python/.envrc | 6 ++++++ templates/python/flake.nix | 15 +++++++++++++++ 3 files changed, 27 insertions(+) create mode 100644 templates/python/.envrc create mode 100644 templates/python/flake.nix diff --git a/flake.nix b/flake.nix index b02ae77..49a344b 100644 --- a/flake.nix +++ b/flake.nix @@ -208,6 +208,12 @@ ]; }) ./hosts; + + templates = { + python = { + path = ./templates/python; + }; + }; }; }; diff --git a/templates/python/.envrc b/templates/python/.envrc new file mode 100644 index 0000000..8c7c1c9 --- /dev/null +++ b/templates/python/.envrc @@ -0,0 +1,6 @@ +use flake +export PYTHONPATH="$(pwd)/src:$PYTHONPATH" +if [ ! -z $NIX_LD ]; then + export LD_LIBRARY_PATH=$NIX_LD_LIBRARY_PATH +fi +layout poetry diff --git a/templates/python/flake.nix b/templates/python/flake.nix new file mode 100644 index 0000000..8a0943a --- /dev/null +++ b/templates/python/flake.nix @@ -0,0 +1,15 @@ +{ + description = "Simple python flake"; + + inputs.nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + + outputs = inputs@{ flake-parts, ... }: + flake-parts.lib.mkFlake { inherit inputs; } { + systems = [ "x86_64-linux" "aarch64-linux" "aarch64-darwin" "x86_64-darwin" ]; + perSystem = { config, self', inputs', pkgs, system, ... }: { + devShells.default = pkgs.mkShell { + buildInputs = with pkgs; [ python3 poetry ]; + }; + }; + }; +}