1
1
mirror of https://github.com/ryantm/agenix.git synced 2024-09-11 06:05:38 +03:00

Merge pull request #191 from linj-fork/fix-doc

doc: fix defaultText and description
This commit is contained in:
Ryan Mulligan 2023-07-14 06:28:38 -05:00 committed by GitHub
commit 0d8c5325fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 7 deletions

View File

@ -149,9 +149,10 @@ with lib; let
else "$XDG_RUNTIME_DIR"; else "$XDG_RUNTIME_DIR";
in "${baseDir}/${dir}"; in "${baseDir}/${dir}";
userDirectoryDescription = dir: '' userDirectoryDescription = dir:
"$XDG_RUNTIME_DIR"/${dir} on linux or "$(getconf DARWIN_USER_TEMP_DIR)"/${dir} on darwin. literalExpression ''
''; "$XDG_RUNTIME_DIR"/${dir} on linux or "$(getconf DARWIN_USER_TEMP_DIR)"/${dir} on darwin.
'';
in { in {
options.age = { options.age = {
package = mkPackageOption pkgs "rage" {}; package = mkPackageOption pkgs "rage" {};
@ -170,7 +171,7 @@ in {
"${config.home.homeDirectory}/.ssh/id_ed25519" "${config.home.homeDirectory}/.ssh/id_ed25519"
"${config.home.homeDirectory}/.ssh/id_rsa" "${config.home.homeDirectory}/.ssh/id_rsa"
]; ];
defaultText = litteralExpression '' defaultText = literalExpression ''
[ [
"''${config.home.homeDirectory}/.ssh/id_ed25519" "''${config.home.homeDirectory}/.ssh/id_ed25519"
"''${config.home.homeDirectory}/.ssh/id_rsa" "''${config.home.homeDirectory}/.ssh/id_rsa"

View File

@ -133,8 +133,9 @@ with lib; let
name = mkOption { name = mkOption {
type = types.str; type = types.str;
default = config._module.args.name; default = config._module.args.name;
defaultText = literalExpression "config._module.args.name";
description = '' description = ''
Name of the file used in ''${cfg.secretsDir} Name of the file used in {option}`age.secretsDir`
''; '';
}; };
file = mkOption { file = mkOption {
@ -146,6 +147,9 @@ with lib; let
path = mkOption { path = mkOption {
type = types.str; type = types.str;
default = "${cfg.secretsDir}/${config.name}"; default = "${cfg.secretsDir}/${config.name}";
defaultText = literalExpression ''
"''${cfg.secretsDir}/''${config.name}"
'';
description = '' description = ''
Path where the decrypted secret is installed. Path where the decrypted secret is installed.
''; '';
@ -167,6 +171,9 @@ with lib; let
group = mkOption { group = mkOption {
type = types.str; type = types.str;
default = users.${config.owner}.group or "0"; default = users.${config.owner}.group or "0";
defaultText = literalExpression ''
users.''${config.owner}.group or "0"
'';
description = '' description = ''
Group of the decrypted secret. Group of the decrypted secret.
''; '';
@ -183,6 +190,9 @@ in {
ageBin = mkOption { ageBin = mkOption {
type = types.str; type = types.str;
default = "${pkgs.rage}/bin/rage"; default = "${pkgs.rage}/bin/rage";
defaultText = literalExpression ''
"''${pkgs.rage}/bin/rage"
'';
description = '' description = ''
The age executable to use. The age executable to use.
''; '';
@ -210,9 +220,8 @@ in {
&& (builtins.match ".+/" s) == null) # without trailing slash && (builtins.match ".+/" s) == null) # without trailing slash
// {description = "${types.str.description} (with check: non-empty without trailing slash)";}; // {description = "${types.str.description} (with check: non-empty without trailing slash)";};
default = "/run/agenix.d"; default = "/run/agenix.d";
defaultText = "/run/agenix.d";
description = '' description = ''
Where secrets are created before they are symlinked to ''${cfg.secretsDir} Where secrets are created before they are symlinked to {option}`age.secretsDir`
''; '';
}; };
identityPaths = mkOption { identityPaths = mkOption {
@ -226,6 +235,16 @@ in {
"/etc/ssh/ssh_host_rsa_key" "/etc/ssh/ssh_host_rsa_key"
] ]
else []; else [];
defaultText = literalExpression ''
if (config.services.openssh.enable or false)
then map (e: e.path) (lib.filter (e: e.type == "rsa" || e.type == "ed25519") config.services.openssh.hostKeys)
else if isDarwin
then [
"/etc/ssh/ssh_host_ed25519_key"
"/etc/ssh/ssh_host_rsa_key"
]
else [];
'';
description = '' description = ''
Path to SSH keys to be used as identities in age decryption. Path to SSH keys to be used as identities in age decryption.
''; '';