nixify
This commit is contained in:
parent
28caa06771
commit
68803636ac
34
default.nix
Normal file
34
default.nix
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
packageName,
|
||||||
|
version,
|
||||||
|
|
||||||
|
buildPythonPackage,
|
||||||
|
|
||||||
|
# build-system
|
||||||
|
setuptools_scm,
|
||||||
|
|
||||||
|
# dependencies
|
||||||
|
pydantic,
|
||||||
|
typing-extensions,
|
||||||
|
}:
|
||||||
|
|
||||||
|
let
|
||||||
|
pname = (builtins.replaceStrings ["-"] ["_"] packageName);
|
||||||
|
in buildPythonPackage rec {
|
||||||
|
inherit pname version;
|
||||||
|
pyproject = true;
|
||||||
|
build-system = [ setuptools_scm ];
|
||||||
|
src = ./.;
|
||||||
|
|
||||||
|
propagatedBuildInputs = [
|
||||||
|
pydantic
|
||||||
|
typing-extensions
|
||||||
|
];
|
||||||
|
|
||||||
|
pythonImportsCheck = [ pname ];
|
||||||
|
|
||||||
|
meta = {
|
||||||
|
description = "Add support for deserialization of pydantic child models";
|
||||||
|
homepage = "https://git.chaosbit.de/bit/pydanticuuidmodel";
|
||||||
|
};
|
||||||
|
}
|
||||||
27
flake.lock
generated
Normal file
27
flake.lock
generated
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1730785428,
|
||||||
|
"narHash": "sha256-Zwl8YgTVJTEum+L+0zVAWvXAGbWAuXHax3KzuejaDyo=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "4aa36568d413aca0ea84a1684d2d46f55dbabad7",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
59
flake.nix
Normal file
59
flake.nix
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
{
|
||||||
|
description = "Add support for deserialization of pydantic child models";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs?ref=nixos-unstable";
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs }: let
|
||||||
|
system = "x86_64-linux";
|
||||||
|
pkgs = import nixpkgs { inherit system; };
|
||||||
|
packageName = "pydantic-uuid-model";
|
||||||
|
version = "1.1.0";
|
||||||
|
|
||||||
|
pydantic = (ps: ps.buildPythonPackage rec {
|
||||||
|
pname = "pydantic";
|
||||||
|
version = "1.9.1";
|
||||||
|
src = ps.fetchPypi {
|
||||||
|
inherit pname version;
|
||||||
|
sha256 = "sha256-HtmHw/8p//f9jD6jo+qHetMQquLvmImhGeItPy2waRo=";
|
||||||
|
};
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
|
||||||
|
packages."${system}" = {
|
||||||
|
"${packageName}" = pkgs.python3Packages.callPackage ./default.nix {
|
||||||
|
inherit packageName version;
|
||||||
|
pydantic = (pydantic pkgs.python3Packages);
|
||||||
|
};
|
||||||
|
|
||||||
|
default = self.packages."${system}"."${packageName}";
|
||||||
|
|
||||||
|
overlay = (final: prev: {
|
||||||
|
pythonPackagesExtensions = prev.pythonPackagesExtensions ++ [
|
||||||
|
(final: prev: {
|
||||||
|
"${packageName}" = self.packages."${system}".default;
|
||||||
|
})
|
||||||
|
];
|
||||||
|
});
|
||||||
|
|
||||||
|
dependencies = with pkgs; [ ];
|
||||||
|
};
|
||||||
|
|
||||||
|
devShell."${system}" = let
|
||||||
|
pkgs = import nixpkgs {
|
||||||
|
inherit system;
|
||||||
|
overlays = [ self.packages."${system}".overlay ];
|
||||||
|
};
|
||||||
|
|
||||||
|
customPython = with pkgs; (pkgs.python3.withPackages (ps: [
|
||||||
|
ps."${packageName}"
|
||||||
|
]));
|
||||||
|
|
||||||
|
packages = [ customPython ] ++ self.packages."${system}".dependencies;
|
||||||
|
in pkgs.mkShell {
|
||||||
|
inherit packages;
|
||||||
|
};
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user