nix-config/home/secrets/default.nix
Bruno BELANYI fb2ec8cd6b home: secrets: use more specific type
I will amend it if I need more types, but for now this is fine.
2021-06-27 19:48:42 +02:00

32 lines
619 B
Nix

{ lib, ... }:
with lib;
let
throwOnCanary =
let
canaryHash = builtins.hashFile "sha256" ./canary;
expectedHash =
"9df8c065663197b5a1095122d48e140d3677d860343256abd5ab6e4fb4c696ab";
in
if canaryHash != expectedHash
then throw "Secrets are not readable. Have you run `git-crypt unlock`?"
else id;
in
throwOnCanary {
options.my.secrets = mkOption {
type =
let
valueType = with types; oneOf [
int
str
(attrsOf valueType)
];
in
valueType;
};
config.my.secrets = {
# Home-manager secrets go here
};
}