1
1
mirror of https://github.com/LnL7/nix-darwin.git synced 2024-08-16 08:00:34 +03:00

networking: rename networkservices -> knownNetworkServices

This commit is contained in:
Daiderd Jordan 2018-01-13 02:12:39 +01:00
parent 9e87afcb4e
commit 5df343aae5
No known key found for this signature in database
GPG Key ID: D02435D05B810C96
3 changed files with 13 additions and 6 deletions

View File

@ -9,6 +9,7 @@ in
{ {
options = { options = {
networking.networkservices = mkOption { internal = true; default = null; };
nix.profile = mkOption { internal = true; default = null; }; nix.profile = mkOption { internal = true; default = null; };
security.enableAccessibilityAccess = mkOption { internal = true; default = null; }; security.enableAccessibilityAccess = mkOption { internal = true; default = null; };
security.accessibilityPrograms = mkOption { internal = true; default = null; }; security.accessibilityPrograms = mkOption { internal = true; default = null; };
@ -22,6 +23,12 @@ in
{ assertion = config.security.enableAccessibilityAccess == null; message = "security.enableAccessibilityAccess was removed, it's broken since 10.12 because of SIP"; } { assertion = config.security.enableAccessibilityAccess == null; message = "security.enableAccessibilityAccess was removed, it's broken since 10.12 because of SIP"; }
]; ];
warnings = mkIf (config.networking.networkservices != null) [
"networking.networkservices was renamed to networking.knownNetworkServices"
];
networking.knownNetworkServices = mkIf (config.networking.networkservices != null) config.networking.networkservices;
nix.package = mkIf (config.nix.profile != null) config.nix.profile; nix.package = mkIf (config.nix.profile != null) config.nix.profile;
}; };

View File

@ -14,7 +14,7 @@ let
scutil --set HostName '${cfg.hostName}' scutil --set HostName '${cfg.hostName}'
''; '';
setNetworkServices = optionalString (cfg.networkservices != []) '' setNetworkServices = optionalString (cfg.knownNetworkServices != []) ''
networkservices=$(networksetup -listallnetworkservices) networkservices=$(networksetup -listallnetworkservices)
${concatMapStringsSep "\n" (srv: '' ${concatMapStringsSep "\n" (srv: ''
case "$networkservices" in case "$networkservices" in
@ -23,7 +23,7 @@ let
networksetup -setsearchdomains '${srv}' ${quoteStrings (emptyList cfg.search)} networksetup -setsearchdomains '${srv}' ${quoteStrings (emptyList cfg.search)}
;; ;;
esac esac
'') cfg.networkservices} '') cfg.knownNetworkServices}
''; '';
in in
@ -36,7 +36,7 @@ in
description = "Hostname for your machine."; description = "Hostname for your machine.";
}; };
networking.networkservices = mkOption { networking.knownNetworkServices = mkOption {
type = types.listOf types.str; type = types.listOf types.str;
default = []; default = [];
example = [ "Wi-Fi" "Ethernet Adaptor" "Thunderbolt Ethernet" ]; example = [ "Wi-Fi" "Ethernet Adaptor" "Thunderbolt Ethernet" ];
@ -65,8 +65,8 @@ in
config = { config = {
warnings = [ warnings = [
(mkIf (cfg.networkservices == [] && cfg.dns != []) "networking.networkservices is empty, dns servers will not be configured.") (mkIf (cfg.knownNetworkServices == [] && cfg.dns != []) "networking.knownNetworkServices is empty, dns servers will not be configured.")
(mkIf (cfg.networkservices == [] && cfg.search != []) "networking.networkservices is empty, dns searchdomains will not be configured.") (mkIf (cfg.knownNetworkServices == [] && cfg.search != []) "networking.knownNetworkServices is empty, dns searchdomains will not be configured.")
]; ];
system.defaults.smb.NetBIOSName = cfg.hostName; system.defaults.smb.NetBIOSName = cfg.hostName;

View File

@ -1,7 +1,7 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
networking.networkservices = [ "Wi-Fi" "Thunderbolt Ethernet" ]; networking.knownNetworkServices = [ "Wi-Fi" "Thunderbolt Ethernet" ];
networking.dns = [ "8.8.8.8" "8.8.4.4" ]; networking.dns = [ "8.8.8.8" "8.8.4.4" ];
test = '' test = ''