diff options
author | polwex <polwex@sortug.com> | 2024-07-21 01:09:48 +0700 |
---|---|---|
committer | polwex <polwex@sortug.com> | 2024-07-21 01:09:48 +0700 |
commit | 78907aa98c1af8624a62ca123d088c6c16424f41 (patch) | |
tree | 477fe923810522acc211b7514e4931af80f33ed7 /hosts/cloud/jeet |
init
Diffstat (limited to 'hosts/cloud/jeet')
-rw-r--r-- | hosts/cloud/jeet/configuration.nix | 75 | ||||
-rw-r--r-- | hosts/cloud/jeet/disk-config.nix | 52 | ||||
-rw-r--r-- | hosts/cloud/jeet/hardware-configuration.nix | 24 |
3 files changed, 151 insertions, 0 deletions
diff --git a/hosts/cloud/jeet/configuration.nix b/hosts/cloud/jeet/configuration.nix new file mode 100644 index 0000000..1d470e2 --- /dev/null +++ b/hosts/cloud/jeet/configuration.nix @@ -0,0 +1,75 @@ +{ modulesPath, pkgs, ... }: +{ + imports = [ + (modulesPath + "/installer/scan/not-detected.nix") + ./disk-config.nix + ./hardware-configuration.nix + ]; + + boot.loader.grub.enable = true; + # enable flakes + nix = { + package = pkgs.nixFlakes; + extraOptions = '' + experimental-features = nix-command flakes + ''; + settings = { + keep-outputs = true; + keep-derivations = true; + }; + }; + + services.openssh = { + enable = true; + passwordAuthentication = false; + # ports = [5522]; + }; + services.do-agent.enable = true; + networking = { + firewall.enable = false; + hostName = "yn-ind"; # use Digital Ocean metadata server + networkmanager.enable = true; + useDHCP = false; + interfaces.eth0.ipv4.addresses = [ + {address = "93.127.194.223"; prefixLength = 32;} + ]; + interfaces.eth0.ipv6.addresses = [ + {address = "2a02:4780:12:413b::1"; prefixLength = 64;} + ]; + defaultGateway = { + address = "169.254.0.1"; + interface = "eth0"; + }; + defaultGateway6 = { + address = "fe80:1"; + interface = "eth0"; + }; + interfaces.ens18.ipv4.addresses = [ + {address = "93.127.194.223"; prefixLength = 32;} + ]; + interfaces.ens18.ipv6.addresses = [ + {address = "2a02:4780:12:413b::1"; prefixLength = 64;} + ]; + # defaultGateway = { + # address = "169.254.0.1"; + # interface = "ens18"; + # }; + # defaultGateway6 = { + # address = "fe80:1"; + # interface = "ens18"; + # }; + nameservers = [ + "217.21.86.10" + "8.8.4.4" + "1.1.1.1" + ]; + }; + + users.users.root.openssh.authorizedKeys.keys = + [ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIM+qXhCHNrSZmy4HEXaFn6xAp1w2GzQBMOfVdbR3E81Q cloudboxes" ]; + # networking.firewall = { + # enable = true; + # allowedTCPPorts = [ 993 465 40308 80 443 53 51820 5522 ]; + # allowedUDPPorts = [ 993 465 40308 80 443 53 50000 50001 50002 50003 50004 50005 50006 50007 50008 50009 50010 51820 5522 ]; + # }; +} diff --git a/hosts/cloud/jeet/disk-config.nix b/hosts/cloud/jeet/disk-config.nix new file mode 100644 index 0000000..d1a1d90 --- /dev/null +++ b/hosts/cloud/jeet/disk-config.nix @@ -0,0 +1,52 @@ +# Example to create a bios compatible gpt partition +{ lib, ... }: +{ +# Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 sectors +# Disk model: QEMU HARDDISK +# Units: sectors of 1 * 512 = 512 bytes +# Sector size (logical/physical): 512 bytes / 512 bytes +# I/O size (minimum/optimal): 512 bytes / 512 bytes +# Disklabel type: gpt +# Disk identifier: CED6435C-56EF-4699-BEE9-19280C444BCA +# +# Device Start End Sectors Size Type +# /dev/sda1 2048 4095 2048 1M BIOS boot +# /dev/sda2 4096 4194303 4190208 2G Linux filesystem +# /dev/sda3 4194304 419428351 415234048 198G Linux filesystem +# + disko.devices = { + disk.disk1 = { + device = lib.mkDefault "/dev/sda"; + 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%"; # Allocates the remainder of the disk, minus the sizes of the other partitions + content = { + type = "filesystem"; + format = "ext4"; + mountpoint = "/"; + }; + }; + }; + }; + }; + }; +} diff --git a/hosts/cloud/jeet/hardware-configuration.nix b/hosts/cloud/jeet/hardware-configuration.nix new file mode 100644 index 0000000..bb83c96 --- /dev/null +++ b/hosts/cloud/jeet/hardware-configuration.nix @@ -0,0 +1,24 @@ +# Do not modify this file! It was generated by ‘nixos-generate-config’ +# and may be overwritten by future invocations. Please make changes +# to /etc/nixos/configuration.nix instead. +{ config, lib, pkgs, modulesPath, ... }: + +{ + imports = + [ (modulesPath + "/profiles/qemu-guest.nix") + ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "virtio_pci" "virtio_scsi" "sd_mod" "sr_mod" ]; + boot.initrd.kernelModules = [ ]; + boot.kernelModules = [ "kvm-amd" ]; + boot.extraModulePackages = [ ]; + + # 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 + # still possible to use this option, but it's recommended to use it in conjunction + # with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`. + networking.useDHCP = lib.mkDefault true; + # networking.interfaces.ens18.useDHCP = lib.mkDefault true; + + nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; +} |