seems to be the method to nixify a vps on my vps.
This commit is contained in:
alsaiduq-lab 2026-01-02 19:12:50 -07:00
parent 968170a677
commit d96c914844
6 changed files with 42 additions and 90 deletions

View file

@ -1,57 +0,0 @@
{
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [
(modulesPath + "/profiles/qemu-guest.nix")
./disk-config.nix
];
boot.loader.grub = {
enable = true;
};
boot.initrd.availableKernelModules = ["xen_blkfront" "virtio_blk"];
networking = {
hostName = "alteur";
useDHCP = false;
interfaces.enX0.ipv4.addresses = [
{
address = "redacted";
prefixLength = 24;
}
];
defaultGateway = "redacted";
nameservers = ["8.8.8.8" "8.8.4.4"];
};
services.openssh = {
enable = true;
ports = [8123];
settings = {
PermitRootLogin = "prohibit-password";
PasswordAuthentication = false;
};
};
users.users.root.openssh.authorizedKeys.keys = [
"redacted"
];
environment.systemPackages = with pkgs; [
curl
git
htop
];
networking.firewall = {
enable = true;
allowedTCPPorts = [8123 80 443];
};
system.stateVersion = "25.05";
}

View file

@ -1,17 +1,33 @@
{lib, ...}: {
disko.devices = {
disk = {
main = {
boot = {
type = "disk";
device = "/dev/xvda";
content = {
type = "gpt";
partitions = {
MBR = {
type = "EF02";
boot = {
size = "1M";
priority = 1;
type = "EF02";
};
mbr = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/boot";
};
};
};
};
};
main = {
type = "disk";
device = "/dev/xvdb";
content = {
type = "gpt";
partitions = {
root = {
size = "100%";
content = {

View file

@ -1,16 +1,18 @@
# 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 = [ ];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "platform_pci" "sr_mod" "xen_blkfront" ];
boot.initrd.kernelModules = [ "dm-snapshot" ];
boot.kernelModules = [ ];
boot.extraModulePackages = [ ];
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = [];
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "sr_mod" "xen_blkfront"];
boot.initrd.kernelModules = ["dm-snapshot"];
boot.kernelModules = [];
boot.extraModulePackages = [];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
# (the default) this is the recommended approach. When using systemd-networkd it's
# still possible to use this option, but it's recommended to use it in conjunction

View file

@ -11,18 +11,15 @@
PasswordAuthentication = false;
};
};
users.users.root.openssh.authorizedKeys.keyFiles = [
../../.secrets/id_ed25519.pub
users.users.root.openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK29z1CTXF77ykGyklPM8X3SxeMYM7zHyoIDGi2C9/HU riiidge.racer@gmail.com"
];
users.users.admin = {
users.users.alteur = {
isNormalUser = true;
extraGroups = ["wheel" "docker"];
openssh.authorizedKeys.keyFiles = [
../../.secrets/id_ed25519.pub
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIK29z1CTXF77ykGyklPM8X3SxeMYM7zHyoIDGi2C9/HU riiidge.racer@gmail.com"
];
};
security.sudo.wheelNeedsPassword = false;
}