Update nix shell config
This commit is contained in:
parent
67cd160015
commit
01a9b1ac4d
3 changed files with 19 additions and 21 deletions
|
|
@ -2,8 +2,6 @@ services:
|
||||||
homepage:
|
homepage:
|
||||||
image: nginx:alpine
|
image: nginx:alpine
|
||||||
container_name: homepage
|
container_name: homepage
|
||||||
ports:
|
|
||||||
- "9000:80"
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./dist:/usr/share/nginx/html
|
- ./dist:/usr/share/nginx/html
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
|
||||||
26
shell.nix
26
shell.nix
|
|
@ -1,4 +1,4 @@
|
||||||
{ pkgs ? import <nixpkgs> {} }:
|
{ pkgs ? import <nixpkgs> {}, isDev ? true, restartRemote ? false, remoteHost ? "hetzner" }:
|
||||||
|
|
||||||
pkgs.mkShell {
|
pkgs.mkShell {
|
||||||
packages = with pkgs; [
|
packages = with pkgs; [
|
||||||
|
|
@ -7,19 +7,31 @@ pkgs.mkShell {
|
||||||
python312Packages.virtualenv
|
python312Packages.virtualenv
|
||||||
];
|
];
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = let
|
||||||
|
venvPath = "$HOME/venv/homepage";
|
||||||
|
in ''
|
||||||
export PIP_REQUIRE_VIRTUALENV=1
|
export PIP_REQUIRE_VIRTUALENV=1
|
||||||
export VENV_PATH=$HOME/venv/homepage
|
export VENV_PATH=${venvPath}
|
||||||
|
|
||||||
if [ ! -d $VENV_PATH ]; then
|
if [ ! -d $VENV_PATH ]; then
|
||||||
python -m venv $VENV_PATH
|
python -m venv $VENV_PATH
|
||||||
fi
|
fi
|
||||||
source $VENV_PATH/bin/activate
|
source $VENV_PATH/bin/activate
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
pip install watchdog
|
|
||||||
|
|
||||||
python parser/md.py
|
${if isDev then ''
|
||||||
python generate.py
|
pip install watchdog
|
||||||
python watch.py
|
python watch.py
|
||||||
|
'' else ''
|
||||||
|
python parser/md.py
|
||||||
|
python generate.py
|
||||||
|
|
||||||
|
rsync -avP --delete ./dist/ ${remoteHost}:/root/homepage/dist
|
||||||
|
rsync -avP ./docker-compose.yml ${remoteHost}:/root/homepage/
|
||||||
|
|
||||||
|
${if restartRemote then ''
|
||||||
|
ssh ${remoteHost} "cd /root/homepage && docker compose down && docker compose up -d"
|
||||||
|
'' else ""}
|
||||||
|
''}
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
12
sync.sh
12
sync.sh
|
|
@ -1,12 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
REMOTE_HOST=hetzner
|
|
||||||
|
|
||||||
python parser/md.py
|
|
||||||
python generate.py
|
|
||||||
rsync -avP --delete ./dist/ ${REMOTE_HOST}:/root/homepage/dist
|
|
||||||
rsync -avP ./docker-compose.yml ${REMOTE_HOST}:/root/homepage/
|
|
||||||
|
|
||||||
if [ "$1" = "--restart" ]; then
|
|
||||||
ssh ${REMOTE_HOST} "cd /root/homepage && docker compose down && docker compose up -d"
|
|
||||||
fi
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue