/ modules / common / agenix.nix
agenix.nix
 1  { config, lib, pkgs, ... }: let
 2    inherit (lib) attrValues mkAliasOptionModule mkIf;
 3  in {
 4    imports = [(mkAliasOptionModule [ "secrets" ] [ "age" "secrets" ])];
 5  
 6    age.identityPaths = [
 7      (if config.isLinux then
 8        "/root/.ssh/id_ed25519"
 9      else
10        "/Users/${config.system.primaryUser}/.ssh/id_ed25519")
11    ];
12  
13    environment = mkIf config.isDesktop {
14      shellAliases.agenix = "agenix --identity ~/.ssh/id_ed25519";
15      systemPackages = attrValues {
16        inherit (pkgs) agenix;
17      };
18    };
19  }