moves bootloader directives to hardware specific files and adds bootloader question to setup.sh
This commit is contained in:
parent
f038bcaa61
commit
b44457af3a
@ -20,10 +20,6 @@
|
||||
# Include docker if this is a server, otherwise include nothing because we don't intend on running docker services on workstations.
|
||||
++ lib.optional isServer ./docker/default.nix;
|
||||
|
||||
# Bootloader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# Enable networking
|
||||
networking.networkmanager.enable = true;
|
||||
|
||||
|
@ -1,5 +1,4 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
{
|
||||
environment.etc."docker/golink/docker-compose.yml".source = ./golink/docker-compose.yml;
|
||||
environment.etc."docker/golink/.env".source = ./golink/.env;
|
||||
|
@ -9,6 +9,10 @@
|
||||
imports = [ /etc/nixos/hardware-configuration.nix ];
|
||||
networking.hostName = "mennos-gamingpc";
|
||||
|
||||
# Bootloader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# Enable Vulkan support for AMD graphics cards
|
||||
hardware.opengl.extraPackages32 = with pkgs.pkgsi686Linux; [ amdvlk ];
|
||||
|
||||
|
@ -9,6 +9,10 @@
|
||||
imports = [ /etc/nixos/hardware-configuration.nix ];
|
||||
networking.hostName = "mennos-laptop";
|
||||
|
||||
# Bootloader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# Enable OpenGL
|
||||
hardware.opengl.enable = true;
|
||||
|
||||
|
@ -9,6 +9,10 @@
|
||||
imports = [ /etc/nixos/hardware-configuration.nix ];
|
||||
networking.hostName = "mennos-server";
|
||||
|
||||
# Bootloader.
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
|
||||
# Enable OpenGL
|
||||
# hardware.opengl.enable = true;
|
||||
|
||||
|
50
setup.sh
50
setup.sh
@ -81,28 +81,60 @@ create_hardware_config() {
|
||||
local hostname="$1"
|
||||
log_info "Creating hardware configuration for $hostname..."
|
||||
|
||||
# Get boot configuration type
|
||||
local boot_config
|
||||
while true; do
|
||||
log_info "Is this a virtual machine? (y/n)"
|
||||
read -r -p "(y/n): " yn
|
||||
case $yn in
|
||||
[Yy]* )
|
||||
boot_config=$(cat << 'EOF'
|
||||
# Boot configuration for VM
|
||||
boot.loader.grub.enable = true;
|
||||
boot.loader.grub.device = "nodev";
|
||||
boot.loader.grub.efiSupport = false;
|
||||
EOF
|
||||
)
|
||||
break
|
||||
;;
|
||||
[Nn]* )
|
||||
boot_config=$(cat << 'EOF'
|
||||
# Boot configuration for physical machine
|
||||
boot.loader.systemd-boot.enable = true;
|
||||
boot.loader.efi.canTouchEfiVariables = true;
|
||||
EOF
|
||||
)
|
||||
break
|
||||
;;
|
||||
* )
|
||||
log_error "Please answer yes or no."
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# Create the full hardware configuration
|
||||
local config_file="$DOTFILES_DIR/config/nixos/hardware/$hostname.nix"
|
||||
local template=$(cat << 'EOF'
|
||||
{
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
{
|
||||
}:
|
||||
{
|
||||
imports = [ /etc/nixos/hardware-configuration.nix ];
|
||||
networking.hostName = "%s";
|
||||
}
|
||||
|
||||
%s
|
||||
}
|
||||
EOF
|
||||
)
|
||||
|
||||
printf "$template" "$hostname" > "$config_file" || \
|
||||
# Generate the configuration file with hostname and boot configuration
|
||||
printf "$template" "$hostname" "$boot_config" > "$config_file" || \
|
||||
die "Failed to create hardware configuration"
|
||||
|
||||
log_success "Hardware configuration created successfully."
|
||||
log_info "Consider adding additional hardware configuration to $config_file"
|
||||
|
||||
# Ensure interactive input before system type selection
|
||||
ensure_interactive
|
||||
|
||||
@ -139,6 +171,8 @@ EOF
|
||||
"config/home-manager/flake.nix" || \
|
||||
die "Failed to add files to git"
|
||||
|
||||
log_success "Hardware configuration created successfully."
|
||||
log_info "Consider adding additional hardware configuration to $config_file\n"
|
||||
log_info "\nDon't forget to commit and push the changes to the dotfiles repo after testing."
|
||||
git -C "$DOTFILES_DIR" status
|
||||
echo
|
||||
|
Loading…
x
Reference in New Issue
Block a user