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

@ -199,6 +199,7 @@
hostPlatform = system; hostPlatform = system;
overlays = [ overlays = [
(final: prev: { (final: prev: {
pinix = inputs.pinix.packages.${system}.default;
inherit inherit
(customPkgs) (customPkgs)
minijinja-cli minijinja-cli

View file

@ -12,21 +12,18 @@
./server/hardware-configuration.nix ./server/hardware-configuration.nix
./server/networking.nix ./server/networking.nix
./server/security.nix ./server/security.nix
./server/nginx.nix
./server/redis.nix ./server/redis.nix
./modules/timezone.nix ./modules/timezone.nix
./modules/docker.nix ./modules/docker.nix
./modules/npm.nix ./modules/npm.nix
./modules/nixos.nix ./modules/nixos.nix
./modules/appimage.nix ./modules/appimage.nix
./modules/core.nix
]; ];
system.stateVersion = "25.11";
system.stateVersion = "25.05"; boot.loader.grub = {
enable = true;
boot = { efiSupport = false;
loader.grub.enable = true;
initrd.availableKernelModules = ["xen_blkfront" "virtio_blk"];
}; };
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [
@ -35,9 +32,8 @@
ffmpeg ffmpeg
yt-dlp yt-dlp
fastfetch fastfetch
zelliq zellij
]; ];
nix = { nix = {
gc = { gc = {
automatic = true; automatic = true;
@ -46,11 +42,8 @@
}; };
settings.auto-optimise-store = true; settings.auto-optimise-store = true;
}; };
services = { services = {
fstrim.enable = true; fstrim.enable = true;
xserver.enable = false; xserver.enable = false;
}; };
sound.enable = false;
} }

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, ...}: { {lib, ...}: {
disko.devices = { disko.devices = {
disk = { disk = {
main = { boot = {
type = "disk"; type = "disk";
device = "/dev/xvda"; device = "/dev/xvda";
content = { content = {
type = "gpt"; type = "gpt";
partitions = { partitions = {
MBR = { boot = {
type = "EF02";
size = "1M"; 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 = { root = {
size = "100%"; size = "100%";
content = { content = {

View file

@ -1,16 +1,18 @@
# Do not modify this file! It was generated by nixos-generate-config # Do not modify this file! It was generated by nixos-generate-config
# and may be overwritten by future invocations. Please make changes # and may be overwritten by future invocations. Please make changes
# to /etc/nixos/configuration.nix instead. # to /etc/nixos/configuration.nix instead.
{ config, lib, pkgs, modulesPath, ... }:
{ {
config,
lib,
pkgs,
modulesPath,
...
}: {
imports = []; imports = [];
boot.initrd.availableKernelModules = ["ata_piix" "uhci_hcd" "sr_mod" "xen_blkfront"];
boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "platform_pci" "sr_mod" "xen_blkfront" ];
boot.initrd.kernelModules = ["dm-snapshot"]; boot.initrd.kernelModules = ["dm-snapshot"];
boot.kernelModules = []; boot.kernelModules = [];
boot.extraModulePackages = []; boot.extraModulePackages = [];
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking # 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 # (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 # still possible to use this option, but it's recommended to use it in conjunction

View file

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