Commit eacab2d0e7c5

Vincent Demeester <vincent@sbr.pm>
2020-06-01 18:41:06
nix: add mkSecret function
Signed-off-by: Vincent Demeester <vincent@sbr.pm>
1 parent e11927c
Changed files (2)
modules
overlays
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
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;
+}