diff --git a/overview/default.nix b/overview/default.nix
index 174c744ad..594263b3c 100644
--- a/overview/default.nix
+++ b/overview/default.nix
@@ -101,6 +101,32 @@ let
markdownToHtml = markdown: "{{ markdown_to_html(${toJSON markdown}) }}";
render = {
+ # A code snippet that is copyable and optionally downloadable
+ codeSnippet.one =
+ {
+ filename,
+ language ? "nix",
+ relative ? false,
+ downloadable ? false,
+ }:
+ ''
+
+ {{ include_code("${language}", "${filename}" ${optionalString relative ", relative_path=True"}) }}
+
+
+ '';
options = rec {
one =
prefixLength: option:
@@ -148,7 +174,7 @@ let
one = example: ''
${example.description}
- {{ include_code("nix", "${example.module}")}}
+ ${render.codeSnippet.one { filename = example.module; }}
'';
@@ -274,7 +300,11 @@ let
Download this Nix file to your computer.
It obtains the NGIpkgs source code and declares a basic service configuration
to be run in a virtual machine.
- {{ include_code("nix", "default.nix", relative_path=True) }}
+ ${render.codeSnippet.one {
+ filename = "default.nix";
+ relative = true;
+ downloadable = true;
+ }}
Build the virtual machine defined in default.nix and run it:
@@ -377,7 +407,26 @@ let
- ${args.content}
+ ${args.content}
+