From c52e809a998532cbde32493af9fca15c40996a11 Mon Sep 17 00:00:00 2001 From: Ingolf Wagner Date: Wed, 9 Mar 2022 06:51:59 +0100 Subject: [PATCH] add neo4j --- nixos/configs/pepe/configuration.nix | 1 + nixos/configs/pepe/neo4j.nix | 89 ++++++++++++++++++++++++++++ nixos/configs/sterni/packages.nix | 2 + nixos/modules/programs/video.nix | 42 ++++++------- 4 files changed, 113 insertions(+), 21 deletions(-) create mode 100644 nixos/configs/pepe/neo4j.nix diff --git a/nixos/configs/pepe/configuration.nix b/nixos/configs/pepe/configuration.nix index b4b434e..6dad1a4 100644 --- a/nixos/configs/pepe/configuration.nix +++ b/nixos/configs/pepe/configuration.nix @@ -18,6 +18,7 @@ ./mpd.nix ./grocy.nix ./taskwarrior-pushover.nix + ./neo4j.nix ]; diff --git a/nixos/configs/pepe/neo4j.nix b/nixos/configs/pepe/neo4j.nix new file mode 100644 index 0000000..afcd0e9 --- /dev/null +++ b/nixos/configs/pepe/neo4j.nix @@ -0,0 +1,89 @@ +{ config, lib, pkgs, ... }: + +{ + + # neo4j container managment + # ------------------------- + + virtualisation.oci-containers.containers = + let + neo4j_config = { + image = "neo4j"; + environment = { + NEO4J_AUTH = "none"; # for development purpose + NEO4J_apoc_export_file_enabled = "true"; + NEO4J_apoc_import_file_enabled = "true"; + NEO4J_apoc_import_file_use__neo4j__config = "true"; + NEO4JLABS_PLUGINS = ''["apoc","n10s"]''; + }; + ports = [ + "127.0.0.1:7474:7474" # http port + "127.0.0.1:17687:7687" # bolt port + ]; + volumes = [ + "/var/lib/neo4j/data:/data" + "/var/lib/neo4j/logs:/logs" + "/var/lib/neo4j/conf:/conf" + "/var/lib/neo4j/import:/import" # for database imports + "/var/lib/neo4j/plugins:/plugins" + + ]; + }; + in + { + neo4j = neo4j_config; + #neo4jbackup = neo4j_config // { + # autoStart = false; + # volumes = [ + # "/var/lib/neo4j/data:/data" + # "/var/lib/neo4j/backups:/backups" + # ]; + # cmd = ["neo4j-admin" "dump" "--verbose" "--to=/backups/neo4j.dump"]; + #}; + }; + + #systemd.services."docker-neo4jbackup" = { + # preStart = "systemctrl stop docker-neo4j"; + # postStop = "systemctrl start docker-neo4j"; + #}; + + + # backups + # ------- + backup.dirs = [ "/var/lib/neo4j/backups" ]; + + # todo run frequently : + # docker exec --interactive --tty neo4j neo4j-admin dump --verbose --to /dump/neo4j.dump + # https://neo4j.com/docs/operations-manual/current/docker/maintenance/ + + + # nginx publishing + # ---------------- + services.nginx.streamConfig = '' + # configure neo4j bolt port + server { + allow 192.168.0.0/16; # allow private ip range class c + allow ${config.module.cluster.services.tinc."private".networkSubnet}; # allow private tinc network + deny all; + listen 7687; + proxy_pass localhost:17687; + } + ''; + + services.nginx.virtualHosts."neo4j.${config.networking.hostName}.private" = { + serverAliases = [ config.networking.hostName ]; + locations."/" = { + extraConfig = '' + allow 192.168.0.0/16; # allow private ip range class c + allow ${config.module.cluster.services.tinc."private".networkSubnet}; # allow private tinc network + deny all; + ''; + proxyPass = "http://localhost:7474"; + }; + }; + + networking.firewall.allowedTCPPorts = [ 80 7687 ]; + #networking.firewall.allowedUDPPorts = [ 80 ]; + + +} diff --git a/nixos/configs/sterni/packages.nix b/nixos/configs/sterni/packages.nix index c5eb42f..ccc6f21 100644 --- a/nixos/configs/sterni/packages.nix +++ b/nixos/configs/sterni/packages.nix @@ -39,6 +39,8 @@ in exec ${pkgs.nixUnstable}/bin/nix --experimental-features "nix-command flakes" "$@" '') + neo4j-desktop + sweethome3d.application pkgs.polygon-art.polygon-art diff --git a/nixos/modules/programs/video.nix b/nixos/modules/programs/video.nix index a3bedbe..7ac506b 100644 --- a/nixos/modules/programs/video.nix +++ b/nixos/modules/programs/video.nix @@ -4,27 +4,27 @@ with lib; let -# Lassulus streaming setup -# ------------------------- -# ffmpeg \ -# -f pulse \ -# -i default \ -# -vaapi_device /dev/dri/renderD128 \ -# -f x11grab \ -# -video_size 1366x768 \ -# -i :0 \ -# -vf 'hwupload,scale_vaapi=format=nv12' \ -# -c:v h264_vaapi \ -# -c:a aac \ -# -b:a 96k \ -# -af "highpass=f=200, lowpass=f=3000" \ -# -qp 30 \ -# -f flv \ -# rtmp://lassul.us:1935/stream/nixos \ -# ./rc3-output-$(date +%d%H%M%S).mp4 -# -# Dann abspielen mit : -# mpv rtmp://lassul.us:1935/stream/nixos + # Lassulus streaming setup + # ------------------------- + # ffmpeg \ + # -f pulse \ + # -i default \ + # -vaapi_device /dev/dri/renderD128 \ + # -f x11grab \ + # -video_size 1366x768 \ + # -i :0 \ + # -vf 'hwupload,scale_vaapi=format=nv12' \ + # -c:v h264_vaapi \ + # -c:a aac \ + # -b:a 96k \ + # -af "highpass=f=200, lowpass=f=3000" \ + # -qp 30 \ + # -f flv \ + # rtmp://lassul.us:1935/stream/nixos \ + # ./rc3-output-$(date +%d%H%M%S).mp4 + # + # Dann abspielen mit : + # mpv rtmp://lassul.us:1935/stream/nixos cfg = config.programs.custom.video;