diff options
| author | Daiderd Jordan <daiderd@gmail.com> | 2017-07-06 21:52:21 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-06 21:52:21 +0200 |
| commit | ebc7f7b2dafea3fe4610baf2c3ef90811b193229 (patch) | |
| tree | d9b6bd7e667190018a1d7fe22cc227567bbf15f7 /modules | |
| parent | fcef55a53aa206f8861b5d516df46283c2908031 (diff) | |
| parent | 8fe2cff0cc646369f0d07fcddcde063a41b373a1 (diff) | |
Merge pull request #39 from peel/f-networking
Adds an idea for networking module
Diffstat (limited to 'modules')
| -rw-r--r-- | modules/networking/default.nix | 41 | ||||
| -rw-r--r-- | modules/system/activation-scripts.nix | 1 |
2 files changed, 42 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} + ''; + + }; +} diff --git a/modules/system/activation-scripts.nix b/modules/system/activation-scripts.nix index 301c612..aa97633 100644 --- a/modules/system/activation-scripts.nix +++ b/modules/system/activation-scripts.nix @@ -60,6 +60,7 @@ in ${cfg.activationScripts.etc.text} ${cfg.activationScripts.launchd.text} ${cfg.activationScripts.time.text} + ${cfg.activationScripts.networking.text} # Make this configuration the current configuration. # The readlink is there to ensure that when $systemConfig = /system |
