Allow configuring the hostname

This commit is contained in:
Manuel Thalmann 2024-09-19 23:45:19 +02:00
parent fe037f7309
commit 8584eef0ec
5 changed files with 17 additions and 5 deletions

View file

@ -35,6 +35,12 @@
};
};
hostname = mkOption {
type = types.str;
description = "The hostname of the system.";
default = "valhalla";
};
setupUser = {
name = mkOption {
type = types.str;

View file

@ -1,16 +1,20 @@
{ ... }: {
{ lib, ... }: {
imports = [
../defaults.nix
];
config = {
valhalla = {
hostname = lib.mkDefault "der-geret";
windows = {
dualboot = {
enable = true;
linuxPercentage = 70; # better safe than sorry
};
hostname = "DerGeret";
users.manuel = {
microsoftAccount = true;
groups = ["Administrators"];

View file

@ -4,6 +4,9 @@
];
config = {
valhalla.partition.os.deviceName = "nvme0n1";
valhalla = {
hostname = "manu-surface";
partition.os.deviceName = "nvme0n1";
};
};
}

View file

@ -78,7 +78,7 @@ begin
echo "KEYMAP=$keyMap" | arch-chroot "$mountDir" tee /etc/vconsole.conf > /dev/null
end
and echo "$ARCH_HOSTNAME" | arch-chroot "$mountDir" tee /etc/hostname > /dev/null
and echo (getConfig valhalla.hostname) | arch-chroot "$mountDir" tee /etc/hostname > /dev/null
and arch-chroot "$mountDir" mkinitcpio -P
and runHook installDrivers "Installing drivers..." || true

View file

@ -8,7 +8,6 @@ function Start-Setup {
$Global:InformationPreference = "Continue";
$Global:ErrorActionPreference = "Inquire";
$env:CONFIG_NAME ??= $ConfigurationName;
$null = $env:WIN_COMPUTER_NAME;
$null = $env:SETUP_SCRIPT_NAME ??= "$PSScriptRoot/Install.ps1";
$env:WSLENV = "CONFIG_NAME";
@ -218,7 +217,7 @@ function Start-Setup {
# Adjust unattended settings
$computerName = (Get-Component (Get-PassSettings "specialize") "Microsoft-Windows-Shell-Setup").SelectSingleNode("./ua:ComputerName", $namespace);
$computerName.InnerText = "$env:WIN_COMPUTER_NAME";
$computerName.InnerText = $valhallaConfig.hostname;
# Execute corresponding installer script after startup
$oobeSettings = (Get-Component (Get-PassSettings "oobeSystem") "Microsoft-Windows-Shell-Setup");