commit e8589198ba200996075f2879985de580cdc98bce Author: Ray Andrew <4437323+rayandrew@users.noreply.github.com> Date: Fri Sep 20 00:18:14 2024 -0500 first commit diff --git a/README.md b/README.md new file mode 100644 index 0000000..153c36c --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# vps diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..2f00321 --- /dev/null +++ b/flake.lock @@ -0,0 +1,43 @@ +{ + "nodes": { + "hardware": { + "locked": { + "lastModified": 1726724509, + "narHash": "sha256-sVeAM1tgVi52S1e29fFBTPUAFSzgQwgLon3CrztXGm8=", + "owner": "NixOS", + "repo": "nixos-hardware", + "rev": "10d5e0ecc32984c1bf1a9a46586be3451c42fd94", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixos-hardware", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1726447378, + "narHash": "sha256-2yV8nmYE1p9lfmLHhOCbYwQC/W8WYfGQABoGzJOb1JQ=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "086b448a5d54fd117f4dc2dee55c9f0ff461bdc1", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-24.05", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "hardware": "hardware", + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..8cf6bf3 --- /dev/null +++ b/flake.nix @@ -0,0 +1,25 @@ +{ + description = "Ray VPS config"; + + inputs = { + nixpkgs.url = "github:nixos/nixpkgs/nixos-24.05"; + hardware.url = "github:NixOS/nixos-hardware"; + }; + + outputs = { + self, + nixpkgs, + hardware, + ... + } @ inputs: let + inherit (self) outputs; + in { + # 'nixos-rebuild --flake .#git' + nixosConfigurations = { + git = nixpkgs.lib.nixosSystem { + specialArgs = {inherit inputs outputs;}; + modules = [./hosts/git/configuration.nix]; + }; + }; + }; +} diff --git a/hosts/git/configuration.nix b/hosts/git/configuration.nix new file mode 100644 index 0000000..84786e7 --- /dev/null +++ b/hosts/git/configuration.nix @@ -0,0 +1,94 @@ +{ + inputs, + lib, + config, + pkgs, + ... +}: { + imports = [ + inputs.hardware.nixosModules.common-cpu-intel + ./hardware-configuration.nix + ]; + + nixpkgs = { + overlays = [ + ]; + config = { + allowUnfree = true; + }; + }; + + nix = let + flakeInputs = lib.filterAttrs (_: lib.isType "flake") inputs; + in { + settings = { + experimental-features = "nix-command flakes"; + flake-registry = ""; + nix-path = config.nix.nixPath; + }; + channel.enable = false; + + registry = lib.mapAttrs (_: flake: {inherit flake;}) flakeInputs; + nixPath = lib.mapAttrsToList (n: _: "${n}=flake:${n}") flakeInputs; + }; + + users.users = { + root = { + openssh.authorizedKeys.keys = [''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE7uSjbOgWMdaEzRGlEKM7kvT7q6jnAEZPQELAH6WAEM'' ''ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAID4/EIEDcL9c1najb9J9205DyaJA/4jjH5jeME3JihFk'' ]; + }; + rayandrew = { + initialPassword = "mamamia"; + isNormalUser = true; + openssh.authorizedKeys.keys = [ + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIE7uSjbOgWMdaEzRGlEKM7kvT7q6jnAEZPQELAH6WAEM" + ]; + extraGroups = ["wheel"]; + }; + }; + + services.openssh = { + enable = true; + settings = { + PermitRootLogin = "yes"; + PasswordAuthentication = false; + }; + }; + + boot = { + tmp.cleanOnBoot = true; + loader.grub.device = "/dev/sda"; + }; + zramSwap.enable = true; + + networking = { + hostName = "git"; + nameservers = [ "8.8.8.8" ]; + domain = ""; + defaultGateway = "172.31.1.1"; + defaultGateway6 = { + address = "fe80::1"; + interface = "eth0"; + }; + dhcpcd.enable = false; + usePredictableInterfaceNames = lib.mkForce false; + interfaces = { + eth0 = { + ipv4.addresses = [ + { address="5.161.178.253"; prefixLength=32; } + ]; + ipv6.addresses = [ + { address="2a01:4ff:f0:8a0::1"; prefixLength=64; } + { address="fe80::9400:3ff:feb7:a9ed"; prefixLength=64; } + ]; + ipv4.routes = [ { address = "172.31.1.1"; prefixLength = 32; } ]; + ipv6.routes = [ { address = "fe80::1"; prefixLength = 128; } ]; + }; + + }; + }; + services.udev.extraRules = '' + ATTR{address}=="96:00:03:b7:a9:ed", NAME="eth0" + ''; + + system.stateVersion = "24.05"; +} diff --git a/hosts/git/hardware-configuration.nix b/hosts/git/hardware-configuration.nix new file mode 100644 index 0000000..47e2b4c --- /dev/null +++ b/hosts/git/hardware-configuration.nix @@ -0,0 +1,10 @@ +{ modulesPath, ... }: + +{ + imports = [ (modulesPath + "/profiles/qemu-guest.nix") ]; + + boot.initrd.availableKernelModules = [ "ata_piix" "uhci_hcd" "xen_blkfront" "vmw_pvscsi" ]; + boot.initrd.kernelModules = [ "nvme" ]; + + fileSystems."/" = { device = "/dev/sda1"; fsType = "ext4"; }; +}