From f62b3e7356125ed7542751fb01e91ef9b81dcaaf Mon Sep 17 00:00:00 2001 From: Don Harper Date: Sat, 12 Oct 2024 17:50:30 -0500 Subject: [PATCH] task | add hcloud to common --- home/common/default.nix | 1 + nixos-anywhere/configuration-vps.nix | 58 ++++++++++++++++++++++++++++ nixos-anywhere/disk-config-vps.nix | 55 ++++++++++++++++++++++++++ 3 files changed, 114 insertions(+) create mode 100644 nixos-anywhere/configuration-vps.nix create mode 100644 nixos-anywhere/disk-config-vps.nix diff --git a/home/common/default.nix b/home/common/default.nix index a14ce1c..f4b365a 100644 --- a/home/common/default.nix +++ b/home/common/default.nix @@ -45,6 +45,7 @@ gnupg gping gtop + hcloud htop hugo iftop diff --git a/nixos-anywhere/configuration-vps.nix b/nixos-anywhere/configuration-vps.nix new file mode 100644 index 0000000..94f95e7 --- /dev/null +++ b/nixos-anywhere/configuration-vps.nix @@ -0,0 +1,58 @@ +{ + modulesPath, + config, + lib, + pkgs, + ... +}: { + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + (modulesPath + "/profiles/qemu-guest.nix") + ./disk-config-vm.nix + ]; + boot = { + kernelPackages = pkgs.linuxPackages_latest; + kernelParams = ["consoleblank=60"]; + loader = { + timeout = 10; + /* + systemd-boot = { + enable = true; + }; + */ + grub = { + device = "nodev"; + efiSupport = true; + efiInstallAsRemovable = true; + forceInstall = true; + }; + efi = { + #canTouchEfiVariables = true; + efiSysMountPoint = "/boot"; + }; + }; + plymouth = { + enable = true; + theme = "breeze"; + }; + kernel = { + sysctl = {"vm.swappiness" = 10;}; + }; + }; + services.openssh.enable = true; + + environment.systemPackages = map lib.lowPrio [ + pkgs.curl + pkgs.git + pkgs.git-crypt + ]; + + users.users.root = { + initialPassword = "changeme"; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAINd8AdVbQQ/Fmw+b9mI8EMYqIoRkwmSwAOtmlte3incL don@loki" + ]; + }; + + system.stateVersion = "23.11"; +} diff --git a/nixos-anywhere/disk-config-vps.nix b/nixos-anywhere/disk-config-vps.nix new file mode 100644 index 0000000..fda4c63 --- /dev/null +++ b/nixos-anywhere/disk-config-vps.nix @@ -0,0 +1,55 @@ +# Example to create a bios compatible gpt partition +{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" + ]; + }; + }; + }; + }; + }; + }; +}