1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-12-14 11:57:34 +00:00

fix shell escaping in networking config

This commit is contained in:
Adam Curtis 2024-01-19 12:16:32 -05:00
parent 74ab0227ee
commit 5cec74dae1
2 changed files with 18 additions and 3 deletions

View file

@ -107,13 +107,13 @@ in
echo "configuring networking..." >&2
${optionalString (cfg.computerName != null) ''
scutil --set ComputerName '${cfg.computerName}'
scutil --set ComputerName ${escapeShellArg cfg.computerName}
''}
${optionalString (cfg.hostName != null) ''
scutil --set HostName '${cfg.hostName}'
scutil --set HostName ${escapeShellArg cfg.hostName}
''}
${optionalString (cfg.localHostName != null) ''
scutil --set LocalHostName '${cfg.localHostName}'
scutil --set LocalHostName ${escapeShellArg cfg.localHostName}
''}
${setNetworkServices}

View file

@ -0,0 +1,15 @@
{ config, pkgs, ... }:
{
networking.computerName = "\"Quotey McQuote's Macbook Pro\"";
networking.hostName = "\"Quotey-McQuote's-Macbook-Pro\"";
test = ''
echo checking hostname in /activate >&2
grep "scutil --set ComputerName '"\""Quotey McQuote's Macbook Pro"\""'" ${config.out}/activate
grep "scutil --set LocalHostName '"\""Quotey-McQuote's-Macbook-Pro"\""'" ${config.out}/activate
grep "scutil --set HostName "'"\""Quotey-McQuote's-Macbook-Pro"\""'" ${config.out}/activate
echo checking defaults write in ${config.out}/activate-user >&2
'';
}