document components

This commit is contained in:
Kiara Grouwstra 2025-05-28 22:56:15 +02:00
parent 5189feae3a
commit f76e2e42fe
Signed by: kiara
SSH key fingerprint: SHA256:COspvLoLJ5WC5rFb9ZDe5urVCkK4LJZOsjfF4duRJFU
3 changed files with 4 additions and 0 deletions

View file

@ -1,10 +1,12 @@
{ pkgs, nix_templater }: { pkgs, nix_templater }:
rec { rec {
# placeholder to be substituted with the content of a secret file
fileContents = file: { fileContents = file: {
outPath = "<${builtins.placeholder "nix_template"}${toString file}${builtins.placeholder "nix_template"}>"; outPath = "<${builtins.placeholder "nix_template"}${toString file}${builtins.placeholder "nix_template"}>";
file = file; file = file;
}; };
# make a template with placeholders
template_text = { name, text, outPath }: template_text = { name, text, outPath }:
pkgs.runCommand name { pkgs.runCommand name {
textBeforeTemplate = text; textBeforeTemplate = text;

View file

@ -1,3 +1,4 @@
# replace occurrences of a magic string in a template file
import sys import sys
from pathlib import Path from pathlib import Path

View file

@ -1,3 +1,4 @@
# test injecting a secret into a template
{ legacyPackages, system, nixpkgs }: { legacyPackages, system, nixpkgs }:
let let
# this file would usually be outside of the store # this file would usually be outside of the store