1
0
Fork 0

General: standardize hostname setting and DHCP config

This commit is contained in:
Aires 2024-07-06 12:50:45 -04:00
parent 323adb7568
commit 33343d881f
12 changed files with 39 additions and 71 deletions

View file

@ -8,6 +8,7 @@
let
# Do not change this value! This tracks when NixOS was installed on your system.
stateVersion = "24.11";
hostName = "Dimaga";
start-services = pkgs.writeShellScriptBin "start-services" (
builtins.readFile ../Haven/start-haven.sh
@ -35,6 +36,7 @@ in
imports = [ ./hardware-configuration.nix ];
system.stateVersion = stateVersion;
networking.hostName = hostName;
###*** Configure your system below this line. ***###
# Set your time zone.

View file

@ -47,15 +47,5 @@ in
};
};
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
networking = {
hostName = "Dimaga";
useDHCP = lib.mkDefault true;
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View file

@ -6,6 +6,9 @@
...
}:
let
stateVersion = "24.05";
hostName = "Haven";
start-haven = pkgs.writeShellScriptBin "start-haven" (builtins.readFile ./start-haven.sh);
services-root = "/storage/services";
@ -29,7 +32,8 @@ in
{
imports = [ ./hardware-configuration.nix ];
system.stateVersion = "24.05";
system.stateVersion = stateVersion;
networking.hostName = hostName;
aux.system = {
apps.tmux.enable = true;

View file

@ -65,11 +65,4 @@
size = 16384;
}
];
networking = {
useDHCP = lib.mkDefault true;
hostName = "Haven";
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View file

@ -2,17 +2,20 @@
config,
lib,
pkgs,
system,
...
}:
let
# Do not change this value! This tracks when NixOS was installed on your system.
stateVersion = "24.05";
hostName = "Khanda";
in
{
imports = [ ./hardware-configuration.nix ];
system.stateVersion = stateVersion;
networking.hostName = hostName;
###*** Configure your system below this line. ***###
# Set your time zone.

View file

@ -81,12 +81,6 @@ in
};
};
networking = {
useDHCP = lib.mkDefault true;
hostName = "Khanda";
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware = {
cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
# Enable camera driver

View file

@ -5,10 +5,15 @@
nix-secrets,
...
}:
let
stateVersion = "24.05";
hostName = "Pihole";
in
{
imports = [ ./hardware-configuration.nix ];
system.stateVersion = "24.05";
system.stateVersion = stateVersion;
networking.hostName = hostName;
aux.system = {
apps.tmux.enable = true;
@ -32,7 +37,6 @@
# Connect to the network automagically
networking = {
hostName = "Pihole";
networkmanager.enable = lib.mkForce false;
wireless.networks = {
"${config.secrets.networking.networks.home.SSID}" = {

View file

@ -7,6 +7,7 @@
let
# Do not change this value! This tracks when NixOS was installed on your system.
stateVersion = "24.05";
hostName = "Shura";
# Copy bluetooth device configs
shure-aonic-bluetooth = pkgs.writeText "info" (
@ -30,6 +31,7 @@ in
imports = [ ./hardware-configuration.nix ];
system.stateVersion = stateVersion;
networking.hostName = hostName;
aux.system = {
apps = {

View file

@ -45,18 +45,4 @@ in
size = 16384;
};
};
networking = {
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
useDHCP = lib.mkDefault true;
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
# Set the hostname.
hostName = "Shura";
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}

View file

@ -6,13 +6,22 @@
config,
...
}:
let
# Do not change this value! This tracks when NixOS was installed on your system.
stateVersion = "24.11";
# The hostname for this system.
hostName = "myHost";
in
{
# Generate hardware-configuration.nix by running this command on the host:
# $ nixos-generate-config
imports = [ ./hardware-configuration.nix ];
system.stateVersion = "24.05";
system.stateVersion = stateVersion;
networking.hostName = hostName;
# Configure the system here.
aux.system = {
role = "workstation";
apps = {

View file

@ -7,11 +7,8 @@
...
}:
let
hostName = "myHost";
platform = "x86_64-linux";
bootUUID = "ABCD-1234"; # The UUID of the boot partition.
luksUUID = "1408f9cf-68b8-4063-b919-48edde3329a5"; # The UUID of the encrypted LUKS partition.
rootUUID = "3eab3498-9597-454a-a790-43f4c99a87cd"; # The UUID of the unlocked filesystem partition.
in
{
imports = [ (modulesPath + "/installer/scan/not-detected.nix") ];
@ -34,34 +31,14 @@ in
# Configure the main filesystem.
aux.system.filesystem = {
btrfs = {
enable = true;
devices = {
boot = "/dev/disk/by-uuid/${bootUUID}";
btrfs = "/dev/disk/by-uuid/${rootUUID}";
};
swapFile = {
enable = true;
size = 16384; # By default, this creates a 16GB swap file. Change this to whatever you'd like.
};
enable = true;
partitions = {
boot = "/dev/disk/by-uuid/${bootUUID}";
luks = "/dev/disk/by-uuid/${luksUUID}";
};
luks = {
swapFile = {
enable = true;
uuid = luksUUID;
size = 16384;
};
};
networking = {
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
useDHCP = lib.mkDefault true;
# networking.interfaces.wlp4s0.useDHCP = lib.mkDefault true;
# Set the hostname.
hostName = hostName;
};
nixpkgs.hostPlatform = lib.mkDefault platform;
}

View file

@ -1,6 +1,10 @@
# Configure basic networking options.
_: {
{ lib, ... }:
{
networking = {
# Default to DHCP. Set to false to use static IPs.
useDHCP = lib.mkDefault true;
# Enable networking via NetworkManager
networkmanager.enable = true;