document components
This commit is contained in:
parent
5189feae3a
commit
f76e2e42fe
3 changed files with 4 additions and 0 deletions
2
lib.nix
2
lib.nix
|
@ -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;
|
||||||
|
|
|
@ -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
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Reference in a new issue