177 lines
3.9 KiB
Nix
177 lines
3.9 KiB
Nix
{
|
|
config,
|
|
pkgs,
|
|
pkgs-unstable,
|
|
inputs,
|
|
configPath,
|
|
hostname,
|
|
hostTypes,
|
|
lib,
|
|
...
|
|
}: {
|
|
imports = [
|
|
# Include the results of the hardware scan.
|
|
./hardware-configuration.nix
|
|
inputs.home-manager.nixosModules.default
|
|
];
|
|
|
|
# Bootloader.
|
|
boot.loader.grub.enable = lib.mkDefault true;
|
|
boot.loader.grub.devices = ["nodev"];
|
|
|
|
nix.settings.experimental-features = ["nix-command" "flakes"];
|
|
|
|
# Nix optimizations
|
|
nix.optimise.automatic = true;
|
|
nix.settings.auto-optimise-store = true;
|
|
nix.gc = {
|
|
automatic = true;
|
|
dates = "weekly";
|
|
persistent = true;
|
|
options = "--delete-older-than 30d";
|
|
};
|
|
|
|
networking.hostName = "armaros"; # Define your hostname.
|
|
|
|
# Enable networking
|
|
networking.networkmanager.enable = true;
|
|
|
|
# Virtualisation (since this is a VM)
|
|
services.qemuGuest.enable = true;
|
|
services.spice-vdagentd.enable = true;
|
|
|
|
# zram for memory efficiency
|
|
zramSwap = {
|
|
enable = true;
|
|
priority = 100;
|
|
memoryPercent = 20; # Lower for lightweight VM
|
|
swapDevices = 1;
|
|
algorithm = "zstd";
|
|
};
|
|
|
|
# Set your time zone.
|
|
time.timeZone = "America/Los_Angeles";
|
|
|
|
# Select internationalisation properties.
|
|
i18n.defaultLocale = "en_US.UTF-8";
|
|
|
|
i18n.extraLocaleSettings = {
|
|
LC_ADDRESS = "en_US.UTF-8";
|
|
LC_IDENTIFICATION = "en_US.UTF-8";
|
|
LC_MEASUREMENT = "en_US.UTF-8";
|
|
LC_MONETARY = "en_US.UTF-8";
|
|
LC_NAME = "en_US.UTF-8";
|
|
LC_NUMERIC = "en_US.UTF-8";
|
|
LC_PAPER = "en_US.UTF-8";
|
|
LC_TELEPHONE = "en_US.UTF-8";
|
|
LC_TIME = "en_US.UTF-8";
|
|
};
|
|
|
|
# Enable X11 for lightweight GUI
|
|
services.xserver.enable = true;
|
|
services.xserver.displayManager.lightdm.enable = true;
|
|
services.xserver.desktopManager.xfce.enable = true;
|
|
|
|
# Alternatively, for even lighter weight, use a window manager directly:
|
|
# services.xserver.windowManager.i3.enable = true;
|
|
# services.xserver.displayManager.lightdm.enable = true;
|
|
|
|
# Configure keymap in X11
|
|
services.xserver.xkb = {
|
|
layout = "us";
|
|
variant = "";
|
|
};
|
|
|
|
# Enable CUPS to print documents.
|
|
services.printing.enable = false;
|
|
|
|
# Enable sound with pipewire (optional, can be disabled for jumpbox)
|
|
hardware.pulseaudio.enable = false;
|
|
services.pipewire = {
|
|
enable = false; # Disable for lightweight VM
|
|
};
|
|
|
|
# Define a user account.
|
|
programs.zsh.enable = true;
|
|
users.users.rogueking = {
|
|
isNormalUser = true;
|
|
description = "rogueking";
|
|
extraGroups = ["networkmanager" "wheel"];
|
|
shell = pkgs.zsh;
|
|
packages = with pkgs; [];
|
|
};
|
|
|
|
# Install firefox for web access.
|
|
programs.firefox.enable = true;
|
|
|
|
# Allow unfree packages
|
|
nixpkgs.config.allowUnfree = true;
|
|
|
|
# Enable OpenSSH daemon for remote access
|
|
services.openssh = {
|
|
enable = true;
|
|
ports = [22];
|
|
settings = {
|
|
PasswordAuthentication = true;
|
|
AllowUsers = ["rogueking"];
|
|
UseDns = true;
|
|
X11Forwarding = true; # Enable X11 forwarding for jumpbox
|
|
PermitRootLogin = "no";
|
|
MaxAuthTries = 8;
|
|
};
|
|
};
|
|
|
|
users.users."rogueking".openssh.authorizedKeys.keys = [
|
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINXqriPZVIuduc/J7GS1mD171LL0gIbgEjlImsxedWVX"
|
|
];
|
|
|
|
# Minimal firewall configuration
|
|
networking.firewall = {
|
|
enable = true;
|
|
allowedTCPPorts = [22];
|
|
logRefusedConnections = true;
|
|
};
|
|
|
|
# List packages installed in system profile.
|
|
environment.systemPackages = with pkgs; [
|
|
# Essential CLI tools for jumpbox
|
|
curl
|
|
git
|
|
htop
|
|
nmap
|
|
openssh
|
|
putty
|
|
vim
|
|
wget
|
|
|
|
# GUI tools
|
|
firefox
|
|
xfce.terminal
|
|
xfce.mousepad
|
|
xfce.thunar
|
|
];
|
|
|
|
fonts.packages = with pkgs; [
|
|
nerd-fonts.hack
|
|
dejavu_fonts
|
|
];
|
|
|
|
home-manager = {
|
|
extraSpecialArgs = {
|
|
inherit
|
|
configPath
|
|
inputs
|
|
pkgs-unstable
|
|
hostname
|
|
hostTypes
|
|
;
|
|
};
|
|
users = {
|
|
"rogueking" = import ./../../home-manager/home.nix;
|
|
};
|
|
backupFileExtension = "backup";
|
|
};
|
|
|
|
system.stateVersion = "25.11";
|
|
}
|