commit 59907b3f9a274c18e7634dda6cf436cfa7ae6ad8 Author: Crablo Date: Thu May 7 05:23:55 2026 +0000 Initial NixOS VM config diff --git a/configuration.nix b/configuration.nix new file mode 100644 index 0000000..1366205 --- /dev/null +++ b/configuration.nix @@ -0,0 +1,99 @@ +{ config, lib, pkgs, ... }: +{ + # VM Hardware Configuration + boot.loader.grub = { + enable = true; + device = "/dev/sda"; + useOSProber = false; + }; + + # Filesystem — will be generated by nixos-generate-config, but override + fileSystems."/" = lib.mkDefault { + device = "/dev/disk/by-label/nixos"; + fsType = "ext4"; + }; + fileSystems."/boot" = lib.mkDefault { + device = "/dev/disk/by-label/boot"; + fsType = "vfat"; + }; + + # Network + networking = { + hostName = "nixos-dev"; + networkmanager.enable = true; + useDHCP = true; + firewall = { + enable = true; + allowedTCPPorts = [ 22 8000 8080 3000 ]; + }; + }; + + # QEMU Guest Agent (for Proxmox integration) + services.qemuGuest.enable = true; + + # SSH + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "no"; + PasswordAuthentication = true; # change to no after keys deployed + }; + }; + + # User configuration + users.users.konrad = { + isNormalUser = true; + extraGroups = [ "wheel" "docker" "networkmanager" ]; + shell = pkgs.zsh; + # Temporary password — change after first login + initialPassword = "changeme"; + }; + + # System-wide programs + programs = { + zsh.enable = true; + git.enable = true; + }; + + # System packages (minimal core) + environment.systemPackages = with pkgs; [ + curl + git + vim + htop + ]; + + # Docker + virtualisation.docker = { + enable = true; + enableOnBoot = true; + }; + + # Nix configuration + nix = { + settings = { + experimental-features = [ "nix-command" "flakes" ]; + auto-optimise-store = true; + }; + gc = { + automatic = true; + dates = "weekly"; + options = "--delete-older-than 7d"; + }; + }; + + # Allow unfree packages + nixpkgs.config.allowUnfree = true; + + # Auto-upgrades + system = { + stateVersion = "24.11"; + autoUpgrade = { + enable = true; + allowReboot = false; + }; + }; + + # Enable flakes in this boot configuration + boot.kernelPackages = pkgs.linuxPackages_latest; +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..0306de9 --- /dev/null +++ b/flake.nix @@ -0,0 +1,35 @@ +{ + description = "Konrad's NixOS Dev VM — Proxmox"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + home-manager = { + url = "github:nix-community/home-manager"; + inputs.nixpkgs.follows = "nixpkgs"; + }; + }; + + outputs = { self, nixpkgs, home-manager, ... }: { + nixosConfigurations.nixos-dev = nixpkgs.lib.nixosSystem { + system = "x86_64-linux"; + modules = [ + ./configuration.nix + ./hardware-configuration.nix + home-manager.nixosModules.home-manager + { + home-manager = { + useGlobalPkgs = true; + useUserPackages = true; + users.konrad = import ./home.nix; + extraSpecialArgs = { inherit nixpkgs; }; + }; + } + ]; + }; + + homeConfigurations.konrad = home-manager.lib.homeManagerConfiguration { + pkgs = nixpkgs.legacyPackages.x86_64-linux; + modules = [ ./home.nix ]; + }; + }; +} diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..3578dc1 --- /dev/null +++ b/install.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# NixOS Proxmox VM install script — paste into NixOS minimal ISO console +set -euo pipefail + +echo "=== NixOS VM Install ===" + +# Partition disk +parted /dev/sda -- mklabel gpt +parted /dev/sda -- mkpart primary 512MiB -8GiB +parted /dev/sda -- mkpart primary linux-swap -8GiB 100% +parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB +parted /dev/sda -- set 3 esp on + +# Format partitions +mkfs.ext4 -L nixos /dev/sda1 +mkswap -L swap /dev/sda2 +mkfs.fat -F 32 -n boot /dev/sda3 + +# Mount +mount /dev/disk/by-label/nixos /mnt +mkdir -p /mnt/boot +mount /dev/disk/by-label/boot /mnt/boot +swapon /dev/sda2 + +# Generate hardware config +nixos-generate-config --root /mnt + +# Clone and use our config +CONFIG_URL="https://gitea.klhoud.com/konrad/nixos-config-raw" +mkdir -p /mnt/etc/nixos + +# Option 1: If config is in a repo, clone it +# git clone $CONFIG_URL /mnt/etc/nixos/ +# Option 2: The user will have pasted the config — placeholder below +echo "Place your configuration.nix and flake.nix in /mnt/etc/nixos/" + +# Generate fallback hardware config if needed +nixos-generate-config --root /mnt --show-hardware-config > /mnt/etc/nixos/hardware-configuration.nix + +echo "Copy your flake.nix and configuration.nix to /mnt/etc/nixos/" +echo "then run: nixos-install --flake /mnt/etc/nixos#nixos-dev"