mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
packaging-nix: Add villas-python package
Signed-off-by: Philipp Jungkamp <Philipp.Jungkamp@opal-rt.com>
This commit is contained in:
parent
f9853f52c7
commit
c3779aa1d1
3 changed files with 63 additions and 0 deletions
|
@ -97,6 +97,10 @@
|
|||
packagesWith = pkgs: rec {
|
||||
default = villas;
|
||||
|
||||
villas-python = pkgs.callPackage ./python.nix {
|
||||
src = ../../python;
|
||||
};
|
||||
|
||||
villas-minimal = pkgs.callPackage ./villas.nix {
|
||||
src = ../..;
|
||||
version = "minimal";
|
||||
|
|
23
packaging/nix/python.nix
Normal file
23
packaging/nix/python.nix
Normal file
|
@ -0,0 +1,23 @@
|
|||
# SPDX-FileCopyrightText: 2023 OPAL-RT Germany GmbH
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
{
|
||||
src,
|
||||
python3Packages,
|
||||
villas-minimal,
|
||||
}:
|
||||
python3Packages.buildPythonPackage {
|
||||
name = "villas-python";
|
||||
src = src;
|
||||
propagatedBuildInputs = with python3Packages; [
|
||||
linuxfd
|
||||
requests
|
||||
villas-minimal
|
||||
];
|
||||
nativeCheckInputs = with python3Packages; [
|
||||
black
|
||||
flake8
|
||||
mypy
|
||||
pytest
|
||||
types-requests
|
||||
];
|
||||
}
|
36
python/.envrc
Normal file
36
python/.envrc
Normal file
|
@ -0,0 +1,36 @@
|
|||
# SPDX-FileCopyrightText: 2014-2023 Institute for Automation of Complex Power Systems, RWTH Aachen University
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
export_or_unset()
|
||||
{
|
||||
local var=$1
|
||||
|
||||
if [ -z "${!var+x}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -n "$2" ]; then
|
||||
export $var="$2"
|
||||
else
|
||||
unset $var
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
if direnv_version "2.30.0" \
|
||||
&& has nix \
|
||||
&& nix show-config experimental-features 2>/dev/null | grep -wqF flakes
|
||||
then
|
||||
local oldtmp="$TMP"
|
||||
local oldtemp="$TEMP"
|
||||
local oldtmpdir="$TMPDIR"
|
||||
local oldtempdir="$TEMPDIR"
|
||||
|
||||
watch_file ../packaging/nix/*.nix
|
||||
use flake ../packaging/nix#villas-python
|
||||
|
||||
export_or_unset TMP "$oldtmp"
|
||||
export_or_unset TEMP "$oldtemp"
|
||||
export_or_unset TMPDIR "$oldtmpdir"
|
||||
export_or_unset TEMPDIR "$oldtempdir"
|
||||
fi
|
Loading…
Add table
Reference in a new issue