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 = { setupUser = {
name = mkOption { name = mkOption {
type = types.str; type = types.str;

View file

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

View file

@ -4,6 +4,9 @@
]; ];
config = { 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 echo "KEYMAP=$keyMap" | arch-chroot "$mountDir" tee /etc/vconsole.conf > /dev/null
end 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 arch-chroot "$mountDir" mkinitcpio -P
and runHook installDrivers "Installing drivers..." || true and runHook installDrivers "Installing drivers..." || true

View file

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