summaryrefslogtreecommitdiff
path: root/Omni/Bild
AgeCommit message (Collapse)Author
41 hoursfix(bild): per-module cp overwrites with -f and chmod after each copyBen Sima
When building per-module derivations, copying dependency .hi files was failing silently because: 1. First dep copies read-only Alpha.hi from nix store 2. Second dep also has Alpha.hi (transitive dep) and tries to overwrite 3. cp fails with permission denied but error is hidden by '|| true' Fixed by: - Add -f flag to cp to force overwrite - Run chmod -R +w after each dependency copy - This allows later deps to overwrite shared files like Alpha.hi Tested: Biz/Que/Host.hs now builds successfully with per-module derivations
42 hoursfix(bild): work around Nix patch-shebangs.sh bugBen Sima
Set dontPatchShebangs=true for per-module link derivation to avoid unbound variable error in Nix's patch-shebangs.sh script. The script declares 'local update' but never initializes it, causing bash set -u to fail. Our ELF binaries don't need shebangs patched anyway. Tested: All Haskell targets now build successfully including Omni/Lint.hs which uses makeWrapper with rundeps.
42 hoursfix(bild): per-module builds + exit code propagationBen Sima
- Fix nixBuild to propagate exit code from realise step - Previously used >> which discarded exit code - Now checks realise result before running symlink - Fixes false success checkmarks on build failures - Fix per-module Nix derivations - Use cp -rL instead of tar (src is directory not tarball) - Add coreutils and findutils to pkgs - Copy deps to . and use -i. for GHC - Use find with --parents to preserve module hierarchy - Set dontStrip=true to avoid fixup script errors - Tested: Example.hs, Task.hs, Dragons.hs, Bild.hs all build - Known issue: makeWrapper fixup scripts have unbound vars (Nix bug)
42 hoursFix module builder: manually unpack tarballBen Sima
When using custom builder, unpackPhase function is not available. Use tar xzf to manually extract the source archive.
42 hoursFix module builder: call unpackPhase explicitly and cd to sourceBen Sima
When using custom builder, standard phases don't run automatically. Call unpackPhase explicitly and cd to 'source' directory where files are unpacked. Fixes 'sourceRoot: unbound variable' error in module compilation.
42 hoursFix module compilation: use custom builder to avoid GHC setup hooksBen Sima
The haskell.ghcWith package has setup hooks that override buildPhase even when explicitly set. Solution: use custom builder = stdenv.shell with args instead of relying on mkDerivation phases. Changes: - Module derivations: Use custom builder with single -c script - Combines unpack, build, and install into one script - Explicitly call ghc with full path to avoid hook interference - Remove unused objectPaths computation (now using ghc --make with source) This fixes builds for Omni/Lint.hs, Omni/Task.hs, and all other Haskell targets with complex dependency graphs.
43 hoursFix per-module link: copy .hi files locally instead of using -i pathsBen Sima
GHC --make was treating -i /nix/store/.../hidir paths as compilation targets. Solution: Copy all .hi files to local directory and use -i. only. Also make hsGraph optional with 'or null' for backward compatibility with old bild binaries during bootstrap. Amp-Thread-ID: https://ampcode.com/threads/T-fe68faaf-1c1d-4c43-a377-1cf5e6cffb3a Co-authored-by: Amp <amp@ampcode.com>
44 hoursFix per-module link phase: put source file before flagsBen Sima
GHC --make interprets arguments before flags as targets. Moving the entry point source file to the beginning prevents -i paths from being treated as compilation targets. This fixes the 'is not a module name or a source file' error.
44 hoursImplement per-module Nix derivations for incremental Haskell buildsBen Sima
This is the core architecture transformation from Phase 3 of the performance plan. Each Haskell module is now built as a separate Nix derivation, enabling true incremental builds where only changed modules and their dependents are rebuilt. Implementation: - buildHsModuleGraph: Analyzes transitive module dependencies and builds DAG - TH detection: Falls back to monolithic build if Template Haskell detected - SCC cycle detection: Falls back if import cycles found - Per-module Nix builder: Each module -> separate derivation with .hi and .o - Module dependencies: Copy .hi files to build dir, use -i flags for imports - Final link: Use ghc --make with entry point source + -i paths to .hi files - Entry point fix: Explicitly analyze entry point module separately from deps Architecture: - Module compilation: ghc -c with -i paths to dependency .hi files - Source filtering: Each module derivation includes only its source file - Dependency DAG: Expressed as recursive Nix attrset with lib.fix - Link phase: ghc --make with entry source file + all .hi search paths - Fallback: Monolithic ghc --make when hsGraph is null (TH/cycles) Performance characteristics: - Change one module -> rebuild only that + dependents + relink - Nix handles DAG scheduling and caching automatically - Parallel module compilation (Nix orchestrates) - Content-addressed caching across machines Testing: - Added test_buildHsModuleGraph unit test - Verified with Omni/Bild/Example.hs (4 modules) - Tested incremental rebuild triggers correct subset This completes Phase 2 and Phase 3 core optimizations from the plan.
46 hoursTighten Nix source filtering to prevent spurious rebuildsBen Sima
Only include directories that are ancestors of source files in allSources. Previously accepted all directories, causing rebuilds when any new directory was added to the repo. Implementation: - Precompute normalized source paths and their ancestor directories - Filter directories against allowedDirs whitelist - Normalize paths in file filter for consistency - Keep existing skip list behavior for _ and .direnv This is optimization #2 from Phase 2 of the performance plan.
3 daysCleanup some logging setup codeBen Sima
I think the calls to Log.setup() were accidentally creating multiple loggers, hopefully this fixes the problem.
7 daysfeat: Add stripe to Python deps and document dependency processBen Sima
- Add stripe to Omni/Bild/Deps/Python.nix (alphabetically sorted) - Fix all type annotations in Billing.py for mypy - Document how to add Python packages in AGENTS.md - Add billing routes to Web.py (checkout, portal, webhook) This enables Stripe integration in PodcastItLater. Related to task t-144e7lF
2025-09-05Enhance worker memory managementBen Sima
Check to prevent processing of large articles, truncate oversized content, defer jobs during high memory usage, use streaming TTS generation and upload to minimize memory consumption.
2025-08-30Switch to nixos-unstable branchBen Sima
According to Claude, the nixos-unstable branch has more stuff in it's binary cache than nixos-unstable-small. Idk, let's try it and find out.
2025-08-28Prototype PodcastItLaterBen Sima
This implements a working prototype of PodcastItLater. It basically just works for a single user currently, but the articles are nice to listen to and this is something that we can start to build with.
2025-08-28Include summary in mypy build outputBen Sima
This is actually useful because nix only shows the last 25 log lines, so I'd like to know how deep the problems go with a summary.
2025-08-28Don't put colored output in bild mypy checkBen Sima
The colored output is not decoded by the nix log accumulator, so you just get these control characters. Get rid of them for more readable output.
2025-07-28Package kerykeion and swiss ephemerisBen Sima
This took quite a bit of work to package, and it's not a perfect package, but I think it will do to get Biz/Astrologer.py working.
2025-06-13Re-enable datasette, llm, and aiderBen Sima
I had to update nixos-unstable-small and nixos-24_11 and disable a bunch of tests, and then re-compile like the whole world, but aider is actually working, finally.
2025-05-22Add TestCase to Omni.TestBen Sima
Also improves the Example.py a bit with a real test case and example of how to use Omni.Test.
2025-05-07Switch Python to unstable and add pydantic-aiBen Sima
Pydantic-ai is an agent framework that seems simple and good: well-typed with pydantic, tool usage is just an `@tool` decorator on a function, and so on. While building these I realized there were some deps they needed that were already in nixpkgs unstable, so I just switched to that instead of trying to backport all the versions and stuff.
2025-04-11Switch from simatime.com to bensima.comBen Sima
This does the full transition: web server, mail server, xmpp. I expect some disruption, but hopefully this is everything and it just switches over without any problem.
2025-04-11Update, disable aider, datasette, and jupyterBen Sima
These are broken in upstream nixpkgs. Updating didn't fix them, so I'm just gonna disable them for now. I'm using pipx to install aider anyway. Also: Remove _ literal from GLOBIGNORE. I think it was causing the **/* glob to include stuff in the cabdir, idk why.
2025-03-18Update nixpkgs to get newer ollamaBen Sima
This is just so I can run gemma3. Ollama has more than just a src hash, it needs the godeps hash as well, so I can't simply track it with `deps` unfortunately.
2025-02-06Update nixpkgs and stupid fixesBen Sima
Some things got through the CI system, probably during updates. So I had more stupid little fixes to do. I should really improve bild to the point that these won't happen anymore and builds don't take so long.
2025-02-04Add dark mode to cgitBen Sima
I got this from the upstream branch jd/zx2c4-deployment, which does have the below commit implementing dark mode. I first cherry-picked the commit to master but it wouldn't build. Then I realized that the last cut release was v1.2.3 from 5 years ago, and that's what nixpkgs has pinned, so I cherry-picked it onto v1.2.3 and it went cleanly and built okay. So that's what I landed on. Maybe it would be better to use a patch instead of pushing my own fork like this, but whatever this works just fine. I can always switch to the patch method later. https://git.zx2c4.com/cgit/commit/?h=jd/zx2c4-deployment&id=8ed1bef90f631989c0cadc326a163b874a64e02d
2025-02-04Update ollama, llm-ollama, openai-python, llmBen Sima
I couldn't use llm-ollama because it required some package upgrades, so I started going down that rabbit hole and ended up 1) realizing that these packages are way out of date now, and 2) fiddling with overrides to get everything to work. I finally figured it out, the `postPatch` in ollama-python was throwing me off for like half a day. Anyway, one thing to note is that these are changing fast and I need to either move onto nixpkgs unstable for python stuff, or maintain my own builds of all of these. Not sure which is more appropriate right now. Oh and I had to fixup some logging stuff in Biz/Storybook.py because ruff started complaining about something, which is weird because I don't think the version changed? But it was easy enough to change.
2025-01-21Incorporate nvidia-patchBen Sima
OBS wouldn't allow me to stream because there was something wrong with `nvenc`, which I guess is the nvidia encoding library? Anyway searching around I found this nvidia-patch overlay and it fixed it right away, so that's cool.
2025-01-06Remove Python main idiom and add coding conventions to README.mdBen Sima
I realized I don't need this stupid `__main__` convention anymore because my build system always calls Python programs like `python -m main`, so I just need to have a function named `main()`. I also started adding some general coding conventions to the README and fixed a typo.
2025-01-03Get xmpp uploads working againBen Sima
The problem was that the ssl cert wasn't renewing. I added the domains to the nginx config, and cleaned up some other stuff. During debug I also udpated nixos-mailserver and nixos stable because I thought it would fix something; it didn't but I might as well use the updated versions of stuff since it seems to still work fine.
2025-01-02Switch to alejandra for nix formattingBen Sima
I mostly wanted a formatter that would format `inherit` blocks vertically, because otherwise they are super hard to read when diffing or even just editing. Both alejandra and the new nixos/nixfmt format verically like this, but alejandra has slightly better format (I guess) and for some reason nixfmt did not respect my `GLOBIGNORE` setting when doing `nixfmt **/*.nix` so it was trying to format stuff in `_/nix`, and failed. So anyway I went with alejandra. - https://github.com/kamadorueda/alejandra - https://discourse.nixos.org/t/enforcing-nix-formatting-in-nixpkgs/49506
2024-12-31Upgrade nixos 24.05 -> 24.11, ghc 9.4.8 -> 9.6.6Ben Sima
It's good to update, I think nixos 24.05 was deprecated anyway. The iPython dontCheck is because there was a test timeout; I don't even know why iPython is being pulled in but whatever.
2024-12-21Add shebangs and x bit to executablesBen Sima
With run.sh, we can build and run the file in one go. This means we can also use it as an interpreter in a shebang line and properly use the Unix executable bit. This is pretty cool and gives a few advantages: running any executable file is just `exec file.hs` or even `./file.hs`, finding all executables is `fd -t x`, you don't need to specify or know an `out` name to run something, execution of a program is standardized. There is a hack to get this to work. In C and Common Lisp, `#!` is illegal syntax, so I had to use shell syntax to invoke run.sh, call it on the current file, and then exit the shell script. Meanwhile, run.sh takes the file and evals the whole thing, building and running it. As long as either `//` or `;` is a comment character in the target language, then this works. Maybe a better thing to do would be to pre-process the file and remove the `#!` before passing it to the C compiler, like [ryanmjacobs/c][1] and [tcc][2]? However this won't work in Lisp because then I can't just load the file directly into the repl, so maybe the comment hack needs to stay. [1]: https://github.com/ryanmjacobs/c/tree/master [2]: https://repo.or.cz/tinycc.git/blob/HEAD:/tccrun.c
2024-12-21Manage Storybook ImagesBen Sima
This adds the Images endpoint and related functions for loading and saving images to the filesystem. In the view layer, it also loads the images asynchronously using HTMX, so the images get lazy-loaded only when they are done generating.
2024-12-21Convert Biz/Storybook.py to LudicBen Sima
This is basically a full rewrite. I ripped out Flask and rearchitected the whole thing to use fully RESTful resources and endpoints using Ludic. The UI was completely redone to use Ludic's components. I added tests for everything that I reasonably could. This is almost ready for an alpha launch. Before shipping it I still need to: 1. generate images using image n-1 applied to `openai.images.create_variation()` 2. write a nix service, get it on a VM somewhere, I'll probably provision a new VM for this 3. replace the `db` thing with a real sqlite database I only need the first one done to show it to Lia and see if she likes it, that should be completed in a day or two. Then the nix service and deployment won't take long at all. Setting up a sqlite database will be annoying, but that I can't see that actually taking more than 2 days. So max 5 days out from launching this to friends and family.
2024-12-21Package ludicBen Sima
This required upgrading to python 3.12 because of some f-string format thing that ludic uses. It's kind of annoying but the upgrade was easy enough, so I just did it.
2024-12-21Update nixos-24_05Ben Sima
It's good to do this often.
2024-12-21Implement storybook prototypeBen Sima
This paritally used gptme to create a storybook generator. The problem I ran into is that gptme doesn't do any architecting or considerations for maintainable code, or even readable code, so it just wrote a long script. I couldn't test it. Also, it didn't actually generate a 10-page story, it generated 10 separate stories. So, I ended up writing it myself and using gptme to fixup TODOs that I wrote along the way.
2024-12-21Re-namespace some stuff to OmniBen Sima
I was getting confused about what is a product and what is internal infrastructure; I think it is good to keep those things separate. So I moved a bunch of stuff to an Omni namespace, actually most stuff went there. Only things that are explicitly external products are still in the Biz namespace.