about summary refs log tree commit diff
path: root/modules/common/secrets.nix
blob: 2b8082e9bbe76be098870a66e7f8e4418a33e11a (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
37
{
  config,
  inputs,
  lib,
  pkgs,
  this,
  ...
}:
{
  imports = [
    inputs.agenix.nixosModules.default
    (lib.mkAliasOptionModule
      [ "secrets" ]
      [
        "age"
        "secrets"
      ]
    )
  ];

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

    environment.systemPackages = with pkgs; [
      age
      agenix
    ];

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

Consider giving Nix/NixOS a try! <3