summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
Diffstat (limited to 'modules')
-rw-r--r--modules/networking/default.nix11
-rw-r--r--modules/system/defaults-write.nix2
-rw-r--r--modules/system/defaults/smb.nix13
3 files changed, 18 insertions, 8 deletions
diff --git a/modules/networking/default.nix b/modules/networking/default.nix
index 0eed284..e45199e 100644
--- a/modules/networking/default.nix
+++ b/modules/networking/default.nix
@@ -3,34 +3,29 @@
with lib;
let
-
cfg = config.networking;
hostName = optionalString (cfg.hostName != null) ''
scutil --set ComputerName '${cfg.hostName}'
scutil --set LocalHostName '${cfg.hostName}'
scutil --set HostName '${cfg.hostName}'
- defaults write /Library/Preferences/SystemConfiguration/com.apple.smb.server NetBIOSName -string '${cfg.hostName}'
'';
-
in
{
options = {
-
networking.hostName = mkOption {
type = types.nullOr types.str;
default = null;
example = "myhostname";
- description = ''
- Hostname for your machine.
- '';
+ description = "Hostname for your machine.";
};
-
};
config = {
+ system.defaults.smb.NetBIOSName = cfg.hostName;
+
system.activationScripts.networking.text = ''
# Set defaults
echo "configuring networking..." >&2
diff --git a/modules/system/defaults-write.nix b/modules/system/defaults-write.nix
index e5c2cdd..eca78b6 100644
--- a/modules/system/defaults-write.nix
+++ b/modules/system/defaults-write.nix
@@ -26,6 +26,7 @@ let
LaunchServices = defaultsToList "com.apple.LaunchServices" cfg.LaunchServices;
dock = defaultsToList "com.apple.dock" cfg.dock;
finder = defaultsToList "com.apple.finder" cfg.finder;
+ smb = defaultsToList "/Library/Preferences/SystemConfiguration/com.apple.smb.server" cfg.smb;
trackpad = defaultsToList "com.apple.AppleMultitouchTrackpad" cfg.trackpad;
trackpadBluetooth = defaultsToList "com.apple.driver.AppleBluetoothMultitouch.trackpad" cfg.trackpad;
@@ -45,6 +46,7 @@ in
${concatStringsSep "\n" LaunchServices}
${concatStringsSep "\n" dock}
${concatStringsSep "\n" finder}
+ ${concatStringsSep "\n" smb}
${concatStringsSep "\n" trackpad}
${concatStringsSep "\n" trackpadBluetooth}
'';
diff --git a/modules/system/defaults/smb.nix b/modules/system/defaults/smb.nix
new file mode 100644
index 0000000..edc9d06
--- /dev/null
+++ b/modules/system/defaults/smb.nix
@@ -0,0 +1,13 @@
+{ config, lib, ... }:
+
+with lib;
+
+{
+ options = {
+ system.defaults.smb.NetBIOSName = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ description = "Hostname to use for NetBIOS.";
+ };
+ };
+}