about summary refs log tree commit diff
path: root/modules/common/secrets.nix
blob: 03a2eeb8789986fb3737522a2cb86ec8fd0a4f73 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
{
  config,
  inputs,
  lib,
  pkgs,
  this,
  ...
}:
with lib;
{
  imports = [
    inputs.agenix.nixosModules.default
    (mkAliasOptionModule [ "secrets" ] [
      "age"
      "secrets"
    ])
  ];

  config = {
    age.identityPaths =
      if this.isHeadful then
        [ "${config.my.home}/.ssh/id_${my.ssh.type}" ]
      else
        map (attr: attr.path) (filter (attr: attr.type == my.ssh.type) config.services.openssh.hostKeys);

    environment.systemPackages = with pkgs; [ agenix ];

    nixpkgs.overlays = [ inputs.agenix.overlays.default ];
  };
}

Consider giving Nix/NixOS a try! <3