Initial commit

This commit is contained in:
AXOLOTsh
2026-01-28 11:41:51 +03:00
commit c1d66293aa
52 changed files with 817 additions and 0 deletions

1
TODO.txt Normal file
View File

@@ -0,0 +1 @@
Add global config

141
flake.lock generated Normal file
View File

@@ -0,0 +1,141 @@
{
"nodes": {
"disko": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1766150702,
"narHash": "sha256-P0kM+5o+DKnB6raXgFEk3azw8Wqg5FL6wyl9jD+G5a4=",
"owner": "nix-community",
"repo": "disko",
"rev": "916506443ecd0d0b4a0f4cf9d40a3c22ce39b378",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "disko",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"home-manager": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1766387499,
"narHash": "sha256-AjK3/UKDzeXFeYNLVBaJ3+HLE9he1g5UrlNd4/BM3eA=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "527ad07e6625302b648ed3b28c34b62a79bd103e",
"type": "github"
},
"original": {
"owner": "nix-community",
"repo": "home-manager",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1766309749,
"narHash": "sha256-3xY8CZ4rSnQ0NqGhMKAy5vgC+2IVK0NoVEzDoOh4DA4=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "a6531044f6d0bef691ea18d4d4ce44d0daa6e816",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1751274312,
"narHash": "sha256-/bVBlRpECLVzjV19t5KMdMFWSwKLtb5RyXdjz3LJT+g=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "50ab793786d9de88ee30ec4e4c24fb4236fc2674",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"root": {
"inputs": {
"disko": "disko",
"home-manager": "home-manager",
"nixpkgs": "nixpkgs",
"nixpkgs-stable": "nixpkgs-stable",
"wg-obfuscator": "wg-obfuscator"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"wg-obfuscator": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1762900842,
"narHash": "sha256-WqYoVlA+InB8afJYBromw/3oy37FG/I01ES2g/K8T04=",
"owner": "ClusterM",
"repo": "wg-obfuscator",
"rev": "ab65bea13081c01ba21d4f8157efd49e3dae9b0e",
"type": "github"
},
"original": {
"owner": "ClusterM",
"repo": "wg-obfuscator",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

82
flake.nix Normal file
View File

@@ -0,0 +1,82 @@
{
description = "Server Nix Flake by AXOLOTsh";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
nixpkgs-stable.url = "github:nixos/nixpkgs/nixos-24.11";
home-manager = {
url = "github:nix-community/home-manager";
inputs.nixpkgs.follows = "nixpkgs";
};
disko = {
url = "github:nix-community/disko";
inputs.nixpkgs.follows = "nixpkgs";
};
wg-obfuscator = {
url = "github:ClusterM/wg-obfuscator";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, nixpkgs-stable, home-manager, ... } @ inputs:
let
system = "x86_64-linux";
pkgs-stable = import nixpkgs-stable {
inherit system;
config.allowUnfree = true;
};
in {
nixosConfigurations = {
nix-axolotsh = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs pkgs-stable self; };
modules = [
./hosts/nix-axolotsh/configuration.nix
./hosts/nix-axolotsh/disko.nix
inputs.disko.nixosModules.disko
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs pkgs-stable self; };
home-manager.users.axolotsh = import ./home/axolotsh/home.nix;
}
];
};
axoserver-nix = nixpkgs.lib.nixosSystem {
inherit system;
specialArgs = { inherit inputs pkgs-stable self; };
modules = [
./hosts/axoserver-nix/configuration.nix
./hosts/axoserver-nix/disko.nix
inputs.disko.nixosModules.disko
inputs.wg-obfuscator.nixosModules.default
home-manager.nixosModules.home-manager
{
home-manager.useGlobalPkgs = true;
home-manager.useUserPackages = true;
home-manager.extraSpecialArgs = { inherit inputs pkgs-stable self; };
home-manager.users.axolotsh = import ./home/axolotsh-server/home.nix;
home-manager.users.mirsem = import ./home/mirsem/home.nix;
home-manager.users.jam = import ./home/jam/home.nix;
}
];
};
};
};
}

View File

@@ -0,0 +1,12 @@
{ ... } : {
programs.home-manager.enable = true;
home = {
username = "axolotsh";
homeDirectory = "/home/axolotsh";
stateVersion = "25.05";
};
imports = [
./index.nix
];
}

View File

@@ -0,0 +1,9 @@
{ self, ... } : {
imports = [
"${self}/home/common/bash-aliases.nix"
"${self}/home/common/git.nix"
"${self}/home/common/fastfetch.nix"
./packages.nix
];
}

View File

@@ -0,0 +1,3 @@
{ self, pkgs, ... } : {
imports = [ "${self}/home/common/packages.nix" ];
}

12
home/axolotsh/home.nix Normal file
View File

@@ -0,0 +1,12 @@
{ ... } : {
programs.home-manager.enable = true;
home = {
username = "axolotsh";
homeDirectory = "/home/axolotsh";
stateVersion = "25.05";
};
imports = [
./index.nix
];
}

9
home/axolotsh/index.nix Normal file
View File

@@ -0,0 +1,9 @@
{ self, ... } : {
imports = [
"${self}/home/common/bash-aliases.nix"
"${self}/home/common/git.nix"
"${self}/home/common/fastfetch.nix"
./packages.nix
];
}

View File

@@ -0,0 +1,3 @@
{ self, pkgs, ... } : {
imports = [ "${self}/home/common/packages.nix" ];
}

View File

@@ -0,0 +1,21 @@
{ self, ... } : {
programs.bash = {
enable = true;
shellAliases = {
editor = "nano";
sync = "cd ${self} && git pull && cd -";
rebuild = "sudo nixos-rebuild switch --flake ${self}";
nix-path = "cd ${self}";
gen-list = "sudo nix-env -p /nix/var/nix/profiles/system --list-generations";
clean = "sudo nix-collect-garbage -d";
update = "sudo nix-channel --update";
update-flake = "cd ${self} && nix flake update && cd -";
upgrade = "sudo nixos-rebuild switch --upgrade --flake ${self}";
search = "nix search";
};
};
}

45
home/common/fastfetch.nix Normal file
View File

@@ -0,0 +1,45 @@
{ pkgs, ... } : {
home.packages = with pkgs; [
fastfetch
];
programs.fastfetch = {
enable = true;
settings = {
logo = {
source = "nixos";
type = "auto";
};
display = {
separator = " ";
};
modules = [
"title"
"separator"
"os"
"kernel"
"uptime"
"packages"
"shell"
"terminal"
"cpu"
"gpu"
"memory"
"swap"
"disk"
"locale"
"localip"
"break"
"colors"
];
};
};
programs.bash = {
enable = true;
shellAliases = {
fetch = "fastfetch";
};
initExtra = "fetch";
};
}

12
home/common/git.nix Normal file
View File

@@ -0,0 +1,12 @@
{ ... } : {
programs.git = {
enable = true;
settings = {
user = {
name = "AXOLOTsh";
email = "96595812+AXOLOTsh@users.noreply.github.com";
};
init.defaultBranch = "main";
};
};
}

23
home/common/packages.nix Normal file
View File

@@ -0,0 +1,23 @@
{ pkgs, ... } : {
home.packages = with pkgs; [
# region Tools
git
gh
screen
mc
btop
wget
traceroute
dnsutils
atool
zip
unzip
p7zip
# endregion
];
}

View File

@@ -0,0 +1,8 @@
{ self, ... } : {
programs.bash = {
enable = true;
shellAliases = {
editor = "nano";
};
};
}

12
home/jam/home.nix Normal file
View File

@@ -0,0 +1,12 @@
{ ... } : {
programs.home-manager.enable = true;
home = {
username = "jam";
homeDirectory = "/home/jam";
stateVersion = "25.05";
};
imports = [
./index.nix
];
}

9
home/jam/index.nix Normal file
View File

@@ -0,0 +1,9 @@
{ self, ... } : {
imports = [
"${self}/home/common/fastfetch.nix"
./bash-aliases.nix
./packages.nix
];
}

3
home/jam/packages.nix Normal file
View File

@@ -0,0 +1,3 @@
{ self, pkgs, ... } : {
imports = [ "${self}/home/common/packages.nix" ];
}

View File

@@ -0,0 +1,8 @@
{ self, ... } : {
programs.bash = {
enable = true;
shellAliases = {
editor = "nano";
};
};
}

12
home/mirsem/home.nix Normal file
View File

@@ -0,0 +1,12 @@
{ ... } : {
programs.home-manager.enable = true;
home = {
username = "mirsem";
homeDirectory = "/home/mirsem";
stateVersion = "25.05";
};
imports = [
./index.nix
];
}

9
home/mirsem/index.nix Normal file
View File

@@ -0,0 +1,9 @@
{ self, ... } : {
imports = [
"${self}/home/common/fastfetch.nix"
./bash-aliases.nix
./packages.nix
];
}

3
home/mirsem/packages.nix Normal file
View File

@@ -0,0 +1,3 @@
{ self, pkgs, ... } : {
imports = [ "${self}/home/common/packages.nix" ];
}

View File

@@ -0,0 +1,20 @@
{ pkgs, ... } : {
environment.systemPackages = with pkgs; [
borgbackup
];
services.borgbackup.jobs.minecraft-java = {
paths = "/data/server-data/minecraft-java";
encryption.mode = "none";
environment.BORG_RSH = "ssh -i /root/.ssh/backup-ubuntu";
repo = "ssh://borg@10.4.10.14:22/home/borg/backups";
compression = "auto,zstd";
startAt = "daily";
extraArgs = "--show-rc --stats";
exclude = [
"*.db-wal"
"*.db-shm"
"/data/server-data/minecraft-java/logs"
];
};
}

View File

@@ -0,0 +1,11 @@
{ config, pkgs, ... } : {
imports = [
./hardware-configuration.nix
./index.nix
];
networking.networkmanager.enable = true;
networking.hostName = "axoserver-nix";
system.stateVersion = "25.05";
}

View File

@@ -0,0 +1,41 @@
{
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
size = "256M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
swap = {
size = "4G";
content = {
type = "swap";
resumeDevice = true;
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}

View File

@@ -0,0 +1,6 @@
{ ... } : {
# networking.firewall.enable = false;
networking.firewall.allowedTCPPorts = [ 25565 ];
networking.firewall.allowedUDPPorts = [ 25565 ];
}

View File

@@ -0,0 +1,22 @@
# 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 + "/installer/scan/not-detected.nix")
];
boot.initrd.availableKernelModules = [ "vmd" "xhci_pci" "ahci" "usb_storage" "usbhid" "sd_mod" ];
boot.initrd.kernelModules = [ ];
boot.kernelModules = [ "kvm-intel" ];
boot.extraModulePackages = [ ];
swapDevices =
[ { device = "/dev/disk/by-uuid/7a9a936c-f998-43f1-b674-0313688f8316"; }
];
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;
}

View File

@@ -0,0 +1,26 @@
{ self, ... } : {
imports = [
"${self}/modules/system/boot/grub-efi.nix"
"${self}/modules/system/filesystem.nix"
"${self}/modules/system/experimental-features.nix"
"${self}/modules/system/unfree.nix"
"${self}/modules/system/localization.nix"
"${self}/modules/openssh.nix"
"${self}/modules/docker.nix"
"${self}/modules/vscode-server.nix"
./users.nix
./openssh-keys.nix
./firewall.nix
./wg-obfuscator.nix
./wg-quick.nix
./zabbix-agent.nix
./borg-backup.nix
./packages.nix
];
}

View File

@@ -0,0 +1,27 @@
{ ... } : {
services.openssh = {
enable = true;
settings = {
PasswordAuthentication = false;
KbdInteractiveAuthentication = false;
PermitRootLogin = "no";
};
};
users.users.axolotsh = {
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII3fi+aocgGe2gG4TbY47BZ7GAZM/VIEO4KAh/+kAtWB axolotsh@win-axolotsh"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIRjyyOvThQ7jUBQFIioCt53Spdv9XHqp5S5TslYCvLF u0_a295@localhost"
];
};
users.users.mirsem = {
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGfGbufs4SzRVWUay9YNneuHd9uyYDvvRtEGHI0P2Xcb mirse@MirsemPC"
];
};
users.users.jam = {
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIA1GvtRb2jb20qApbZqy785GPPLBrRWn3iUumJu3PGbE aporuchikov@user-MS-7C96"
];
};
}

View File

@@ -0,0 +1,3 @@
{ self, pkgs, ... } : {
imports = [ "${self}/modules/packages.nix" ];
}

View File

@@ -0,0 +1,19 @@
{ self, ... } : {
# imports = [ "${self}/modules/system/default-user.nix" ];
users.groups.server = {};
users.users = {
axolotsh = {
isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" "docker" "server" ];
};
mirsem = {
isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" "docker" "server" ];
};
jam = {
isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" "docker" "server" ];
};
};
}

View File

@@ -0,0 +1,14 @@
{ inputs, pkgs, ... } : {
services.wg-obfuscator = {
enable = true;
instances.client = {
enable = true;
listenPort = 51821;
target = "168.222.255.234:21377";
key = "SPERMAUNITAZ";
masking = "AUTO";
interface = "0.0.0.0";
};
};
}

View File

@@ -0,0 +1,19 @@
{ ... } : {
networking.wg-quick.interfaces.wg0 = {
address = [ "10.1.10.2/24" ];
privateKey = "2IzITd4epbSgALua8DKX2UC151o6F6q7l6J9/Ib+znk=";
peers = [
{
publicKey = "meFmsUmqtLtaexVpWvWWWXnKiUarSahZD75lZONJVUE=";
allowedIPs = [ "10.1.10.0/24" ];
endpoint = "127.0.0.1:51821";
persistentKeepalive = 60;
}
];
};
}

View File

@@ -0,0 +1,12 @@
{ pkgs, ... } : {
services.zabbixAgent = {
enable = true;
package = pkgs.zabbix.agent;
server = "10.6.0.1";
settings = {
ServerActive = "10.6.0.18";
};
};
networking.firewall.allowedTCPPorts = [ 10050 ];
}

View File

@@ -0,0 +1,11 @@
{ config, pkgs, ... } : {
imports = [
./hardware-configuration.nix
./index.nix
];
networking.networkmanager.enable = true;
networking.hostName = "nix-axolotsh";
system.stateVersion = "25.05";
}

View File

@@ -0,0 +1,41 @@
{
disko.devices = {
disk = {
main = {
type = "disk";
device = "/dev/sda";
content = {
type = "gpt";
partitions = {
ESP = {
size = "256M";
type = "EF00";
content = {
type = "filesystem";
format = "vfat";
mountpoint = "/boot";
};
};
swap = {
size = "4G";
content = {
type = "swap";
resumeDevice = true;
};
};
root = {
size = "100%";
content = {
type = "filesystem";
format = "ext4";
mountpoint = "/";
};
};
};
};
};
};
};
}

View File

@@ -0,0 +1,6 @@
{ ... } : {
networking.firewall.enable = false;
# networking.firewall.allowedTCPPorts = [ ];
# networking.firewall.allowedUDPPorts = [ ];
}

View File

@@ -0,0 +1,19 @@
{ self, ... } : {
imports = [
"${self}/modules/system/boot/grub-efi.nix"
"${self}/modules/system/filesystem.nix"
"${self}/modules/system/experimental-features.nix"
"${self}/modules/system/unfree.nix"
"${self}/modules/system/localization.nix"
"${self}/modules/packages.nix"
"${self}/modules/openssh.nix"
"${self}/modules/vscode-server.nix"
./users.nix
./firewall.nix
];
}

View File

@@ -0,0 +1,3 @@
{ self, ... } : {
imports = [ "${self}/modules/system/default-user.nix" ];
}

15
install.sh Normal file
View File

@@ -0,0 +1,15 @@
#!/usr/bin/env bash
set -e
if [ -z "$1" ]; then
echo "Error: argument is missing."
echo "Usage: $0 <host-name>"
exit 1
fi
HOST_NAME=$1
sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko/latest -- --mode destroy,format,mount "./hosts/$HOST_NAME/disko.nix"
sudo nixos-generate-config --root /tmp/
sudo cp /tmp/etc/nixos/hardware-configuration.nix "./hosts/$HOST_NAME/"
sudo git add .
sudo nixos-install --flake ".#$HOST_NAME" --root /mnt/

3
modules/docker.nix Normal file
View File

@@ -0,0 +1,3 @@
{ ... } : {
virtualisation.docker.enable = true;
}

3
modules/openssh.nix Normal file
View File

@@ -0,0 +1,3 @@
{ ... } : {
services.openssh.enable = true;
}

6
modules/packages.nix Normal file
View File

@@ -0,0 +1,6 @@
{ pkgs, ... } : {
environment.systemPackages = with pkgs; [
icu
glibc
];
}

View File

@@ -0,0 +1,6 @@
{ ... } : {
boot.loader.grub.enable = true;
boot.loader.grub.device = "nodev";
boot.loader.grub.efiSupport = true;
boot.loader.efi.canTouchEfiVariables = true;
}

View File

@@ -0,0 +1,8 @@
{ ... } : {
users.users = {
axolotsh = {
isNormalUser = true;
extraGroups = [ "networkmanager" "wheel" "docker" ];
};
};
}

View File

@@ -0,0 +1,3 @@
{ ... } : {
nix.settings.experimental-features = [ "nix-command" "flakes" ];
}

View File

@@ -0,0 +1,3 @@
{ ... } : {
boot.supportedFilesystems = [ "ntfs" ];
}

View File

@@ -0,0 +1,17 @@
{ ... } : {
time.timeZone = "Europe/Moscow";
i18n.defaultLocale = "en_US.UTF-8";
i18n.extraLocaleSettings = {
LC_ADDRESS = "ru_RU.UTF-8";
LC_IDENTIFICATION = "ru_RU.UTF-8";
LC_MEASUREMENT = "en_GB.UTF-8";
LC_MONETARY = "ru_RU.UTF-8";
LC_NAME = "ru_RU.UTF-8";
LC_NUMERIC = "en_US.UTF-8";
LC_PAPER = "ru_RU.UTF-8";
LC_TELEPHONE = "ru_RU.UTF-8";
LC_TIME = "en_GB.UTF-8";
};
}

4
modules/system/proxy.nix Normal file
View File

@@ -0,0 +1,4 @@
{ ... } : {
networking.proxy.default = "http://user:password@proxy:port/";
networking.proxy.noProxy = "127.0.0.1,localhost,internal.domain";
}

View File

@@ -0,0 +1,3 @@
{ ... } : {
nixpkgs.config.allowUnfree = true;
}

View File

@@ -0,0 +1,3 @@
{ ... } : {
networking.wireless.enable = true;
}

View File

@@ -0,0 +1,4 @@
{ pkgs, ... } : {
environment.systemPackages = with pkgs; [ vscode.fhs ];
programs.nix-ld.enable = true;
}

2
update.sh Normal file
View File

@@ -0,0 +1,2 @@
#!/usr/bin/env bash
sudo nixos-rebuild switch --flake .