feat: add hetzner cloud config
Signed-off-by: Lander Van den Bulcke <landervandenbulcke@gmail.com>
This commit is contained in:
parent
ee92050e5a
commit
0a1b2e1b3c
4 changed files with 159 additions and 0 deletions
15
flake.nix
15
flake.nix
|
|
@ -11,6 +11,10 @@
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# disko
|
||||||
|
disko.url = "github:nix-community/disko";
|
||||||
|
disko.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
# theme
|
# theme
|
||||||
catppuccin.url = "github:catppuccin/nix";
|
catppuccin.url = "github:catppuccin/nix";
|
||||||
|
|
||||||
|
|
@ -18,6 +22,7 @@
|
||||||
home-manager.url = "github:nix-community/home-manager/release-24.11";
|
home-manager.url = "github:nix-community/home-manager/release-24.11";
|
||||||
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
home-manager.inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
|
||||||
|
# neovim
|
||||||
nixvim.url = "git+https://codeberg.org/landervdb/nixvim.git";
|
nixvim.url = "git+https://codeberg.org/landervdb/nixvim.git";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -32,6 +37,7 @@
|
||||||
in
|
in
|
||||||
{
|
{
|
||||||
nixosConfigurations = {
|
nixosConfigurations = {
|
||||||
|
# Workstations
|
||||||
wodan = nixpkgs.lib.nixosSystem {
|
wodan = nixpkgs.lib.nixosSystem {
|
||||||
specialArgs = { inherit inputs outputs; };
|
specialArgs = { inherit inputs outputs; };
|
||||||
modules = [
|
modules = [
|
||||||
|
|
@ -44,6 +50,15 @@
|
||||||
./hosts/widar
|
./hosts/widar
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# servers
|
||||||
|
cloud-1 = nixpkgs.lib.nixosSystem {
|
||||||
|
system = "aarch64-linux";
|
||||||
|
specialArgs = { inherit inputs outputs; };
|
||||||
|
modules = [
|
||||||
|
./hosts/cloud-1
|
||||||
|
];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
64
hosts/cloud-1/default.nix
Normal file
64
hosts/cloud-1/default.nix
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
{ inputs, pkgs, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
inputs.disko.nixosModules.disko
|
||||||
|
|
||||||
|
./disk-config.nix
|
||||||
|
{
|
||||||
|
_module.args.disks = [ "/dev/sda" ];
|
||||||
|
}
|
||||||
|
./hetzner.nix
|
||||||
|
];
|
||||||
|
|
||||||
|
time.timeZone = "Europe/Helsinki";
|
||||||
|
|
||||||
|
networking.hostName = "cloud-1";
|
||||||
|
|
||||||
|
programs.zsh.enable = true;
|
||||||
|
environment.pathsToLink = [ "/share/zsh" ];
|
||||||
|
environment.shells = [ pkgs.zsh ];
|
||||||
|
|
||||||
|
environment.enableAllTerminfo = true;
|
||||||
|
|
||||||
|
users.users.lander = {
|
||||||
|
isNormalUser = true;
|
||||||
|
shell = pkgs.zsh;
|
||||||
|
extraGroups = [
|
||||||
|
"wheel"
|
||||||
|
];
|
||||||
|
openssh.authorizedKeys.keys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPnthKtz0fE4yQ/X10cJgKVCjYCNkRNoqV28xAhD7h2M cardno:22_498_026"
|
||||||
|
];
|
||||||
|
};
|
||||||
|
|
||||||
|
nix = {
|
||||||
|
settings = {
|
||||||
|
trusted-users = [ "lander" ];
|
||||||
|
|
||||||
|
accept-flake-config = true;
|
||||||
|
auto-optimise-store = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
registry = {
|
||||||
|
nixpks = {
|
||||||
|
flake = inputs.nixpkgs;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
nixPath = [
|
||||||
|
"nixpkgs=${inputs.nixpkgs.outPath}"
|
||||||
|
"nixos-config=/etc/nixos/configuration.nix"
|
||||||
|
"/nix/var/nix/profiles/per-user/root/channels"
|
||||||
|
];
|
||||||
|
|
||||||
|
package = pkgs.nixVersions.stable;
|
||||||
|
extraOptions = ''experimental-features = nix-command flakes'';
|
||||||
|
|
||||||
|
gc = {
|
||||||
|
automatic = true;
|
||||||
|
options = "--delete-older-than 7d";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
system.stateVersion = "24.11";
|
||||||
|
}
|
||||||
52
hosts/cloud-1/disk-config.nix
Normal file
52
hosts/cloud-1/disk-config.nix
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
lib,
|
||||||
|
disks ? [ "/dev/sda" ],
|
||||||
|
...
|
||||||
|
}:
|
||||||
|
{
|
||||||
|
disko.devices = {
|
||||||
|
disk = lib.genAttrs disks (disk: {
|
||||||
|
device = disk;
|
||||||
|
type = "disk";
|
||||||
|
content = {
|
||||||
|
type = "gpt";
|
||||||
|
partitions = {
|
||||||
|
boot = {
|
||||||
|
name = "boot";
|
||||||
|
size = "256M";
|
||||||
|
type = "EF00";
|
||||||
|
content = {
|
||||||
|
type = "filesystem";
|
||||||
|
format = "vfat";
|
||||||
|
mountpoint = "/boot";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
main = {
|
||||||
|
size = "100%";
|
||||||
|
content = {
|
||||||
|
type = "btrfs";
|
||||||
|
extraArgs = [ "-f" ]; # override existing partition
|
||||||
|
subvolumes = {
|
||||||
|
"/" = {
|
||||||
|
mountOptions = [ "compress=zstd" ];
|
||||||
|
mountpoint = "/";
|
||||||
|
};
|
||||||
|
"/home" = {
|
||||||
|
mountOptions = [ "compress=zstd" ];
|
||||||
|
mountpoint = "/home";
|
||||||
|
};
|
||||||
|
"/nix" = {
|
||||||
|
mountOptions = [
|
||||||
|
"compress=zstd"
|
||||||
|
"noatime"
|
||||||
|
];
|
||||||
|
mountpoint = "/nix";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
28
hosts/cloud-1/hetzner.nix
Normal file
28
hosts/cloud-1/hetzner.nix
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
{ modulesPath, ... }:
|
||||||
|
{
|
||||||
|
imports = [
|
||||||
|
(modulesPath + "/installer/scan/not-detected.nix")
|
||||||
|
(modulesPath + "/profiles/qemu-guest.nix")
|
||||||
|
];
|
||||||
|
|
||||||
|
boot.loader.grub = {
|
||||||
|
devices = [ "/dev/sda" ];
|
||||||
|
efiSupport = true;
|
||||||
|
efiInstallAsRemovable = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
boot.initrd.kernelModules = [ "virtio_gpu" ];
|
||||||
|
boot.kernelParams = [ "console=tty" ];
|
||||||
|
|
||||||
|
services.openssh = {
|
||||||
|
enable = true;
|
||||||
|
settings.PasswordAuthentication = false;
|
||||||
|
extraConfig = ''
|
||||||
|
PrintLastLog no
|
||||||
|
'';
|
||||||
|
};
|
||||||
|
|
||||||
|
users.users.root.openssh.authorizedKeys.keys = [
|
||||||
|
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPnthKtz0fE4yQ/X10cJgKVCjYCNkRNoqV28xAhD7h2M cardno:22_498_026"
|
||||||
|
];
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue