about summary refs log tree commit diff
path: root/modules/common/secrets.nix
blob: 77dee44bd4e6a5ef41392437044ce42b2d38582d (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
31
32
33
34
35
36
{
  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; [
      age
      agenix
    ];

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

Consider giving Nix/NixOS a try! <3