Hi all
I am trying to configure a service which first executes a nix-shell to prepare environment and after that it starts a streamlit (python) application.
Executing these 2 commands seperately works but configured in a service throws following error.
Jun 07 21:57:32 nixos systemd[1]: llamaindex-streamlit.service: Main process exited, code=exited, status=203/EXEC
Jun 07 21:57:32 nixos systemd[1]: llamaindex-streamlit.service: Failed with result ‘exit-code’.
Here my systemd setup.
‘’’
{ pkgs, … }:
{
systemd.services.llamaindex-streamlit = {
enable = true;
serviceConfig = {
User = "cyrill";
WorkingDirectory = "/home/cyrill/tie/llama-index-playground";
Type = "oneshot";
ExecStart = ["nix-shell /etc/nixos/shell/python.nix" "pipenv run streamlit run app.py --server.port 8080"];
};
};
}
‘’’
This is my python.nix
{ pkgs ? import {
config.allowUnfree = true;
} }:let
manyLinuxFile =
pkgs.writeTextDir “_manylinux.py”
‘’
print(“in _manylinux.py”)
manylinux1_compatible = True
‘’;
in
(pkgs.buildFHSUserEnv {
name = “python-shell”;
targetPkgs = pkgs: (with pkgs; [
python3
pipenv
which
gcc
binutils
ncurses
xorg.libX11
xorg.libXext
xorg.libXrender
xorg.libICE
xorg.libSM
glib
cudatoolkit
]);
profile = ‘’
export PYTHONPATH=${manyLinuxFile.out}:/usr/lib/python3.11/site-packages
‘’;
runScript = “bash”;
}).env
Any sugestion what I’m doing wrong?
thanks
cyrill