mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 18:59:07 +01:00
Rename modules directory system to nixos
This commit is contained in:
parent
653a6f310b
commit
1c1b9221fc
48 changed files with 1 additions and 1 deletions
38
modules/nixos/sops.nix
Normal file
38
modules/nixos/sops.nix
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
{
|
||||
config,
|
||||
inputs,
|
||||
self,
|
||||
lib,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.custom.sops;
|
||||
in
|
||||
{
|
||||
imports = [ inputs.sops.nixosModules.sops ];
|
||||
|
||||
options.custom.sops = {
|
||||
enable = lib.mkEnableOption "";
|
||||
agePublicKey = lib.mkOption {
|
||||
type = lib.types.nonEmptyStr;
|
||||
default = "${self}/hosts/${config.networking.hostName}/keys/age.pub" |> lib.readFile |> lib.trim;
|
||||
};
|
||||
secretsFile = lib.mkOption {
|
||||
type = self.lib.types.existingPath;
|
||||
default = "${self}/hosts/${config.networking.hostName}/secrets.json";
|
||||
};
|
||||
secrets = lib.mkOption {
|
||||
type = lib.types.anything;
|
||||
default = cfg.secretsFile |> lib.readFile |> lib.strings.fromJSON;
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
sops = {
|
||||
age.sshKeyPaths = [
|
||||
"${lib.optionalString config.custom.persistence.enable "/persist"}/etc/ssh/ssh_host_ed25519_key"
|
||||
];
|
||||
defaultSopsFile = cfg.secretsFile;
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue