1
0
Fork 0
nixos-config/overlays/private.nix

26 lines
760 B
Nix
Raw Normal View History

2020-10-12 01:14:05 +00:00
final: prev:
let
# val = if prev.withSecrets then
# assert builtins.pathExists ../private/submodule-is-checked-out; true
# else
# false;
val = builtins.pathExists ../private/submodule-is-checked-out;
in {
withSecrets = builtins.trace
(if val then "Building _with_ secrets!" else "Building _without_ secrets!")
val;
2020-09-30 23:30:40 +00:00
privatePath = name:
let path = "/etc/nixos/private/${name}";
in if final.withSecrets then
assert builtins.pathExists path; path
else
path;
privateValue = default: name:
if final.withSecrets then import (../private + "/${name}.nix") else default;
privateFile = name:
2020-10-12 01:14:05 +00:00
if final.withSecrets then
../private + "/${name}"
else
builtins.toFile "missing-secret-file-${name}" "";
2020-09-30 23:30:40 +00:00
}