1
Fork 0
mirror of https://github.com/RGBCube/ncc synced 2025-07-27 18:17:44 +00:00
ncc/modules/common/agenix.nix

19 lines
578 B
Nix

{ config, lib, pkgs, ... }: let
inherit (lib) attrNames filterAttrs hasPrefix head mkAliasOptionModule mkIf;
in {
imports = [(mkAliasOptionModule [ "secrets" ] [ "age" "secrets" ])];
age.identityPaths = [
(if config.isLinux then
"/root/.ssh/id"
else
"/Users/${head <| attrNames <| filterAttrs (_: value: value.home != null && hasPrefix "/Users/" value.home) config.users.users}/.ssh/id")
];
environment = mkIf config.isDesktop {
shellAliases.agenix = "agenix --identity ~/.ssh/id";
systemPackages = [
pkgs.agenix
];
};
}