commit 41e150734e49cbec10739a898305909283c04598 Author: Brian Lee Date: Tue Oct 29 12:35:34 2024 -0700 Initialize sanitized repo for tracking nix config changes. diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ce0e25f --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +.stfolder +secrets.nix +archive/ +glance/config.yaml +litellm.yaml \ No newline at end of file diff --git a/litten.brenise.dev/configuration.nix b/litten.brenise.dev/configuration.nix new file mode 100644 index 0000000..e349650 --- /dev/null +++ b/litten.brenise.dev/configuration.nix @@ -0,0 +1,536 @@ +{ config, pkgs, lib, ... }: + +let + # Add nixpkgs-unstable channel with the following command: + # nix-channel --add https://nixos.org/channels/nixpkgs-unstable nixpkgs-unstable && nix-channel --update + unstable = import { config = config.nixpkgs.config; }; + host_name = "litten"; + host_fqdn = "${host_name}.brenise.dev"; +in +{ + imports = [ + ./hardware-configuration.nix + ]; + nixpkgs = { + config.permittedInsecurePackages = [ + "electron-27.3.11" # logseq + ]; + config.allowUnfreePredicate = pkg: + builtins.elem (lib.getName pkg) [ + "obsidian" # https://github.com/obsidianmd/obsidian-releases + "packer" + "vscode" + "terraform" + "zoom" + ]; + overlays = [ + (self: super: { + ansible = super.ansible.overrideAttrs (oldAttrs: { + propagatedBuildInputs = oldAttrs.propagatedBuildInputs ++ [ super.python311Packages.jmespath ]; + }); + }) + ]; + }; + + boot = { + loader = { + systemd-boot.enable = true; + systemd-boot.configurationLimit = 20; + efi.canTouchEfiVariables = true; + }; + }; + + hardware = { + bluetooth.enable = true; + keyboard.qmk.enable = true; + + opengl = { # https://wiki.nixos.org/wiki/Accelerated_Video_Playback + enable = true; + extraPackages = with pkgs; [ + intel-media-driver + ]; + }; + }; + + networking = { + hostName = "${host_name}"; + # networkmanager.enable = true; + firewall.enable = false; + interfaces = { + enp100s0.ipv4.addresses = [{ + address = "192.168.1.35"; + prefixLength = 24; + }]; + }; + defaultGateway = { + address = "192.168.1.1"; + interface = "enp100s0"; + }; + # TODO https://nixos.wiki/wiki/Encrypted_DNS + nameservers = [ "1.1.1.1" "8.8.8.8" ]; + extraHosts = '' + 192.168.1.1 shinx.brenise.dev + ''; + }; + + time.timeZone = "America/Los_Angeles"; + + i18n.defaultLocale = "en_US.UTF-8"; + console = { + font = "Lat2-Terminus16"; +# keyMap = "us"; + useXkbConfig = true; # use xkbOptions in tty. + }; + + users = { + groups.glance = {}; + users = { + + root = { + openssh.authorizedKeys.keyFiles = [ + /etc/nixos/ssh/authorized_keys + ]; + }; + + blee = { + openssh.authorizedKeys.keyFiles = [ + /etc/nixos/ssh/authorized_keys + ]; + isNormalUser = true; + extraGroups = [ + "wheel" + "glance" + ]; + packages = with pkgs; [ + chromium + coreutils # base64 + element-desktop + firefox + gimp + jellyfin-media-player + kate # kwrite + kdenlive + libsForQt5.kcalc + + logseq # 0.10.9 # uses insecure electron version 27.3.11 https://github.com/NixOS/nixpkgs/pull/340427 + #unstable.logseq # 0.10.9 BUG: https://github.com/logseq/logseq/issues/10851 + + moonlight-qt + nmap + obs-studio + obsidian + qbittorrent + rtorrent + spek # beat saber mapping + synergy + tenacity + thunderbird + tor-browser + via + vlc + vscode + xcaddy # warning: absolute dumpster fire + yt-dlp + zoom-us + + # Build vim huge with clipboard support + (vim_configurable.overrideAttrs (oldAttrs: { + features = "huge"; + })) + + awscli2 + #aws-sam-cli # broken, fails to init. use pip install aws-sam-cli + #unstable.aws-sam-cli + packer + terraform + ansible + python3 + python311Packages.pip + python311Packages.ipython + libreoffice-qt + hunspell + hunspellDicts.uk_UA + hunspellDicts.th_TH + nodejs_20 + yarn + deno + ]; + }; + + glance = { + isSystemUser = true; + group = "glance"; + home = "/var/lib/glance"; + createHome = true; + description = "Glance service user"; + # shell = pkgs.bash; + }; + + }; + }; + + environment = { + systemPackages = with pkgs; [ + # GPU tools + android-tools + arp-scan + cryptsetup + curl + difftastic + dig + dnscontrol + dnsutils + doas + exiftool + ffmpeg + file + fzf + git + go + htop + iftop + imagemagick + iperf + jq + lego + libressl + mediainfo + net-snmp # snmpwalk + netcat + nettools + parted + pass + pciutils # lspci + psmisc + qrencode + rsync + screen + tcpdump + tmux + tree + unzip + vim + vulkan-tools + wget + whois + wireguard-tools + zbar + zip + ]; + + shellInit = '' + pheonix() { + systemctl restart "$1" + journalctl -fu "$1" + } + ''; + + plasma5.excludePackages = with pkgs.libsForQt5; [ + plasma-browser-integration + ]; + + etc = lib.mkMerge [ + + # Generate KDE config files + (lib.attrsets.mapAttrs' (name: value: + lib.attrsets.nameValuePair + ( "xdg/${name}" ) + { + source = (pkgs.formats.ini {}).generate name value; + } + ) { + "baloofilerc" = { + "Basic Settings" = { + "Indexing-Enabled" = false; + }; + }; + }) + + { # normal environment.etc block + gitconfig = { + text = '' + [init] + defaultBranch = main + ''; + }; + } + ]; + + }; + + + programs = { + appimage = { + enable = true; + binfmt = true; + package = pkgs.appimage-run.override { + extraPkgs = pkgs: [ + pkgs.libthai # lume + ]; + }; + }; + fish.enable = true; + vim.defaultEditor = true; + bash = { + shellAliases = { + ll = "ls -lAF --classify --group-directories-first"; + l = "ls -lF --classify --group-directories-first"; + }; + # https://nixos.wiki/wiki/Fish + interactiveShellInit = '' + if [[ $(${pkgs.procps}/bin/ps --no-header --pid=$PPID --format=comm) != "fish" && -z ''${BASH_EXECUTION_STRING} ]] + then + shopt -q login_shell && LOGIN_OPTION='--login' || LOGIN_OPTION="" + exec ${pkgs.fish}/bin/fish $LOGIN_OPTION + fi + ''; + }; + mtr.enable = true; + gnupg.agent = { + enable = true; + enableSSHSupport = true; + }; + kdeconnect.enable = true; + chromium = { + enable = true; + extraOpts = { + "SpellcheckEnabled" = false; + "DefaultSearchProviderEnabled" = true; + "DefaultSearchProviderName" = "Kagi"; + "DefaultSearchProviderSearchURL" = "https://kagi.com/search?q={searchTerms}"; + "SearchSuggestEnabled" = false; + "DefaultSearchProviderSuggestURL" = ""; + }; + }; + }; + + security = { + sudo.enable = false; + doas = { + enable = true; + extraRules = [ + { + users = [ "blee" ]; + persist = true; + } + ]; + }; + # pki.certificateFiles = [ # self-signed CA trust for start9 + # "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt" + # # "/etc/ssl/certs/dotted-turbans.pem" + # ]; + }; + + services = { + + openssh.enable = true; + udev.packages = [ pkgs.via ]; + + # https://discourse.nixos.org/t/bluetooth-a2dp-sink-not-showing-up-in-pulseaudio-on-nixos/32447/4?u=bleetube + pipewire = { + enable = true; + pulse.enable = true; + }; + # avahi = { # for resolving start9 hostname + # enable = true; + # nssmdns4 = true; # Enable NSS support for mDNS + # }; + + syncthing = { + enable = true; + user = "blee"; + dataDir = "/home/blee/Documents"; + }; + journald.extraConfig = "MaxRetentionSec=30day"; + + # https://github.com/NixOS/nixpkgs/blob/nixos-23.05/nixos/modules/services/monitoring/prometheus/exporters.nix + prometheus.exporters.node = { + enable = true; + port = 8030; + enabledCollectors = [ + "cpu.info" + "interrupts" + "netstat" + "vmstat" + "systemd" + "tcpstat" + "processes" + ]; + }; + + caddy = { + enable = true; + logFormat = "output discard"; + extraConfig = let + tlsConfig = '' + tls { + dns namecheap { + api_key {env.NAMECHEAP_API_KEY} + user {env.NAMECHEAP_API_USER} + api_endpoint https://api.namecheap.com/xml.response + } + } + ''; + in '' + ${host_fqdn} { # open-webui + ${tlsConfig} + reverse_proxy http://127.0.0.1:8080 + + # BUG: assets are all on root path + # handle /changedetection/* { + # uri strip_prefix /changedetection + # reverse_proxy http://127.0.0.1:${toString config.services.changedetection-io.port} + # } + + # handle /files/* { + # root /mnt/usb/ + # file_server browse + # } + } + + ${host_fqdn}:4430 { # node_exporter + ${tlsConfig} + reverse_proxy http://127.0.0.1:8030 + } + + ${host_fqdn}:4431 { # litellm + ${tlsConfig} + reverse_proxy http://127.0.0.1:8031 + } + + ${host_fqdn}:4432 { # glance + ${tlsConfig} + reverse_proxy http://127.0.0.1:8032 + } + + # BUG: POST messages throw missing referrer error + ${host_fqdn}:4433 { # changedetection-io + ${tlsConfig} + reverse_proxy http://127.0.0.1:${toString config.services.changedetection-io.port} + header Referrer-Policy "strict-origin-when-cross-origin" + } + + ${host_fqdn}:4434 { # home-assistant + ${tlsConfig} + reverse_proxy http://127.0.0.1:8034 + } + + ''; + }; + + changedetection-io = { + enable = true; + port = 8033; + behindProxy = true; + # baseURL = "https://${host_fqdn}/changedetection/"; + baseURL = "https://${host_fqdn}:4433/"; + environmentFile = "/var/src/env_vars/changedetection-io"; + }; + + displayManager = { + sddm.enable = true; + #defaultSession = "plasmawayland"; + }; + xserver = { + enable = true; + desktopManager.plasma5.enable = true; + }; + }; + + systemd = { + services = { + caddy = { + serviceConfig = { + EnvironmentFile = "/var/src/secrets/namecheap"; + ExecStart = [ + "" # This empty string clears the existing ExecStart commands + "/opt/bin/caddy run --config /etc/caddy/caddy_config --adapter caddyfile" + ]; + ExecReload = [ + "" # This empty string clears the existing ExecReload commands + "/opt/bin/caddy reload --config /etc/caddy/caddy_config --adapter caddyfile --force" + ]; + }; + }; + glance = { + wantedBy = [ "multi-user.target" ]; + after = [ "network-online.target" ]; + wants = [ "network-online.target" ]; + serviceConfig = { + User = "glance"; + Group = "glance"; + WorkingDirectory = "/var/lib/glance"; + # Environment = "LOG_LEVEL=debug"; # https://github.com/glanceapp/glance/issues/196 + ExecStart = "${pkgs.glance}/bin/glance --config config.yaml"; + }; + }; + + open-webui = { + wantedBy = [ "multi-user.target" ]; + after = [ "network.target" ]; + serviceConfig = { + Type = "forking"; + User = "blee"; + WorkingDirectory = "/opt/open-webui"; + Environment = "NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels"; + ExecStart = "${pkgs.nix}/bin/nix-shell"; + }; + }; + + }; + +# TODO: fix errors +# systemd.services.nightly-backups = { +# description = "Nightly Backup Service"; +# wantedBy = [ "multi-user.target" ]; +# after = [ "network.target" ]; +# # enable = false; # testing +# serviceConfig = { +# User = "blee"; +# Type = "oneshot"; +# Environment = "NIX_PATH=nixpkgs=/nix/var/nix/profiles/per-user/root/channels/nixos:nixos-config=/etc/nixos/configuration.nix:/nix/var/nix/profiles/per-user/root/channels"; +# WorkingDirectory = "/home/blee/ops/brenise.dev/scripts/backups"; +# # batch.sh calls other shell scripts which leads to nix environment hell. +# # As a workaround, I think we could add multiple ExecStart lines for other backup scripts. +# # ExecStart = "${pkgs.bash}/bin/bash /home/blee/ops/brenise.dev/scripts/backups/batch.sh"; +# ExecStart = "${pkgs.bash}/bin/bash /home/blee/ops/brenise.dev/scripts/backups/hosts/litten.brenise.dev.sh"; +# # Path = [ +# # "${pkgs.openssh}/bin" +# # "${pkgs.coreutils}/bin" +# # "${pkgs.gnugrep}/bin" +# # "${pkgs.gnused}/bin" +# # ]; +# }; +# }; + +# systemd.timers.nightly-backups = { +# wantedBy = [ "timers.target" ]; +# partOf = [ "nightly-backups.service" ]; +# timerConfig = { +# OnCalendar = "daily"; +# nCalendar = "*-*-* 03:00:00"; +# # Persistent = true; +# Unit = "nightly-backups.service"; +# }; +# }; + + }; + +# virtualisation.oci-containers = { +# backend = "podman"; # systemctl status podman-homeassistant +# containers.homeassistant = { +# volumes = [ "home-assistant:/config" ]; +# environment.TZ = "US/Pacific"; +# # Note: The image will not be updated on rebuilds, unless the version label changes +# image = "ghcr.io/home-assistant/home-assistant:stable"; +# ports = [ "8123:8034" ]; +# extraOptions = [ +# "--network=host" +# "--cap-add=NET_ADMIN" +# "--cap-add=NET_RAW" +# ]; +# }; +# }; + + system.stateVersion = "23.05"; +} diff --git a/litten.brenise.dev/glance/assets/gitea.svg b/litten.brenise.dev/glance/assets/gitea.svg new file mode 100644 index 0000000..7ed0012 --- /dev/null +++ b/litten.brenise.dev/glance/assets/gitea.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/litten.brenise.dev/glance/assets/jellyfin.png b/litten.brenise.dev/glance/assets/jellyfin.png new file mode 100644 index 0000000..612c572 Binary files /dev/null and b/litten.brenise.dev/glance/assets/jellyfin.png differ diff --git a/litten.brenise.dev/glance/assets/vaultwarden.png b/litten.brenise.dev/glance/assets/vaultwarden.png new file mode 100644 index 0000000..04e9e24 Binary files /dev/null and b/litten.brenise.dev/glance/assets/vaultwarden.png differ diff --git a/litten.brenise.dev/glance/config.yaml b/litten.brenise.dev/glance/config.yaml new file mode 100644 index 0000000..5e4080a --- /dev/null +++ b/litten.brenise.dev/glance/config.yaml @@ -0,0 +1,97 @@ +# https://github.com/glanceapp/glance/blob/main/docs/configuration.md +server: + host: 127.0.0.1 + port: 8032 + assets-path: /var/lib/glance/assets +pages: + - name: Home + columns: + - size: small + widgets: + - type: calendar + + - type: rss + limit: 10 + collapse-after: 3 + cache: 1d + feeds: + - url: https://distrowatch.com/news/distro/debian.xml + - url: https://distrowatch.com/news/distro/nixos.xml + - url: https://distrowatch.com/news/distro/qubes.xml + + - type: twitch-channels + channels: + - frivvifox + - asmr_divinity + - thrilluwu + - demonbenny + + - size: full + widgets: + - type: videos + channels: + - UCTrQ7HXWRRxr7OsOtodr2_w # Channel4News + - UCawZsQWqfGSbCI5yjkdVkTA # matthew_berman + - type: hacker-news + sort-by: best + - type: rss + title: News Minimalist + # collapse-after: 5 + cache: 1d + feeds: + - url: https://rss.beehiiv.com/feeds/4aF2pGVAEN.xml + - type: rss + title: Communities + # collapse-after: 5 + cache: 1d + feeds: + - url: https://discourse.nixos.org/top.rss?period=weekly + title: NixOS Discourse + - type: videos + channels: + - UCoNfsDH8sZe13u7rSxaEBkw # FrivolousFoxASMR + - UC_n9r4yRVXusIa6Cabl4wDw # ASMRDivinity + - UCshObcm-nLhbu8MY50EZ5Ng # BennJordan + + - size: small + widgets: + - type: weather + location: Long Beach, California, United States + units: imperial + + - type: monitor + cache: 1m + title: Services + sites: + - title: Gitea + url: https://git.satstack.dev + icon: /assets/gitea.svg + - title: Jellyfin + url: https://raichu.satstack.dev:4445 + icon: /assets/jellyfin.png + - title: Vaultwarden + url: https://raichu.satstack.dev:4435 + icon: /assets/vaultwarden.png + # - title: Immich + # url: https://immich.yourdomain.com + # icon: /assets/immich-logo.png + + # - type: markets + # markets: + - type: stocks + stocks: + - symbol: SPY + name: S&P 500 + - symbol: BTC-USD + name: Bitcoin + chart-link: https://www.tradingview.com/chart/?symbol=INDEX:BTCUSD + - symbol: DCR-BTC + name: Testnet + chart-link: https://www.binance.com/en/trade/DCR_BTC?type=spot + + # - type: releases + # repositories: + # - immich-app/immich + # - go-gitea/gitea + # - dani-garcia/vaultwarden + # - jellyfin/jellyfin \ No newline at end of file diff --git a/litten.brenise.dev/install.sh b/litten.brenise.dev/install.sh new file mode 100755 index 0000000..1798128 --- /dev/null +++ b/litten.brenise.dev/install.sh @@ -0,0 +1,42 @@ +#!/bin/bash +set -e +set -x + +# Requires ssh access to target machine: ssh root@${TARGET} +TARGET=litten +TARGET_DOMAIN=brenise.dev + +FORMAT_DISK () +{ +# dd if=/dev/zero count=1 bs=2M of=/dev/nvmen1 + parted /dev/nvme0n1 -- mklabel gpt + parted /dev/nvme0n1 -- mkpart primary 512MB 100% + parted /dev/nvme0n1 -- mkpart ESP fat32 1MB 512MB + parted /dev/nvme0n1 -- set 2 esp on + mkfs.ext4 -L nixos /dev/nvme0n1p1 + mkfs.fat -F 32 -n boot /dev/nvme0n1p2 + mount /dev/disk/by-label/nixos /mnt + mkdir -p /mnt/boot + mount /dev/disk/by-label/boot /mnt/boot + nixos-generate-config --root /mnt +} + +echo "Install NixOS on ${TARGET}? Press enter to continue or ctrl+c to quit." +read + +ssh root@${TARGET} "$(typeset -f FORMAT_DISK); FORMAT_DISK" + +rsync -tv configuration.nix root@${TARGET}:/mnt/etc/nixos/ + +# ssh +if [ -f ~/.ssh/ansible_root_keys ]; then + rsync -v ~/.ssh/ansible_root_keys root@${TARGET}:/etc/nixos/ssh/authorized_keys +else + rsync -v ~/.ssh/authorized_keys root@${TARGET}:/etc/nixos/ssh/authorized_keys +fi + +ssh root@${TARGET} nixos-install + +# Don't forget to set your passwd +# To chroot: +#nixos-enter --root /mnt diff --git a/litten.brenise.dev/keychron/k4_pro_ansi_white_v1.01_20230807.json b/litten.brenise.dev/keychron/k4_pro_ansi_white_v1.01_20230807.json new file mode 100644 index 0000000..6ad7850 --- /dev/null +++ b/litten.brenise.dev/keychron/k4_pro_ansi_white_v1.01_20230807.json @@ -0,0 +1,257 @@ +{ + "name": "Keychron K4 Pro ANSI White", + "vendorId": "0x3434", + "productId": "0x0243", + "keycodes": ["qmk_lighting"], + "customKeycodes": [ + {"name": "Left Option", "title": "Left Option", "shortName": "LOpt"}, + {"name": "Right Option", "title": "Right Option", "shortName": "ROpt"}, + {"name": "Left Cmd", "title": "Left Command", "shortName": "LCmd"}, + {"name": "Right Cmd", "title": "Right Command", "shortName": "RCmd"}, + {"name": "Task View", "title": "Task View in Windows", "shortName": "Task"}, + {"name": "File Explorer", "title": "File Explorer in Windows", "shortName": "File"}, + {"name": "Screen shot", "title": "Screenshot in macOS", "shortName": "SShot"}, + {"name": "Cortana", "title": "Cortana in Windows", "shortName": "Cortana"}, + {"name": "Siri", "title": "Siri in macOS", "shortName": "Siri"}, + {"name": "Bluetooth Host 1", "title": "Bluetooth Host 1", "shortName": "BTH1"}, + {"name": "Bluetooth Host 2", "title": "Bluetooth Host 2", "shortName": "BTH2"}, + {"name": "Bluetooth Host 3", "title": "Bluetooth Host 3", "shortName": "BTH3"}, + {"name": "Battery Level", "title": "Show battery level", "shortName": "Batt"} + ], + "matrix": {"rows": 6, "cols": 18}, + "layouts": { + "keymap": [ + [ + { + "c": "#777777" + }, + "0,0", + { + "c": "#cccccc" + }, + "0,1", + "0,2", + "0,3", + "0,4", + { + "c": "#aaaaaa" + }, + "0,5", + "0,6", + "0,7", + "0,8", + "0,9", + { + "c": "#cccccc" + }, + "0,10", + "0,11", + "0,12", + { + "c": "#aaaaaa" + }, + "0,13", + "0,14", + { + "x": 0.5500000000000007 + }, + "0,15", + "0,16", + "0,17", + "3,17" + ], + [ + { + "y": 0.26 + }, + "1,0", + { + "c": "#cccccc" + }, + "1,1", + "1,2", + "1,3", + "1,4", + "1,5", + "1,6", + "1,7", + "1,8", + "1,9", + "1,10", + "1,11", + "1,12", + { + "c": "#aaaaaa", + "w": 2 + }, + "1,13", + { + "x": 0.5500000000000007, + "c": "#cccccc" + }, + "1,14", + "1,15", + "1,16", + "1,17" + ], + [ + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,0", + { + "c": "#cccccc" + }, + "2,1", + "2,2", + "2,3", + "2,4", + "2,5", + "2,6", + "2,7", + "2,8", + "2,9", + "2,10", + "2,11", + "2,12", + { + "c": "#aaaaaa", + "w": 1.5 + }, + "2,13", + { + "x": 0.5600000000000005, + "c": "#cccccc" + }, + "2,14", + "2,15", + "2,16", + { + "h": 2 + }, + "2,17" + ], + [ + { + "c": "#aaaaaa", + "w": 1.75 + }, + "3,0", + { + "c": "#cccccc" + }, + "3,1", + "3,2", + "3,3", + "3,4", + "3,5", + "3,6", + "3,7", + "3,8", + "3,9", + "3,10", + "3,11", + { + "c": "#777777", + "w": 2.25 + }, + "3,13", + { + "x": 0.5600000000000005, + "c": "#cccccc" + }, + "3,14", + "3,15", + "3,16" + ], + [ + { + "c": "#aaaaaa", + "w": 2.25 + }, + "4,0", + { + "c": "#cccccc" + }, + "4,2", + "4,3", + "4,4", + "4,5", + "4,6", + "4,7", + "4,8", + "4,9", + "4,10", + "4,11", + { + "c": "#aaaaaa", + "w": 1.75 + }, + "4,12", + { + "x": 1.5599999999999987, + "c": "#cccccc" + }, + "4,14", + "4,15", + "4,16", + { + "h": 2 + }, + "4,17" + ], + [ + { + "y": -0.75, + "x": 14.28, + "c": "#777777" + }, + "4,13" + ], + [ + { + "y": -0.25, + "c": "#aaaaaa", + "w": 1.25 + }, + "5,0", + { + "w": 1.25 + }, + "5,1", + { + "w": 1.25 + }, + "5,2", + { + "c": "#cccccc", + "w": 6.25 + }, + "5,6", + { + "c": "#aaaaaa" + }, + "5,10", + "5,11", + "5,12", + { + "x": 3.5600000000000023, + "c": "#cccccc" + }, + "5,16", + "5,17" + ], + [ + { + "y": -0.75, + "x": 13.28, + "c": "#777777" + }, + "5,13", + "5,14", + "5,15" + ] + ] + } +} diff --git a/litten.brenise.dev/keychron/k4p-g1-default-layout.png b/litten.brenise.dev/keychron/k4p-g1-default-layout.png new file mode 100644 index 0000000..8bbde48 Binary files /dev/null and b/litten.brenise.dev/keychron/k4p-g1-default-layout.png differ diff --git a/litten.brenise.dev/opt/open-webui/run-open-webui.sh b/litten.brenise.dev/opt/open-webui/run-open-webui.sh new file mode 100755 index 0000000..baf6146 --- /dev/null +++ b/litten.brenise.dev/opt/open-webui/run-open-webui.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash + +# Exit on error, undefined variables, and print commands +set -e + +# Default values (can be overridden by command-line arguments) +SESSION_NAME="${1:-textgen}" +LITELLM_PORT="${2:-8031}" + +if tmux has-session -t "$SESSION_NAME" 2>/dev/null; then + echo "Session '$SESSION_NAME' already exists. No action taken." + exit 0 +fi + +# Activate virtual environment +source .venv/bin/activate + +# Source the password forr litellm +source .env + +# Check if session already exists +if ! tmux has-session -t "$SESSION_NAME" 2>/dev/null; then + # Create new detached session + tmux new-session -d -s "$SESSION_NAME" + + # Start the open-webui server + tmux send-keys -t "$SESSION_NAME" "open-webui serve" C-m + + # Start litellm in a new pane + tmux split-window -v -t "$SESSION_NAME" + tmux send-keys -t "$SESSION_NAME" "source .env && litellm --telemetry False --config ./litellm.yaml --host 127.0.0.1 --port $LITELLM_PORT" C-m + + echo "Session '$SESSION_NAME' created and configured. To connect, type: tmux att -t $SESSION_NAME" +else + echo "Session '$SESSION_NAME' already exists. Exiting." + exit 1 +fi diff --git a/litten.brenise.dev/opt/open-webui/shell.nix b/litten.brenise.dev/opt/open-webui/shell.nix new file mode 100644 index 0000000..df5723b --- /dev/null +++ b/litten.brenise.dev/opt/open-webui/shell.nix @@ -0,0 +1,11 @@ +{ pkgs ? import {} }: +(pkgs.buildFHSEnv { + name = "open-webui-fhs-env"; + targetPkgs = pkgs: with pkgs; [ + tmux +# bash +# python311 + ]; + runScript = "./run-open-webui.sh"; +}).env +