first commit
This commit is contained in:
commit
e8589198ba
5 changed files with 173 additions and 0 deletions
1
README.md
Normal file
1
README.md
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
# vps
|
||||||
43
flake.lock
Normal file
43
flake.lock
Normal file
|
|
@ -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
|
||||||
|
}
|
||||||
25
flake.nix
Normal file
25
flake.nix
Normal file
|
|
@ -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];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
94
hosts/git/configuration.nix
Normal file
94
hosts/git/configuration.nix
Normal file
|
|
@ -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";
|
||||||
|
}
|
||||||
10
hosts/git/hardware-configuration.nix
Normal file
10
hosts/git/hardware-configuration.nix
Normal file
|
|
@ -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"; };
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue