summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xBiz.nix68
-rwxr-xr-xBiz/Dragons/Analysis.nix32
-rw-r--r--Biz/Targets.nix19
3 files changed, 72 insertions, 47 deletions
diff --git a/Biz.nix b/Biz.nix
index a76fd8c..7435c08 100755
--- a/Biz.nix
+++ b/Biz.nix
@@ -1,34 +1,38 @@
#!/usr/bin/env run.sh
# nunya
-{bild, ...}:
-# This is the biz hosting service. Currently it defines a base OS similar to
-# Omni/Cloud.nix et al and starts each Biz/* thing as a systemd service. A
-# better solution might be to define each Biz/* thing as a container, and then
-# wire them together as necessary here, but I don't know how that works so I'll
-# just stick to this method for now.
-bild.os {
- imports = [
- ./Omni/Cloud/Hardware.nix
- ./Omni/Os/Base.nix
- ./Omni/Packages.nix
- ./Omni/Users.nix
- ./Biz/Storybook.nix
- ./Biz/PodcastItLater/Web.nix
- ./Biz/PodcastItLater/Worker.nix
- ];
- networking.hostName = "biz";
- networking.domain = "storybook.bensima.com";
- time.timeZone = "America/New_York";
- services.storybook = {
- enable = false;
- package = bild.run ./Biz/Storybook.py;
- };
- services.podcastitlater-web = {
- enable = true;
- package = bild.run ./Biz/PodcastItLater/Web.py;
- };
- services.podcastitlater-worker = {
- enable = true;
- package = bild.run ./Biz/PodcastItLater/Worker.py;
- };
-}
+{bild, ...}: let
+ # Pre-declared targets prevent recursive builds during NixOS evaluation.
+ # All bild.run calls happen once at this top level.
+ targets = import ./Biz/Targets.nix {inherit bild;};
+in
+ # This is the biz hosting service. Currently it defines a base OS similar to
+ # Omni/Cloud.nix et al and starts each Biz/* thing as a systemd service. A
+ # better solution might be to define each Biz/* thing as a container, and then
+ # wire them together as necessary here, but I don't know how that works so I'll
+ # just stick to this method for now.
+ bild.os {
+ imports = [
+ ./Omni/Cloud/Hardware.nix
+ ./Omni/Os/Base.nix
+ ./Omni/Packages.nix
+ ./Omni/Users.nix
+ ./Biz/Storybook.nix
+ ./Biz/PodcastItLater/Web.nix
+ ./Biz/PodcastItLater/Worker.nix
+ ];
+ networking.hostName = "biz";
+ networking.domain = "storybook.bensima.com";
+ time.timeZone = "America/New_York";
+ services.storybook = {
+ enable = false;
+ package = targets.storybook;
+ };
+ services.podcastitlater-web = {
+ enable = true;
+ package = targets.podcastitlater-web;
+ };
+ services.podcastitlater-worker = {
+ enable = true;
+ package = targets.podcastitlater-worker;
+ };
+ }
diff --git a/Biz/Dragons/Analysis.nix b/Biz/Dragons/Analysis.nix
index 5ea8713..de641e8 100755
--- a/Biz/Dragons/Analysis.nix
+++ b/Biz/Dragons/Analysis.nix
@@ -1,16 +1,18 @@
#!/usr/bin/env run.sh
-{bild}:
-# Run this like so:
-#
-# bild Biz/Dragons/Analysis.nix
-# docker load < _/nix/Biz/Dragons/Analysis.nix
-# docker run --volume $PWD:/src dragons-analyze dragons-analyze /src/.git
-bild.image {
- name = "dragons-analyze";
- tag = "latest";
- fromImage = null;
- fromImageName = null;
- fromImageTag = "latest";
- contents = [bild.pkgs.git (bild.run ./Analysis.hs)];
- config.Cmd = ["/bin/dragons-analyze"];
-}
+{bild}: let
+ targets = import ../Targets.nix {inherit bild;};
+in
+ # Run this like so:
+ #
+ # bild Biz/Dragons/Analysis.nix
+ # docker load < _/nix/Biz/Dragons/Analysis.nix
+ # docker run --volume $PWD:/src dragons-analyze dragons-analyze /src/.git
+ bild.image {
+ name = "dragons-analyze";
+ tag = "latest";
+ fromImage = null;
+ fromImageName = null;
+ fromImageTag = "latest";
+ contents = [bild.pkgs.git targets.dragons-analysis];
+ config.Cmd = ["/bin/dragons-analyze"];
+ }
diff --git a/Biz/Targets.nix b/Biz/Targets.nix
new file mode 100644
index 0000000..77e462c
--- /dev/null
+++ b/Biz/Targets.nix
@@ -0,0 +1,19 @@
+# Pre-declared build targets for the Biz namespace.
+#
+# This file exposes all buildable Biz targets as an attribute set, allowing
+# NixOS configs to reference them directly without triggering recursive builds.
+#
+# To add a new target:
+# 1. Add the attribute here pointing to bild.run ./path/to/target
+# 2. Reference it in Biz.nix or other configs as targets.<name>
+{bild}: {
+ # Web services
+ storybook = bild.run ./Storybook.py;
+ podcastitlater-web = bild.run ./PodcastItLater/Web.py;
+ podcastitlater-worker = bild.run ./PodcastItLater/Worker.py;
+
+ # CLI tools and analysis
+ dragons-analysis = bild.run ./Dragons/Analysis.hs;
+
+ # Add new Biz targets here as they are created
+}