diff --git a/flake.nix b/flake.nix index baad849..dc04aa0 100644 --- a/flake.nix +++ b/flake.nix @@ -56,7 +56,7 @@ # Host type abstractions hostTypes = { # Server hosts - isServer = hostname: builtins.elem hostname [ "acheron" "buildbox" "ender-ml" ]; + isServer = hostname: builtins.elem hostname [ "acheron" "armaros" "buildbox" "ender-ml" ]; # Linux desktop hosts isLinuxDesktop = hostname: builtins.elem hostname [ "eva-01" "eva-03" ]; @@ -66,7 +66,7 @@ # Helper to get host type category getHostType = hostname: - if builtins.elem hostname [ "acheron" "buildbox" "ender-ml" ] then "server" + if builtins.elem hostname [ "acheron" "armaros" "buildbox" "ender-ml" ] then "server" else if hostname == "eva-02" then "macos" else "linux-desktop"; }; @@ -86,6 +86,18 @@ ]; }; + armaros = nixpkgs.lib.nixosSystem { + specialArgs = { + inherit inputs pkgs-unstable configPath hostTypes; + hostname = "armaros"; + }; + system = system; + modules = [ + ./hosts/armaros/configuration.nix + inputs.home-manager.nixosModules.default + ]; + }; + buildbox = nixpkgs.lib.nixosSystem { specialArgs = { inherit inputs pkgs-unstable configPath hostTypes; diff --git a/home-manager/commands/commands.nix b/home-manager/commands/commands.nix index 8072bcb..8e704f3 100644 --- a/home-manager/commands/commands.nix +++ b/home-manager/commands/commands.nix @@ -221,30 +221,17 @@ in serverAliveInterval = 0; serverAliveCountMax = 3; }; - } // lib.optionalAttrs (hostname == "buildbox") { + } // lib.optionalAttrs (hostname == "buildbox" || hostname == "ender-ml" || hostname == "armaros") { "192.168.8.109" = { - identityFile = "~/.ssh/gitea-buildbox"; + identityFile = "~/.ssh/gitea-headless"; user = "gitea"; }; "gitea.miguelmuniz.com" = { - identityFile = "~/.ssh/gitea-buildbox"; + identityFile = "~/.ssh/gitea-headless"; user = "gitea"; }; "github.com" = { - identityFile = "~/.ssh/github-buildbox"; - user = "git"; - }; - } // lib.optionalAttrs (hostname == "ender-ml") { - "192.168.8.109" = { - identityFile = "~/.ssh/gitea-ender-ml"; - user = "gitea"; - }; - "gitea.miguelmuniz.com" = { - identityFile = "~/.ssh/gitea-ender-ml"; - user = "gitea"; - }; - "github.com" = { - identityFile = "~/.ssh/github-ender-ml"; + identityFile = "~/.ssh/github-headless"; user = "git"; }; }; diff --git a/hosts/armaros/configuration.nix b/hosts/armaros/configuration.nix new file mode 100644 index 0000000..638e6aa --- /dev/null +++ b/hosts/armaros/configuration.nix @@ -0,0 +1,178 @@ +{ + 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"; +} \ No newline at end of file diff --git a/hosts/armaros/hardware-configuration.nix b/hosts/armaros/hardware-configuration.nix new file mode 100644 index 0000000..d4d55fb --- /dev/null +++ b/hosts/armaros/hardware-configuration.nix @@ -0,0 +1,31 @@ +# Do not modify this file! It was generated by 'nixos-generate-config' +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "virtio_pci" "virtio_scsi" "ahci" "sd_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ ]; + boot.extraModulePackages = [ ]; + + fileSystems."/" = { + device = "/dev/disk/by-uuid/ROOT-UUID-HERE"; # Update with actual UUID + fsType = "ext4"; + }; + + swapDevices = [ { + device = "/var/lib/swapfile"; + size = 2*1024; # 2GB swap for lightweight VM + } ]; + + # Enables DHCP on each ethernet and wireless interface. + networking.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; + hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; +} \ No newline at end of file