Skip to content

doc: fix defaultText and description #191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions modules/age-home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ with lib; let
else "$XDG_RUNTIME_DIR";
in "${baseDir}/${dir}";

userDirectoryDescription = dir: ''
"$XDG_RUNTIME_DIR"/${dir} on linux or "$(getconf DARWIN_USER_TEMP_DIR)"/${dir} on darwin.
'';
userDirectoryDescription = dir:
literalExpression ''
"$XDG_RUNTIME_DIR"/${dir} on linux or "$(getconf DARWIN_USER_TEMP_DIR)"/${dir} on darwin.
'';
in {
options.age = {
package = mkPackageOption pkgs "rage" {};
Expand All @@ -170,7 +171,7 @@ in {
"${config.home.homeDirectory}/.ssh/id_ed25519"
"${config.home.homeDirectory}/.ssh/id_rsa"
];
defaultText = litteralExpression ''
defaultText = literalExpression ''
[
"''${config.home.homeDirectory}/.ssh/id_ed25519"
"''${config.home.homeDirectory}/.ssh/id_rsa"
Expand Down
25 changes: 22 additions & 3 deletions modules/age.nix
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,9 @@ with lib; let
name = mkOption {
type = types.str;
default = config._module.args.name;
defaultText = literalExpression "config._module.args.name";
description = ''
Name of the file used in ''${cfg.secretsDir}
Name of the file used in {option}`age.secretsDir`
'';
};
file = mkOption {
Expand All @@ -146,6 +147,9 @@ with lib; let
path = mkOption {
type = types.str;
default = "${cfg.secretsDir}/${config.name}";
defaultText = literalExpression ''
"''${cfg.secretsDir}/''${config.name}"
'';
description = ''
Path where the decrypted secret is installed.
'';
Expand All @@ -167,6 +171,9 @@ with lib; let
group = mkOption {
type = types.str;
default = users.${config.owner}.group or "0";
defaultText = literalExpression ''
users.''${config.owner}.group or "0"
'';
description = ''
Group of the decrypted secret.
'';
Expand All @@ -183,6 +190,9 @@ in {
ageBin = mkOption {
type = types.str;
default = "${pkgs.rage}/bin/rage";
defaultText = literalExpression ''
"''${pkgs.rage}/bin/rage"
'';
description = ''
The age executable to use.
'';
Expand Down Expand Up @@ -210,9 +220,8 @@ in {
&& (builtins.match ".+/" s) == null) # without trailing slash
// {description = "${types.str.description} (with check: non-empty without trailing slash)";};
default = "/run/agenix.d";
defaultText = "/run/agenix.d";
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 {
Expand All @@ -226,6 +235,16 @@ in {
"/etc/ssh/ssh_host_rsa_key"
]
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 = ''
Path to SSH keys to be used as identities in age decryption.
'';
Expand Down