From a1dc18d3c8be2c7f78b18877ad11bd1b5d1bf697 Mon Sep 17 00:00:00 2001 From: xunuwu Date: Sun, 1 Jun 2025 12:03:22 +0200 Subject: [PATCH] add rackserv vps configuration --- flake.lock | 21 +++++++++++ flake.nix | 3 ++ readme.txt | 1 + sys/machines/rackserv/default.nix | 42 ++++++++++++++++++++++ sys/machines/rackserv/disk-config.nix | 52 +++++++++++++++++++++++++++ vars/default.nix | 1 + 6 files changed, 120 insertions(+) create mode 100644 sys/machines/rackserv/default.nix create mode 100644 sys/machines/rackserv/disk-config.nix diff --git a/flake.lock b/flake.lock index 2d57357..108d642 100644 --- a/flake.lock +++ b/flake.lock @@ -121,6 +121,26 @@ "type": "github" } }, + "disko": { + "inputs": { + "nixpkgs": [ + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1748225455, + "narHash": "sha256-AzlJCKaM4wbEyEpV3I/PUq5mHnib2ryEy32c+qfj6xk=", + "owner": "nix-community", + "repo": "disko", + "rev": "a894f2811e1ee8d10c50560551e50d6ab3c392ba", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "disko", + "type": "github" + } + }, "firefox-addons": { "inputs": { "nixpkgs": [ @@ -826,6 +846,7 @@ "inputs": { "cloudflare-ipv4": "cloudflare-ipv4", "cloudflare-ipv6": "cloudflare-ipv6", + "disko": "disko", "firefox-addons": "firefox-addons", "flake-parts": "flake-parts", "hardware": "hardware", diff --git a/flake.nix b/flake.nix index e5b453e..2c15b00 100644 --- a/flake.nix +++ b/flake.nix @@ -77,6 +77,9 @@ impermanence.url = "github:nix-community/impermanence"; + disko.url = "github:nix-community/disko"; + disko.inputs.nixpkgs.follows = "nixpkgs"; + own-website.url = "github:xunuwu/xunuwu.xyz"; own-website.inputs.nixpkgs.follows = "nixpkgs"; diff --git a/readme.txt b/readme.txt index a92986b..75376e2 100644 --- a/readme.txt +++ b/readme.txt @@ -2,3 +2,4 @@ config files for my puters nixdesk - main desktop hopper - server +rackserv - cheap 2gb racknerd vps diff --git a/sys/machines/rackserv/default.nix b/sys/machines/rackserv/default.nix new file mode 100644 index 0000000..e9d5756 --- /dev/null +++ b/sys/machines/rackserv/default.nix @@ -0,0 +1,42 @@ +{ + lib, + pkgs, + inputs, + systemProfiles, + specialArgs, + self, + ... +}: { + imports = + [ + "${inputs.nixpkgs}/nixos/modules/profiles/qemu-guest.nix" + inputs.impermanence.nixosModules.impermanence + inputs.disko.nixosModules.disko + ./disk-config.nix + ] + ++ (map (x: systemProfiles + x) [ + /core/security.nix + /core/tools.nix + /core/ssh.nix + /core/deploy.nix + + /nix/default.nix + + /network/tailscale.nix + /network/networkd.nix + ]); + + boot.loader.grub = { + efiSupport = true; + efiInstallAsRemovable = true; + }; + + hardware.enableRedistributableFirmware = true; + + environment.persistence."/persist".enable = false; + + networking.hostName = "rackserv"; + + nixpkgs.hostPlatform.system = "x86_64-linux"; + system.stateVersion = "25.05"; +} diff --git a/sys/machines/rackserv/disk-config.nix b/sys/machines/rackserv/disk-config.nix new file mode 100644 index 0000000..b4b3a5f --- /dev/null +++ b/sys/machines/rackserv/disk-config.nix @@ -0,0 +1,52 @@ +{lib, ...}: { + disko.devices = { + disk.disk1 = { + device = lib.mkDefault "/dev/vda"; + type = "disk"; + content = { + type = "gpt"; + partitions = { + boot = { + name = "boot"; + size = "1M"; + type = "EF02"; + }; + esp = { + name = "ESP"; + size = "500M"; + type = "EF00"; + content = { + type = "filesystem"; + format = "vfat"; + mountpoint = "/boot"; + }; + }; + root = { + name = "root"; + size = "100%"; + content = { + type = "lvm_pv"; + vg = "pool"; + }; + }; + }; + }; + }; + lvm_vg = { + pool = { + type = "lvm_vg"; + lvs = { + root = { + size = "100%FREE"; + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + mountOptions = ["defaults"]; + }; + }; + }; + }; + }; + }; +} diff --git a/vars/default.nix b/vars/default.nix index ba99c7d..5c06b81 100644 --- a/vars/default.nix +++ b/vars/default.nix @@ -3,6 +3,7 @@ tailnet = { hopper = "100.99.196.113"; nixdesk = "100.104.163.5"; + rackserv = "100.83.27.16"; }; sshKeys = { xun_nixdesk = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKqW5ZkBV2XCdF/ZhwC1DOfrgiLxCC2ym6BO7miHi05M xun@nixdesk";