mirror of
https://github.com/LnL7/nix-darwin.git
synced 2025-03-05 08:17:01 +00:00
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.
This commit is contained in:
parent
5e61ca9fb4
commit
8fe2cff0cc
3 changed files with 43 additions and 0 deletions
|
@ -31,6 +31,7 @@ let
|
|||
./modules/system/etc.nix
|
||||
./modules/system/launchd.nix
|
||||
./modules/time
|
||||
./modules/networking
|
||||
./modules/nix
|
||||
./modules/nix/nix-darwin.nix
|
||||
./modules/nix/nixpkgs.nix
|
||||
|
|
41
modules/networking/default.nix
Normal file
41
modules/networking/default.nix
Normal file
|
@ -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}
|
||||
'';
|
||||
|
||||
};
|
||||
}
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue