11import { describe , expect , it } from "@effect/vitest"
22import { Effect } from "effect"
33
4- import { planFiles } from "../../src/core/templates.js"
54import { type TemplateConfig } from "../../src/core/domain.js"
5+ import { planFiles } from "../../src/core/templates.js"
66
77describe ( "planFiles" , ( ) => {
88 it . effect ( "includes docker and config files" , ( ) =>
@@ -22,6 +22,7 @@ describe("planFiles", () => {
2222 codexAuthPath : "./.orch/auth/codex" ,
2323 codexSharedAuthPath : "../../.orch/auth/codex" ,
2424 codexHome : "/home/dev/.codex" ,
25+ baseFlavor : "ubuntu" ,
2526 enableMcpPlaywright : false ,
2627 pnpmVersion : "10.27.0"
2728 }
@@ -97,6 +98,7 @@ describe("planFiles", () => {
9798 codexAuthPath : "./.orch/auth/codex" ,
9899 codexSharedAuthPath : "../../.orch/auth/codex" ,
99100 codexHome : "/home/dev/.codex" ,
101+ baseFlavor : "ubuntu" ,
100102 enableMcpPlaywright : true ,
101103 pnpmVersion : "10.27.0"
102104 }
@@ -113,6 +115,40 @@ describe("planFiles", () => {
113115 expect ( browserScript !== undefined && browserScript . _tag === "File" ) . toBe ( true )
114116 } ) )
115117
118+ it . effect ( "renders Nix flavor Dockerfile when requested" , ( ) =>
119+ Effect . sync ( ( ) => {
120+ const config : TemplateConfig = {
121+ containerName : "dg-test" ,
122+ serviceName : "dg-test" ,
123+ sshUser : "dev" ,
124+ sshPort : 2222 ,
125+ repoUrl : "https://github.com/org/repo.git" ,
126+ repoRef : "main" ,
127+ targetDir : "/home/dev/app" ,
128+ volumeName : "dg-test-home" ,
129+ authorizedKeysPath : "./authorized_keys" ,
130+ envGlobalPath : "./.orch/env/global.env" ,
131+ envProjectPath : "./.orch/env/project.env" ,
132+ codexAuthPath : "./.orch/auth/codex" ,
133+ codexSharedAuthPath : "../../.orch/auth/codex" ,
134+ codexHome : "/home/dev/.codex" ,
135+ baseFlavor : "nix" ,
136+ enableMcpPlaywright : false ,
137+ pnpmVersion : "10.27.0"
138+ }
139+
140+ const specs = planFiles ( config )
141+ const dockerfileSpec = specs . find (
142+ ( spec ) => spec . _tag === "File" && spec . relativePath === "Dockerfile"
143+ )
144+ expect ( dockerfileSpec !== undefined && dockerfileSpec . _tag === "File" ) . toBe ( true )
145+ if ( dockerfileSpec && dockerfileSpec . _tag === "File" ) {
146+ expect ( dockerfileSpec . contents ) . toContain ( "FROM nixos/nix:latest" )
147+ expect ( dockerfileSpec . contents ) . toContain ( "nix profile install --profile /nix/var/nix/profiles/default" )
148+ expect ( dockerfileSpec . contents ) . not . toContain ( "FROM ubuntu:24.04" )
149+ }
150+ } ) )
151+
116152 it . effect ( "embeds issue workspace AGENTS context in entrypoint" , ( ) =>
117153 Effect . sync ( ( ) => {
118154 const config : TemplateConfig = {
@@ -130,6 +166,7 @@ describe("planFiles", () => {
130166 codexAuthPath : "./.orch/auth/codex" ,
131167 codexSharedAuthPath : "../../.orch/auth/codex" ,
132168 codexHome : "/home/dev/.codex" ,
169+ baseFlavor : "ubuntu" ,
133170 enableMcpPlaywright : false ,
134171 pnpmVersion : "10.27.0"
135172 }
@@ -169,6 +206,7 @@ describe("planFiles", () => {
169206 codexAuthPath : "./.orch/auth/codex" ,
170207 codexSharedAuthPath : "../../.orch/auth/codex" ,
171208 codexHome : "/home/dev/.codex" ,
209+ baseFlavor : "ubuntu" ,
172210 enableMcpPlaywright : false ,
173211 pnpmVersion : "10.27.0"
174212 }
0 commit comments