commit eacab2d0e7c51fb2c0b0f04c57084cb0453cfc08 parent e11927c33eaeabb2c941ef25f4b99dce85c64a9a Author: Vincent Demeester <vincent@sbr.pm> Date: Mon, 1 Jun 2020 18:41:06 +0200 nix: add mkSecret function Signed-off-by: Vincent Demeester <vincent@sbr.pm> Diffstat:
M | modules/core/nix.nix | | | 1 | + |
A | overlays/mkSecret.nix | | | 10 | ++++++++++ |
2 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/modules/core/nix.nix b/modules/core/nix.nix @@ -83,6 +83,7 @@ in nixpkgs = { overlays = [ + (import ../../overlays/mkSecret.nix) (import ../../overlays/sbr.nix) (import ../../overlays/unstable.nix) (import ../../nix).emacs diff --git a/overlays/mkSecret.nix b/overlays/mkSecret.nix @@ -0,0 +1,10 @@ +self: super: +with builtins; with self.lib; +{ + mkSecret = path: + let + name = baseNameOf (toString path); + stub = toFile name "This is a stub!\n"; + in + if pathExists path then path else self.lib.warn "Using stub for secrets/${name}" stub; +}