Skip to content

Commit

Permalink
networking: rename networkservices -> knownNetworkServices
Browse files Browse the repository at this point in the history
  • Loading branch information
LnL7 committed Jan 13, 2018
1 parent 9e87afc commit 5df343a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
7 changes: 7 additions & 0 deletions modules/alias.nix
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ in
{
options = {

networking.networkservices = mkOption { internal = true; default = null; };
nix.profile = mkOption { internal = true; default = null; };
security.enableAccessibilityAccess = mkOption { internal = true; default = null; };
security.accessibilityPrograms = mkOption { internal = true; default = null; };
Expand All @@ -22,6 +23,12 @@ in
{ 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;

};
Expand Down
10 changes: 5 additions & 5 deletions modules/networking/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ let
scutil --set HostName '${cfg.hostName}'
'';

setNetworkServices = optionalString (cfg.networkservices != []) ''
setNetworkServices = optionalString (cfg.knownNetworkServices != []) ''
networkservices=$(networksetup -listallnetworkservices)
${concatMapStringsSep "\n" (srv: ''
case "$networkservices" in
Expand All @@ -23,7 +23,7 @@ let
networksetup -setsearchdomains '${srv}' ${quoteStrings (emptyList cfg.search)}
;;
esac
'') cfg.networkservices}
'') cfg.knownNetworkServices}
'';
in

Expand All @@ -36,7 +36,7 @@ in
description = "Hostname for your machine.";
};

networking.networkservices = mkOption {
networking.knownNetworkServices = mkOption {
type = types.listOf types.str;
default = [];
example = [ "Wi-Fi" "Ethernet Adaptor" "Thunderbolt Ethernet" ];
Expand Down Expand Up @@ -65,8 +65,8 @@ in
config = {

warnings = [
(mkIf (cfg.networkservices == [] && cfg.dns != []) "networking.networkservices 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.dns != []) "networking.knownNetworkServices is empty, dns servers 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;
Expand Down
2 changes: 1 addition & 1 deletion tests/networking-networkservices.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{ config, pkgs, ... }:

{
networking.networkservices = [ "Wi-Fi" "Thunderbolt Ethernet" ];
networking.knownNetworkServices = [ "Wi-Fi" "Thunderbolt Ethernet" ];
networking.dns = [ "8.8.8.8" "8.8.4.4" ];

test = ''
Expand Down

0 comments on commit 5df343a

Please sign in to comment.