Refactor the Nix config management.
This commit is contained in:
parent
55fe63bcdb
commit
aca053b4e1
23 changed files with 954 additions and 1764 deletions
26
nix-system-configs/modules/local/hostname_username.nix
Normal file
26
nix-system-configs/modules/local/hostname_username.nix
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
# Example host-specific module: set hostname and small per-host packages
|
||||
# The machine file can set `config.local.hostname` before importing this module if desired.
|
||||
networking.hostName = config.local.hostname or "default-hostname";
|
||||
|
||||
# Expose a small list that machine files can use as hostPackages
|
||||
myLocal.hostname.packages = with pkgs; [];
|
||||
|
||||
users.users.${config.local.username or "defaultuser"} = {
|
||||
isNormalUser = true;
|
||||
description = config.local.userDescription or "NixOS Playground";
|
||||
extraGroups = ["networkmanager" "wheel" "seat" "acme"];
|
||||
packages = with pkgs; [];
|
||||
initialPassword = "nixos"; # Simple, change on first login
|
||||
|
||||
# NitroKey3C OpenGPG /w pin - Christine's key, for alpha run only, later to be replaced with the more official key
|
||||
openssh.authorizedKeys.keys = [
|
||||
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIO3pjIXlpg7H9h1RrmdxbIRnDIdQvf/EZKI9PG2/rY7D openpgp:0x8BCD4992"
|
||||
];
|
||||
};
|
||||
}
|
||||
45
nix-system-configs/modules/local/networking_local.nix
Normal file
45
nix-system-configs/modules/local/networking_local.nix
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
{
|
||||
config,
|
||||
pkgs,
|
||||
lib,
|
||||
...
|
||||
}: {
|
||||
# Some programs need SUID wrappers, can be configured further or are
|
||||
# started in user sessions.
|
||||
# programs.mtr.enable = true;
|
||||
# programs.gnupg.agent = {
|
||||
# enable = true;
|
||||
# enableSSHSupport = true;
|
||||
# };
|
||||
|
||||
# List services that you want to enable:
|
||||
|
||||
# Open ports in the firewall.
|
||||
# networking.firewall.allowedTCPPorts = [ ... ];
|
||||
# networking.firewall.allowedUDPPorts = [ ... ];
|
||||
# Or disable the firewall altogether.
|
||||
# networking.firewall.enable = false;
|
||||
|
||||
services.resolved.enable = false;
|
||||
|
||||
# Use this clean static network configuration instead:
|
||||
networking.useDHCP = false;
|
||||
networking.networkmanager.enable = false; # Disable NetworkManager
|
||||
|
||||
networking.interfaces.ens18 = {
|
||||
ipv4.addresses = [
|
||||
{
|
||||
address = config.local.address or "10.1.1.100";
|
||||
prefixLength = 24;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
networking.defaultGateway = {
|
||||
address = "10.1.1.1";
|
||||
interface = "ens18";
|
||||
};
|
||||
|
||||
# Explicitly set DNS
|
||||
networking.nameservers = ["10.1.1.2"]; # PiHole DNS
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue