diff options
| author | Piotr Limanowski <plimanowski@codearsonist.com> | 2017-07-05 11:32:36 +0200 |
|---|---|---|
| committer | Piotr Limanowski <plimanowski@codearsonist.com> | 2017-07-05 22:17:58 +0200 |
| commit | 8fe2cff0cc646369f0d07fcddcde063a41b373a1 (patch) | |
| tree | 0ab0ee98f55c6c3aa4f96c56d338c66a29d2acce /modules/networking | |
| parent | 5e61ca9fb488fce83170db28188615537a64f6e1 (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.nix | 41 |
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} + ''; + + }; +} |
