feat: python_pyproject_nixpkgs_basic

This commit is contained in:
Kiana Sheibani 2025-11-24 02:47:11 -05:00
parent fe347d9769
commit 2aa50d1109
Signed by: toki
GPG key ID: 6CB106C25E86A9F7
7 changed files with 64 additions and 0 deletions

View file

@ -0,0 +1,2 @@
#!/usr/bin/env bash
use flake

View file

@ -0,0 +1,23 @@
{
inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
systems.url = "github:nix-systems/default";
};
outputs = { self, nixpkgs, systems, ... }:
let eachSystem = nixpkgs.lib.genAttrs (import systems);
in {
packages = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
hello = pkgs.callPackage ./package.nix {};
default = self.packages.${system}.hello;
});
devShells = eachSystem (system:
let pkgs = nixpkgs.legacyPackages.${system};
in {
default = pkgs.callPackage ./shell.nix {};
});
};
}

View file

@ -0,0 +1,20 @@
{ python3
}:
python3.pkgs.buildPythonPackage {
pname = "hello";
version = "0.1";
src = ./.;
pyproject = true;
build-system = with python3.pkgs; [
# build-system.{requires,setup_requires}
setuptools
];
dependencies = [
# Python package dependencies
];
doCheck = false;
}

View file

@ -0,0 +1,7 @@
[project]
name = "hello"
version = "0.1.0"
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

View file

@ -0,0 +1,8 @@
{ mkShell
, python3
}:
mkShell {
inputsFrom = [ python3.buildEnv.env ];
packages = [ python3.pkgs.python-lsp-server ];
}

View file

@ -0,0 +1 @@
from .main import *

View file

@ -0,0 +1,3 @@
def hello():
return "Hello, World!"