infrastructure

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 6b4af1fa950a59c694ea666aa2602574210eb6b8
parent 210fc379ed1bf860079a3d1daebd2af66c34e2d4
Author: Silas Brack <silasbrack@gmail.com>
Date:   Mon, 20 Apr 2026 21:47:00 +0200

fix(simple-web-app): update module for Rust migration

- Replace UVICORN_* env vars with PORT, DATABASE_URL, RUST_LOG
- Update for Rust/Axum backend

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Diffstat:
Mflake.lock | 130++++++++++++++++++++++++++++----------------------------------------------------
Mflake.nix | 2+-
Mhosts/gaia/home.nix | 5+++++
Ahosts/gaia/init.el | 121+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mmodules/simple-web-app.nix | 6+++---
5 files changed, 175 insertions(+), 89 deletions(-)

diff --git a/flake.lock b/flake.lock @@ -1,5 +1,20 @@ { "nodes": { + "crane": { + "locked": { + "lastModified": 1776635034, + "narHash": "sha256-OEOJrT3ZfwbChzODfIH4GzlNTtOFuZFWPtW7jIeR8xU=", + "owner": "ipetkov", + "repo": "crane", + "rev": "dc7496d8ea6e526b1254b55d09b966e94673750f", + "type": "github" + }, + "original": { + "owner": "ipetkov", + "repo": "crane", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -108,11 +123,11 @@ }, "nixpkgs_3": { "locked": { - "lastModified": 1757347588, - "narHash": "sha256-tLdkkC6XnsY9EOZW9TlpesTclELy8W7lL2ClL+nma8o=", + "lastModified": 1776548001, + "narHash": "sha256-ZSK0NL4a1BwVbbTBoSnWgbJy9HeZFXLYQizjb2DPF24=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "b599843bad24621dcaa5ab60dac98f9b0eb1cabe", + "rev": "b12141ef619e0a9c1c84dc8c684040326f27cdcc", "type": "github" }, "original": { @@ -138,36 +153,18 @@ "type": "github" } }, - "pyproject-build-systems": { + "root": { "inputs": { - "nixpkgs": [ - "simple-web-app", - "nixpkgs" - ], - "pyproject-nix": [ - "simple-web-app", - "pyproject-nix" - ], - "uv2nix": [ - "simple-web-app", - "uv2nix" - ] - }, - "locked": { - "lastModified": 1757296493, - "narHash": "sha256-6nzSZl28IwH2Vx8YSmd3t6TREHpDbKlDPK+dq1LKIZQ=", - "owner": "pyproject-nix", - "repo": "build-system-pkgs", - "rev": "5b8e37fe0077db5c1df3a5ee90a651345f085d38", - "type": "github" - }, - "original": { - "owner": "pyproject-nix", - "repo": "build-system-pkgs", - "type": "github" + "home-manager": "home-manager", + "mkv": "mkv", + "nixpkgs": "nixpkgs_2", + "nixpkgs-unstable": "nixpkgs-unstable", + "simple-web-app": "simple-web-app", + "sops-nix": "sops-nix", + "website": "website" } }, - "pyproject-nix": { + "rust-overlay": { "inputs": { "nixpkgs": [ "simple-web-app", @@ -175,49 +172,37 @@ ] }, "locked": { - "lastModified": 1757246327, - "narHash": "sha256-6pNlGhwOIMfhe/RLjHdpXveKS4FyLHvlGe+KtjDild4=", - "owner": "pyproject-nix", - "repo": "pyproject.nix", - "rev": "8d77f342d66ad1601cdb9d97e9388b69f64d4c8e", + "lastModified": 1776654897, + "narHash": "sha256-Vqi4AiJVCcBGn/RmBtRCgyH5rCxqm/w0xV9diJWF1Ic=", + "owner": "oxalica", + "repo": "rust-overlay", + "rev": "25d75be8139815a53560745fa060909777495105", "type": "github" }, "original": { - "owner": "pyproject-nix", - "repo": "pyproject.nix", + "owner": "oxalica", + "repo": "rust-overlay", "type": "github" } }, - "root": { - "inputs": { - "home-manager": "home-manager", - "mkv": "mkv", - "nixpkgs": "nixpkgs_2", - "nixpkgs-unstable": "nixpkgs-unstable", - "simple-web-app": "simple-web-app", - "sops-nix": "sops-nix", - "website": "website" - } - }, "simple-web-app": { "inputs": { + "crane": "crane", "nixpkgs": "nixpkgs_3", - "pyproject-build-systems": "pyproject-build-systems", - "pyproject-nix": "pyproject-nix", - "uv2nix": "uv2nix" + "rust-overlay": "rust-overlay" }, "locked": { - "lastModified": 1760541146, - "narHash": "sha256-QQLNQ2vl8LXcs+F8lMxNDpMGc28x5URtaSuU9aikDtg=", - "owner": "silasbrack", - "repo": "simple-web-app", - "rev": "c0a11ab37b52e3bf0a8f1e5981500e09abb3c232", - "type": "github" + "lastModified": 1776714409, + "narHash": "sha256-R3Qk8WaU2qgOqNC8dlOjYle3IvNLcJAkojSCX/wf1eU=", + "ref": "refs/heads/main", + "rev": "cf8c763c3031b6123d3a05491ec4be880d8a1b8b", + "revCount": 38, + "type": "git", + "url": "ssh://forgejo@git.fnarglebeast.com/silas/simple-web-app.git" }, "original": { - "owner": "silasbrack", - "repo": "simple-web-app", - "type": "github" + "type": "git", + "url": "ssh://forgejo@git.fnarglebeast.com/silas/simple-web-app.git" } }, "sops-nix": { @@ -253,31 +238,6 @@ "type": "github" } }, - "uv2nix": { - "inputs": { - "nixpkgs": [ - "simple-web-app", - "nixpkgs" - ], - "pyproject-nix": [ - "simple-web-app", - "pyproject-nix" - ] - }, - "locked": { - "lastModified": 1756973152, - "narHash": "sha256-9JcKAA7T9J98LWdcxbXvmf+amQG3ZErxqQnBjEJI04I=", - "owner": "pyproject-nix", - "repo": "uv2nix", - "rev": "64298e806f4a5f63a51c625edc100348138491aa", - "type": "github" - }, - "original": { - "owner": "pyproject-nix", - "repo": "uv2nix", - "type": "github" - } - }, "website": { "flake": false, "locked": { diff --git a/flake.nix b/flake.nix @@ -3,7 +3,7 @@ nixpkgs.url = "github:NixOS/nixpkgs/nixos-25.11"; nixpkgs-unstable.url = "github:NixOS/nixpkgs/nixos-unstable"; sops-nix.url = "github:Mic92/sops-nix"; - simple-web-app.url = "github:silasbrack/simple-web-app"; + simple-web-app.url = "git+ssh://forgejo@git.fnarglebeast.com/silas/simple-web-app.git"; mkv.url = "git+ssh://git@github.com/silasbrack/mkv"; website = { url = "git+ssh://forgejo@git.fnarglebeast.com/silas/website.git"; diff --git a/hosts/gaia/home.nix b/hosts/gaia/home.nix @@ -18,6 +18,11 @@ paperless-manage = "sudo -u paperless /var/lib/paperless/paperless-manage"; }; + programs.emacs = { + enable = true; + extraConfig = builtins.readFile ./init.el; + }; + programs.fzf = { enable = true; enableBashIntegration = true; diff --git a/hosts/gaia/init.el b/hosts/gaia/init.el @@ -0,0 +1,121 @@ +;; -*- lexical-binding: t -*- + +;; Utilities +(require 'which-key) +(which-key-mode) + +(defun load-env-file (file) + "Load environment variables from FILE." + (interactive "fEnv file: ") + (let ((count 0)) + (with-temp-buffer + (insert-file-contents file) + (dolist (line (split-string (buffer-string) "[\n\r]+" t)) + (let ((trimmed (string-trim line))) + (unless (or (string-empty-p trimmed) + (string-prefix-p "#" trimmed)) + (when (string-match "\\`\\([^=]+\\)=\\(.*\\)\\'" trimmed) + (let ((key (string-trim (match-string 1 trimmed))) + (value (string-trim (match-string 2 trimmed)))) + ;; Remove surrounding quotes if present + (when (string-match "\\`[\"']\\(.*\\)[\"']\\'" value) + (setq value (match-string 1 value))) + (setenv key value) + (setq count (1+ count)))))))) + (message "Loaded %d environment variables from %s" count file))) + +(savehist-mode 1) +(pending-delete-mode 1) +(setq undo-tree-auto-save-history t) + +;; Appearance +(load-theme 'modus-operandi-tinted) + +(set-face-attribute 'default nil :font "Jetbrains Mono Nerd Font" :height 140) +(add-to-list 'default-frame-alist '(ns-transparent-titlebar . t)) +(add-to-list 'default-frame-alist '(ns-appearance . dark)) +(setq inhibit-startup-message t) +(setq initial-scratch-message "") +(menu-bar-mode -1) +(tool-bar-mode -1) +(tooltip-mode -1) +(scroll-bar-mode -1) +(set-fringe-mode 10) + +;; LSP +(add-hook 'python-mode-hook 'eglot-ensure) + +(use-package nix-mode :mode "\\.nix\\'") +(custom-set-variables + ;; custom-set-variables was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + '(org-agenda-files '("~/notes/work/daily.org" "~/notes/orgmode/books.org")) + '(package-selected-packages '(claude-code inheritenv nix-mode notmuch-indicator)) + '(package-vc-selected-packages + '((claude-code :url "https://github.com/stevemolitor/claude-code.el")))) +(custom-set-faces + ;; custom-set-faces was added by Custom. + ;; If you edit it by hand, you could mess it up, so be careful. + ;; Your init file should contain only one such instance. + ;; If there is more than one, they won't work right. + ) + +(setq org-export-with-section-numbers nil) +(setq org-latex-to-mathml-convert-command + "pandoc -f latex -t html --mathml --standalone --variable css=style.css --embed-resources %i -o %o") + +(use-package ox-pandoc + :ensure t + :config + (setq org-pandoc-options-for-html5 '((mathml . t)))) + +(global-set-key (kbd "C-c l") 'org-store-link) +(global-set-key (kbd "C-c a") 'org-agenda) +(global-set-key (kbd "C-c c") 'org-capture) + +;; emms +(require 'emms-setup) +(require 'emms-player-simple) +(require 'emms-player-mpv) +(require 'emms-source-file) +(require 'emms-source-playlist) +(emms-standard) +(setq emms-player-list '(emms-player-mpv)) + +;; expand-region +(require 'expand-region) +(global-set-key (kbd "C-=") 'er/expand-region) + +;; notmuch +(require 'notmuch) + +;; tidal +; (setq tidal-boot-script-path "~/dev/tidal/BootTidal.hs") + +(require 'package) +(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t) +(package-initialize) + +;; install required inheritenv dependency: +(use-package inheritenv + :vc (:url "https://github.com/purcell/inheritenv" :rev :newest)) + +;; for eat terminal backend: +(use-package eat :ensure t) + +;; install claude-code.el +(use-package claude-code :ensure t + :vc (:url "https://github.com/stevemolitor/claude-code.el" :rev :newest) + :config + ;; optional IDE integration with Monet + ;(add-hook 'claude-code-process-environment-functions #'monet-start-server-function) + ;(monet-mode 1) + + (claude-code-mode) + :bind-keymap ("C-c c" . claude-code-command-map) + + ;; Optionally define a repeat map so that "M" will cycle thru Claude auto-accept/plan/confirm modes after invoking claude-code-cycle-mode / C-c M. + :bind + (:repeat-map my-claude-code-map ("M" . claude-code-cycle-mode))) diff --git a/modules/simple-web-app.nix b/modules/simple-web-app.nix @@ -43,10 +43,10 @@ in StateDirectory = "simple-web-app"; # Ensures /var/lib/simple-web-app/ }; environment = { - UVICORN_PORT = builtins.toString cfg.port; - UVICORN_LOG_CONFIG = "${cfg.package}/share/logging.json"; + PORT = builtins.toString cfg.port; DEBUG = "false"; - DATABASE_PATH = "/var/lib/simple-web-app/db.sqlite3"; + DATABASE_URL = "sqlite:///var/lib/simple-web-app/db.sqlite3"; + RUST_LOG = "info"; }; };