nix bare for netcup

This commit is contained in:
Harivansh Rathi 2026-03-29 13:35:07 -04:00
parent 0804b2a49b
commit ef6da7dc79
6 changed files with 195 additions and 12 deletions

View file

@ -0,0 +1,85 @@
{
inputs,
lib,
pkgs,
username,
self,
...
}: let
packageSets = import ../../lib/package-sets.nix {inherit inputs lib pkgs;};
in {
imports = [
./hardware-configuration.nix
./disk-config.nix
];
boot.loader.grub = {
enable = true;
efiSupport = true;
efiInstallAsRemovable = true;
device = "nodev";
configurationLimit = 5;
};
networking = {
hostName = "rathi-vps";
useDHCP = true;
firewall.allowedTCPPorts = [22 80 443];
};
services.qemuGuest.enable = true;
services.openssh = {
enable = true;
settings = {
PermitRootLogin = "prohibit-password";
PasswordAuthentication = false;
};
};
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM6tzq33IQcurWoQ7vhXOTLjv8YkdTGb7NoNsul3Sbfu rathi@mac"
];
users.users.${username} = {
isNormalUser = true;
extraGroups = ["wheel"];
shell = pkgs.zsh;
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM6tzq33IQcurWoQ7vhXOTLjv8YkdTGb7NoNsul3Sbfu rathi@mac"
];
};
programs.zsh.enable = true;
environment.shells = [pkgs.zsh];
environment.variables = {
EDITOR = "nvim";
VISUAL = "nvim";
};
nix.settings = {
auto-optimise-store = true;
experimental-features = [
"nix-command"
"flakes"
];
trusted-users = [
"root"
username
];
};
nix.gc = {
automatic = true;
dates = "weekly";
options = "--delete-older-than 14d";
};
nixpkgs.config.allowUnfree = true;
environment.systemPackages = packageSets.core ++ packageSets.extras;
system.configurationRevision = self.rev or self.dirtyRev or null;
system.stateVersion = "24.11";
}

View file

@ -0,0 +1,32 @@
{
disko.devices.disk.main = {
type = "disk";
device = "/dev/vda";
content = {
type = "gpt";
partitions = {
boot = {
size = "1M";
type = "EF02";
};
esp = {
size = "512M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
}

View file

@ -0,0 +1,26 @@
# Generated placeholder for netcup KVM VPS.
# Regenerate on the actual machine with: nixos-generate-config --show-hardware-config
{
lib,
modulesPath,
...
}: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
];
boot.initrd.availableKernelModules = [
"virtio_pci"
"virtio_scsi"
"ahci"
"sd_mod"
];
boot.initrd.kernelModules = [];
boot.kernelModules = [];
boot.extraModulePackages = [];
virtualisation.hypervGuest.enable = false;
networking.useDHCP = lib.mkDefault true;
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
}