summaryrefslogtreecommitdiff
path: root/modules/networking
diff options
context:
space:
mode:
authorPiotr Limanowski <plimanowski@codearsonist.com>2017-07-05 11:32:36 +0200
committerPiotr Limanowski <plimanowski@codearsonist.com>2017-07-05 22:17:58 +0200
commit8fe2cff0cc646369f0d07fcddcde063a41b373a1 (patch)
tree0ab0ee98f55c6c3aa4f96c56d338c66a29d2acce /modules/networking
parent5e61ca9fb488fce83170db28188615537a64f6e1 (diff)
Adds an idea for networking module
The idea is to follow: https://nixos.org/nixos/options.html#networking so we can share even more configuration ideas from NixOS.
Diffstat (limited to 'modules/networking')
-rw-r--r--modules/networking/default.nix41
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/networking/default.nix b/modules/networking/default.nix
new file mode 100644
index 0000000..634618e
--- /dev/null
+++ b/modules/networking/default.nix
@@ -0,0 +1,41 @@
+{ config, lib, pkgs, ... }:
+
+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}"
+ '';
+
+in
+
+{
+ options = {
+
+ networking.hostName = mkOption {
+ type = types.nullOr types.str;
+ default = null;
+ example = "myhostname";
+ description = ''
+ Hostname for your machine.
+ '';
+ };
+
+ };
+
+ config = {
+
+ system.activationScripts.networking.text = ''
+ # Set defaults
+ echo "configuring networking..." >&2
+
+ ${hostName}
+ '';
+
+ };
+}