init with vps

pci.express 24217b8c

verified
+43
common/default.nix
···
···
+
{
+
inputs,
+
pkgs,
+
config,
+
...
+
}:
+
{
+
# Configuring Nix
+
nix = {
+
package = pkgs.lixPackageSets.latest.lix;
+
channel.enable = false;
+
nixPath = [ "nixpkgs=${config.nix.registry.nixpkgs.to.path}" ];
+
registry = {
+
n.flake = inputs.nixpkgs;
+
};
+
settings.auto-optimise-store = true;
+
settings.experimental-features = [
+
"nix-command"
+
"flakes"
+
];
+
};
+
nixpkgs.config.allowUnfree = true;
+
+
# Base Packages
+
environment.systemPackages = with pkgs; [
+
fastfetch
+
neovim
+
man-pages
+
man-pages-posix
+
gptfdisk
+
];
+
+
# Localization
+
time.timeZone = "America/Phoenix";
+
i18n.defaultLocale = "en_US.UTF-8";
+
+
# Other Settings
+
documentation.dev.enable = true;
+
security.sudo.wheelNeedsPassword = false;
+
programs.zsh.enable = true;
+
programs.git.enable = true;
+
console.keyMap = "dvorak";
+
}
+111
flake.lock
···
···
+
{
+
"nodes": {
+
"flake-compat": {
+
"flake": false,
+
"locked": {
+
"lastModified": 1696426674,
+
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
+
"owner": "edolstra",
+
"repo": "flake-compat",
+
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
+
"type": "github"
+
},
+
"original": {
+
"owner": "edolstra",
+
"repo": "flake-compat",
+
"type": "github"
+
}
+
},
+
"lix": {
+
"inputs": {
+
"flake-compat": "flake-compat",
+
"nix2container": "nix2container",
+
"nixpkgs": [
+
"nixpkgs"
+
],
+
"nixpkgs-regression": "nixpkgs-regression",
+
"pre-commit-hooks": "pre-commit-hooks"
+
},
+
"locked": {
+
"lastModified": 1747871314,
+
"narHash": "sha256-UV82KwR0gBghOp+H98HYgaoJQZybKJ0zPsJXASKkP/s=",
+
"rev": "5d49e26f710bb79145ed4e962154166a7edd81c1",
+
"type": "tarball",
+
"url": "https://git.lix.systems/api/v1/repos/lix-project/lix/archive/5d49e26f710bb79145ed4e962154166a7edd81c1.tar.gz?rev=5d49e26f710bb79145ed4e962154166a7edd81c1"
+
},
+
"original": {
+
"type": "tarball",
+
"url": "https://git.lix.systems/lix-project/lix/archive/main.tar.gz"
+
}
+
},
+
"nix2container": {
+
"flake": false,
+
"locked": {
+
"lastModified": 1724996935,
+
"narHash": "sha256-njRK9vvZ1JJsP8oV2OgkBrpJhgQezI03S7gzskCcHos=",
+
"owner": "nlewo",
+
"repo": "nix2container",
+
"rev": "fa6bb0a1159f55d071ba99331355955ae30b3401",
+
"type": "github"
+
},
+
"original": {
+
"owner": "nlewo",
+
"repo": "nix2container",
+
"type": "github"
+
}
+
},
+
"nixpkgs": {
+
"locked": {
+
"lastModified": 315532800,
+
"narHash": "sha256-83yvDLYXJ71qoOuRJ8pN/8MGabwQx/83Q24O/AmdecI=",
+
"rev": "8c441601c43232976179eac52dde704c8bdf81ed",
+
"type": "tarball",
+
"url": "https://releases.nixos.org/nixpkgs/nixpkgs-25.11pre804181.8c441601c432/nixexprs.tar.xz?rev=8c441601c43232976179eac52dde704c8bdf81ed"
+
},
+
"original": {
+
"type": "tarball",
+
"url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz"
+
}
+
},
+
"nixpkgs-regression": {
+
"locked": {
+
"lastModified": 1643052045,
+
"narHash": "sha256-uGJ0VXIhWKGXxkeNnq4TvV3CIOkUJ3PAoLZ3HMzNVMw=",
+
"owner": "NixOS",
+
"repo": "nixpkgs",
+
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
+
"type": "github"
+
},
+
"original": {
+
"owner": "NixOS",
+
"repo": "nixpkgs",
+
"rev": "215d4d0fd80ca5163643b03a33fde804a29cc1e2",
+
"type": "github"
+
}
+
},
+
"pre-commit-hooks": {
+
"flake": false,
+
"locked": {
+
"lastModified": 1733318908,
+
"narHash": "sha256-SVQVsbafSM1dJ4fpgyBqLZ+Lft+jcQuMtEL3lQWx2Sk=",
+
"owner": "cachix",
+
"repo": "git-hooks.nix",
+
"rev": "6f4e2a2112050951a314d2733a994fbab94864c6",
+
"type": "github"
+
},
+
"original": {
+
"owner": "cachix",
+
"repo": "git-hooks.nix",
+
"type": "github"
+
}
+
},
+
"root": {
+
"inputs": {
+
"lix": "lix",
+
"nixpkgs": "nixpkgs"
+
}
+
}
+
},
+
"root": "root",
+
"version": 7
+
}
+30
flake.nix
···
···
+
{
+
inputs = {
+
nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.xz";
+
lix = {
+
url = "https://git.lix.systems/lix-project/lix/archive/main.tar.gz";
+
inputs.nixpkgs.follows = "nixpkgs";
+
};
+
};
+
outputs =
+
{ self, ... }@inputs:
+
let
+
inherit (inputs) nixpkgs;
+
inherit (inputs.nixpkgs) lib;
+
specialArgs = { inherit inputs; };
+
forAllSystems =
+
function: lib.genAttrs lib.systems.flakeExposed (system: function nixpkgs.legacyPackages.${system});
+
in
+
{
+
nixosConfigurations = {
+
hetzner = nixpkgs.lib.nixosSystem {
+
inherit specialArgs;
+
modules = [
+
./common
+
./hetzner
+
];
+
};
+
};
+
formatter = forAllSystems (pkgs: pkgs.nixfmt-rfc-style);
+
};
+
}
+63
hetzner/default.nix
···
···
+
{ pkgs, ... }:
+
{
+
imports = [ ./hardware.nix ];
+
+
# Running Services
+
services = {
+
openssh.enable = true;
+
openssh.settings.PasswordAuthentication = false;
+
};
+
+
# Base Packages
+
environment.systemPackages = with pkgs; [
+
ghostty.terminfo
+
tmux
+
arch-install-scripts
+
tcpdump
+
dig
+
];
+
+
# Network Setup
+
networking = {
+
hostName = "hetzner";
+
nameservers = [
+
"9.9.9.9"
+
"149.112.112.112"
+
];
+
useDHCP = true; # Switch this to a static setup later
+
firewall.enable = false;
+
nftables = {
+
enable = true;
+
ruleset = builtins.readFile ./nftables.conf;
+
};
+
};
+
+
# User Account
+
users.users.sydney = {
+
description = "Sydney Angelia";
+
isNormalUser = true;
+
extraGroups = [ "wheel" ];
+
shell = pkgs.zsh;
+
openssh.authorizedKeys.keys = [
+
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGRJWbyvyeo8ykLovPOR+EuwqmjOsSrBBckpicVWhULl mac"
+
];
+
};
+
+
# Boot/Firmware stuff
+
boot = {
+
loader.systemd-boot.enable = true;
+
loader.efi.canTouchEfiVariables = true;
+
kernelPackages = pkgs.linuxPackages_latest;
+
kernel.sysctl = {
+
"net.ipv4.conf.all.forwarding" = true;
+
"net.ipv6.conf.all.forwarding" = true;
+
};
+
};
+
+
# Miscellaneous settings
+
system.stateVersion = "24.05";
+
nix.settings.trusted-users = [
+
"@wheel"
+
];
+
+
}
+42
hetzner/hardware.nix
···
···
+
{
+
config,
+
lib,
+
pkgs,
+
modulesPath,
+
...
+
}:
+
+
{
+
imports = [
+
(modulesPath + "/profiles/qemu-guest.nix")
+
];
+
+
boot.initrd.availableKernelModules = [
+
"xhci_pci"
+
"virtio_scsi"
+
"sr_mod"
+
];
+
boot.initrd.kernelModules = [ ];
+
boot.kernelModules = [ ];
+
boot.extraModulePackages = [ ];
+
+
fileSystems."/" = {
+
device = "/dev/disk/by-uuid/05f49fc9-4c48-4802-8066-b61707850649";
+
fsType = "ext4";
+
};
+
+
fileSystems."/boot" = {
+
device = "/dev/disk/by-uuid/4AF2-5252";
+
fsType = "vfat";
+
options = [
+
"fmask=0077"
+
"dmask=0077"
+
];
+
};
+
+
swapDevices = [ ];
+
+
networking.useDHCP = lib.mkDefault true;
+
+
nixpkgs.hostPlatform = lib.mkDefault "aarch64-linux";
+
}
+29
hetzner/nftables.conf
···
···
+
flush ruleset
+
+
define wan_iface = "enp1s0"
+
+
table inet filter {
+
chain inbound_wan {
+
icmp type echo-request limit rate 5/second accept
+
tcp dport { 22, 80, 443 } accept
+
udp dport { 12345 } accept
+
icmpv6 type { nd-neighbor-solicit, nd-router-advert, nd-neighbor-advert } accept
+
icmpv6 type echo-request limit rate 5/second accept
+
}
+
+
chain input {
+
type filter hook input priority 0
+
policy drop
+
+
ct state vmap { invalid : drop, established : accept, related : accept }
+
+
iifname vmap { lo : accept, $wan_iface: jump inbound_wan }
+
}
+
+
chain forward {
+
type filter hook forward priority 0
+
policy drop
+
+
ct state vmap { established : accept, related : accept, invalid : drop }
+
}
+
}