mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 12:15:34 +03:00
treewide: use more lib.optionalString
This commit is contained in:
parent
b392d9b827
commit
327b0cff7a
41 changed files with 89 additions and 95 deletions
|
@ -169,11 +169,11 @@ in
|
|||
else (concatStrings (map (i: "--interface=\"${i}\"")
|
||||
interfaces))} \
|
||||
-h "${hostKey}" \
|
||||
${if !syslog then "--no-syslog" else ""} \
|
||||
${optionalString (!syslog) "--no-syslog" } \
|
||||
${if passwordAuthentication then "--password" else "--no-password" } \
|
||||
${if publicKeyAuthentication then "--publickey" else "--no-publickey" } \
|
||||
${if rootLogin then "--root-login" else "--no-root-login" } \
|
||||
${if loginShell != null then "--login-shell=\"${loginShell}\"" else "" } \
|
||||
${optionalString (loginShell != null) "--login-shell=\"${loginShell}\"" } \
|
||||
${if srpKeyExchange then "--srp-keyexchange" else "--no-srp-keyexchange" } \
|
||||
${if !tcpForwarding then "--no-tcpip-forward" else "--tcpip-forward"} \
|
||||
${if x11Forwarding then "--x11-forward" else "--no-x11-forward" } \
|
||||
|
|
|
@ -474,10 +474,10 @@ in
|
|||
mkdir -m 0755 -p "$(dirname '${k.path}')"
|
||||
ssh-keygen \
|
||||
-t "${k.type}" \
|
||||
${if k ? bits then "-b ${toString k.bits}" else ""} \
|
||||
${if k ? rounds then "-a ${toString k.rounds}" else ""} \
|
||||
${if k ? comment then "-C '${k.comment}'" else ""} \
|
||||
${if k ? openSSHFormat && k.openSSHFormat then "-o" else ""} \
|
||||
${optionalString (k ? bits) "-b ${toString k.bits}"} \
|
||||
${optionalString (k ? rounds) "-a ${toString k.rounds}"} \
|
||||
${optionalString (k ? comment) "-C '${k.comment}'"} \
|
||||
${optionalString (k ? openSSHFormat && k.openSSHFormat) "-o"} \
|
||||
-f "${k.path}" \
|
||||
-N ""
|
||||
fi
|
||||
|
@ -550,7 +550,7 @@ in
|
|||
'') cfg.ports}
|
||||
|
||||
${concatMapStrings ({ port, addr, ... }: ''
|
||||
ListenAddress ${addr}${if port != null then ":" + toString port else ""}
|
||||
ListenAddress ${addr}${optionalString (port != null) (":" + toString port)}
|
||||
'') cfg.listenAddresses}
|
||||
|
||||
${optionalString cfgc.setXAuthLocation ''
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue