1
0
Fork 0
mirror of https://github.com/LnL7/nix-darwin.git synced 2025-03-06 00:37:00 +00:00
nix-darwin/modules/networking/default.nix
Piotr Limanowski 8fe2cff0cc
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.
2017-07-05 22:17:58 +02:00

41 lines
667 B
Nix

{ 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}
'';
};
}