diff --git a/README.md b/README.md index 906ee1b..bba1342 100644 --- a/README.md +++ b/README.md @@ -166,6 +166,7 @@ - Fedora 39 - OpenSUSE Leap 15.5 - OpenSUSE Tumbleweed + - NixOS (via nix-shell) - Windows 10 22H2 - Windows 11 22H2 - macOS ??? @@ -206,6 +207,29 @@ sh <(curl https://raw.githubusercontent.com/Woolverine94/biniou/main/oci-rhel.sh sh <(curl https://raw.githubusercontent.com/Woolverine94/biniou/main/oci-debian.sh || wget -O - https://raw.githubusercontent.com/Woolverine94/biniou/main/oci-debian.sh) ``` +#### NixOS (via nix-shell) + +```sh +# Open a port through the firewall to allow temporary (until next boot) remote access for containers and other services +open-port() { + if [ -z "$1" ]; then + echo "Usage: open-port " + return 1 + fi + local port=$1 + sudo iptables -A INPUT -p tcp --dport $port -j ACCEPT + sudo systemctl reload firewall +} + +git clone https://github.com/Woolverine94/biniou +cd biniou +nix-shell +./install.sh +# open-port 7860 # uncomment to open NixOS firewall port if accessing from a remote machine +(sleep 3; xdg-open https://0.0.0.0:7860) & +./webui.sh +``` + ##### Manual installation : 1. **Install** the pre-requisites as root : diff --git a/install.sh b/install.sh index b87a5e8..9183b80 100755 --- a/install.sh +++ b/install.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ENV_PYTHON_TEST="$ENV_BINIOU_PYTHON_VER" if [ "$ENV_PYTHON_TEST" != "" ] then @@ -12,17 +12,18 @@ mkdir -p ./ssl mkdir -p ./models/Audiocraft ## Creating self-signed certificate -openssl req -x509 -newkey rsa:4096 -keyout ./ssl/key.pem -out ./ssl/cert.pem -sha256 -days 3650 -nodes -subj "/C=FR/ST=Paris/L=Paris/O=Biniou/OU=/CN=" +[ ! -e ./ssl/key.pem ] && openssl req -x509 -newkey rsa:4096 -keyout ./ssl/key.pem -out ./ssl/cert.pem -sha256 -days 3650 -nodes -subj "/C=FR/ST=Paris/L=Paris/O=Biniou/OU=/CN=" ## Creating virtual environment eval $PYTHON_VER -m venv ./env source ./env/bin/activate ## Install packages : +set -e # stop if any command below fails pip install -U pip pip install wheel -pip install torch==2.1.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu -FORCE_CMAKE=1 pip install llama-cpp-python pip install -r requirements.txt +FORCE_CMAKE=1 pip install llama-cpp-python +# pip install torch==2.1.0 torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu exit 0 diff --git a/shell.nix b/shell.nix new file mode 100644 index 0000000..9121e2f --- /dev/null +++ b/shell.nix @@ -0,0 +1,37 @@ +{ pkgs ? import {} }: + +pkgs.mkShell { + buildInputs = with pkgs; [ + stdenv.cc.cc.lib + python311 + openssl + perl + ffmpeg + gperftools + libGL + libGLU + glib + xorg.libX11 + xorg.libXi + xorg.libXmu + xorg.libXext + xorg.libXt + xorg.libXfixes + xorg.libXrender + xorg.libXcursor + xorg.libxcb + xorg.libXinerama + xorg.libXrandr + xorg.libXcomposite + ]; + + shellHook = '' + export LD_LIBRARY_PATH=${pkgs.stdenv.cc.cc.lib}/lib:$LD_LIBRARY_PATH + export LD_LIBRARY_PATH=${pkgs.lib.makeLibraryPath [ + pkgs.libGL + pkgs.libGLU + pkgs.xorg.libX11 + pkgs.glib + ]}:$LD_LIBRARY_PATH + ''; +} diff --git a/update.sh b/update.sh index e6884a6..edd7fa0 100755 --- a/update.sh +++ b/update.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [ -f ".ini/llamacpp_backend.cfg" ] then LLAMACPP_ARGS="$(cat .ini/llamacpp_backend.cfg)" diff --git a/update_cuda.sh b/update_cuda.sh index 244f860..a4599af 100755 --- a/update_cuda.sh +++ b/update_cuda.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usrbin/env bash if [ -f ".ini/llamacpp_backend.cfg" ] then LLAMACPP_ARGS="$(cat .ini/llamacpp_backend.cfg)" diff --git a/update_rocm.sh b/update_rocm.sh index d9ab0c5..b535431 100755 --- a/update_rocm.sh +++ b/update_rocm.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash if [ -f ".ini/llamacpp_backend.cfg" ] then LLAMACPP_ARGS="$(cat .ini/llamacpp_backend.cfg)" diff --git a/webui.sh b/webui.sh index 0c79629..ce916b2 100755 --- a/webui.sh +++ b/webui.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ## Detection of TCMalloc RELEASE="$(cat /etc/os-release|grep ^ID)"