From dbbc8c63b85b436e6fa7245e82790bc075e4b7e2 Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Sun, 14 Jan 2024 21:43:05 +0100 Subject: [PATCH 1/2] vm: Serve todo-app from www directory --- module.nix | 8 +------- www/index.html | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 www/index.html diff --git a/module.nix b/module.nix index a3942e4..c497921 100644 --- a/module.nix +++ b/module.nix @@ -6,13 +6,7 @@ virtualHosts.localhost.locations."/" = { index = "index.html"; - root = pkgs.writeTextDir "index.html" '' - - - Hello World! - - - ''; + root = ./www; }; }; }; diff --git a/www/index.html b/www/index.html new file mode 100644 index 0000000..8630255 --- /dev/null +++ b/www/index.html @@ -0,0 +1,23 @@ + + + + + + From ab3cc0c21795fa09c96fbc22612112728fa78361 Mon Sep 17 00:00:00 2001 From: Alexander Kobjolke Date: Sun, 14 Jan 2024 21:52:48 +0100 Subject: [PATCH 2/2] vm: Serve www directory from a shared directory Run the VM as WWW="$PWD/www" nix run to serve the www directory from within the VM. --- module.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/module.nix b/module.nix index c497921..6a04b1f 100644 --- a/module.nix +++ b/module.nix @@ -6,7 +6,7 @@ virtualHosts.localhost.locations."/" = { index = "index.html"; - root = ./www; + root = "/var/www"; }; }; }; @@ -19,5 +19,10 @@ host.port = 8080; }]; + virtualisation.sharedDirectories.www = { + source = "$WWW"; + target = "/var/www"; + }; + system.stateVersion = "23.11"; }