feat: nix shell improvements

This commit is contained in:
fusion44 2024-01-14 11:02:25 +01:00
parent b4676e1670
commit fc2ba6fcff
No known key found for this signature in database
3 changed files with 20 additions and 0 deletions

2
.gitignore vendored
View file

@ -6,6 +6,8 @@ htmlcov
scripts/sync_to_blitz.personal.sh
docker/.env
.venv
pyrightconfig.json
# Nix
result

View file

@ -19,6 +19,7 @@ This software is still considered BETA and may contain bugs. Don't expose it to
- [Linux / macOS](#linux--macos-1)
- [Windows](#windows-1)
- [Development](#development)
- [Using the nix package manager](#using-the-nix-package-manager)
- [Installation](#installation-1)
- [Sync changes to a RaspiBlitz](#sync-changes-to-a-raspiblitz)
- [Debugging code running on a remote machine via VSCode](#debugging-code-running-on-a-remote-machine-via-vscode)
@ -99,6 +100,18 @@ poetry shell
(To exit the poetry shell use: `exit`)
#### Using the nix package manager
Blitz API provides a [Nix](https://github.com/NixOS/nix) Flake file to create a development environment. Execute `nix develop` (make sure you have flakes enabled) to enter the environment.
In this environment a hidden folder `.venv` is created to install the python dependencies locally. If pyright can't find these dependencies create the following file in the root
folder of the project:
```json
{
"venvPath": ".",
"venv": ".venv"
}
```
### Installation
```

View file

@ -31,6 +31,11 @@
];
venvDir = "./.venv";
src = null;
shellHook = ''
export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [
pkgs.stdenv.cc.cc
]}
'';
postVenv = ''
unset SOURCE_DATE_EPOCH
'';