nix: first updates

This commit is contained in:
dprin 2026-08-09 09:09:48 +02:00
parent 39643701c8
commit 0cadeb1031
10 changed files with 246 additions and 48 deletions

View file

@ -27,11 +27,11 @@
services.openssh.enable = true; services.openssh.enable = true;
networking.firewall.allowedTCPPorts = [22 80 443]; nixpkgs.config.allowUnfree = true;
# networking.firewall.allowedUDPPorts = [ ... ];
nix = { nix = {
settings.experimental-features = ["nix-command" "flakes"]; settings.experimental-features = ["nix-command" "flakes"];
settings.trusted-public-keys = ["prin:qLlCk6ouH2mKQoiX3UmPX+x8VyEvI7tDYCvEh6+bq0Q="];
optimise.automatic = true; optimise.automatic = true;
gc = { gc = {
automatic = true; automatic = true;

92
flake.lock generated
View file

@ -1,5 +1,21 @@
{ {
"nodes": { "nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1747046372,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"flake-parts": { "flake-parts": {
"inputs": { "inputs": {
"nixpkgs-lib": [ "nixpkgs-lib": [
@ -23,7 +39,7 @@
}, },
"flake-utils": { "flake-utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems_2"
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1731533236,
@ -46,11 +62,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1774559029, "lastModified": 1779506708,
"narHash": "sha256-deix7yg3j6AhjMPnFDCmWB3f83LsajaaULP5HH2j34k=", "narHash": "sha256-QOD/CNm196nCJRheux/URi4/HE66fthdOMqCJoPP1Y0=",
"owner": "nix-community", "owner": "nix-community",
"repo": "home-manager", "repo": "home-manager",
"rev": "a0bb0d11514f92b639514220114ac8063c72d0a3", "rev": "3ee51fbdac8c8bdfe1e7e1fcaba6520a563f394f",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -88,13 +104,49 @@
"type": "github" "type": "github"
} }
}, },
"nix-minecraft": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs",
"systems": "systems"
},
"locked": {
"lastModified": 1784777515,
"narHash": "sha256-hBzD1XzM/2cYWfgLvbiGDLDebE1SXHO+O6N4YOT0+W4=",
"owner": "Infinidoge",
"repo": "nix-minecraft",
"rev": "3fc7a8a5d4640a5e6bf614e17e5c4c971edfc90a",
"type": "github"
},
"original": {
"owner": "Infinidoge",
"repo": "nix-minecraft",
"type": "github"
}
},
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1774388614, "lastModified": 1769461804,
"narHash": "sha256-tFwzTI0DdDzovdE9+Ras6CUss0yn8P9XV4Ja6RjA+nU=", "narHash": "sha256-msG8SU5WsBUfVVa/9RPLaymvi5bI8edTavbIq3vRlhI=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "bfc1b8a4574108ceef22f02bafcf6611380c100d",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_2": {
"locked": {
"lastModified": 1782847189,
"narHash": "sha256-twXPFqFsrrY5r28Zh7Homgcp2gUMBgQ6WDS98Q/3xFI=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "1073dad219cb244572b74da2b20c7fe39cb3fa9e", "rev": "b6018f87da91d19d0ab4cf979885689b469cdd41",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -111,14 +163,14 @@
"nixpkgs" "nixpkgs"
], ],
"nuschtosSearch": "nuschtosSearch", "nuschtosSearch": "nuschtosSearch",
"systems": "systems_2" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1769049374, "lastModified": 1780865908,
"narHash": "sha256-h0Os2qqNyycDY1FyZgtbn28VF1ySP74/n0f+LDd8j+w=", "narHash": "sha256-UMwL+pE2I49q6qOV8w6pnuF3utb1qQuofmprBAhOU6A=",
"owner": "nix-community", "owner": "nix-community",
"repo": "nixvim", "repo": "nixvim",
"rev": "b8f76bf5751835647538ef8784e4e6ee8deb8f95", "rev": "68e314303bc60b8a58cdd2f361013809620b2473",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -154,7 +206,8 @@
"root": { "root": {
"inputs": { "inputs": {
"home-manager": "home-manager", "home-manager": "home-manager",
"nixpkgs": "nixpkgs", "nix-minecraft": "nix-minecraft",
"nixpkgs": "nixpkgs_2",
"nixvim": "nixvim" "nixvim": "nixvim"
} }
}, },
@ -187,6 +240,21 @@
"repo": "default", "repo": "default",
"type": "github" "type": "github"
} }
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
} }
}, },
"root": "root", "root": "root",

View file

@ -14,22 +14,29 @@
# If using a stable channel you can use `url = "github:nix-community/nixvim/nixos-<version>"` # If using a stable channel you can use `url = "github:nix-community/nixvim/nixos-<version>"`
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
nix-minecraft.url = "github:Infinidoge/nix-minecraft";
}; };
outputs = { outputs = inputs @ {
nixpkgs, nixpkgs,
home-manager, home-manager,
nixvim, nixvim,
nix-minecraft,
... ...
}: { }: {
nixosConfigurations."prever" = nixpkgs.lib.nixosSystem { nixosConfigurations."prever" = nixpkgs.lib.nixosSystem {
modules = [ modules = [
home-manager.nixosModules.default home-manager.nixosModules.default
nixvim.nixosModules.nixvim nixvim.nixosModules.nixvim
nix-minecraft.nixosModules.minecraft-servers
./hardware-configuration.nix ./hardware-configuration.nix
./configuration.nix ./configuration.nix
./modules ./modules
{
nixpkgs.overlays = [inputs.nix-minecraft.overlay];
}
]; ];
}; };
}; };

View file

@ -4,5 +4,8 @@
./nginx.nix ./nginx.nix
./tmux.nix ./tmux.nix
./nvim.nix ./nvim.nix
./networking.nix
./forgejo.nix
./minecraft.nix
]; ];
} }

29
modules/forgejo.nix Normal file
View file

@ -0,0 +1,29 @@
{config, ...}: let
cfg = config.services.forgejo;
srv = cfg.settings.server;
in {
services.nginx = {
virtualHosts.${cfg.settings.server.DOMAIN} = {
forceSSL = true;
enableACME = true;
locations."/".proxyPass = "http://localhost:${toString srv.HTTP_PORT}";
};
};
services.forgejo = {
enable = true;
database.type = "postgres";
lfs.enable = true;
stateDir = "/var/git";
settings = {
server = {
DOMAIN = "git.yelbakri.dev";
ROOT_URL = "https://${srv.DOMAIN}/";
HTTP_PORT = 3000;
};
service.DISABLE_REGISTRATION = true;
};
};
}

View file

@ -1,2 +1,110 @@
{...}: { {pkgs, ...}: {
services.nginx = {
recommendedProxySettings = true;
virtualHosts."mc.yelbakri.dev" = {
enableACME = true;
forceSSL = true;
locations."/" = {
proxyPass = "http://localhost:8100";
proxyWebsockets = true;
};
};
};
services.minecraft-servers = {
enable = true;
eula = true;
openFirewall = true;
# managementSystem.systemd-socket.enable = true;
servers.purpur = {
enable = true;
autoStart = true;
openFirewall = true;
enableReload = true;
jvmOpts = "-Xmx6G -Xms4G";
package = pkgs.purpurServers.purpur-26_2.override {
jre = pkgs.openjdk25;
};
operators = {
bruh_prin = "0da45413-80b8-4e48-a220-5340f5be4122";
};
whitelist = {
Quimii = "78e09ea0-7b13-4eee-8203-c8dad929a738";
Keir3 = "4872ed2a-50cb-4636-b879-02215c1d4023";
bruh_prin = "0da45413-80b8-4e48-a220-5340f5be4122";
Aegns445 = "4fd4d160-dad9-4136-b49c-aa44ee1d3ab1";
roro_u22 = "3631cba2-5808-43f2-b5dc-1357f274c03a";
FeedBackJr = "b9a4d8ae-3c2c-42df-b63b-0ee5874bf250";
Killax = "79862daf-f239-45d2-bf08-1b80961bf656";
};
files."plugins/bluemap.jar" = pkgs.fetchurl {
url = "https://hangarcdn.papermc.io/plugins/Blue/BlueMap/versions/5.20/PAPER/bluemap-5.20-paper.jar";
sha256 = "yTnJi3KKpwiaBLesoaaXnpKjfyUkcfarrWZ0nt6AYzk=";
};
serverProperties = {
accepts-transfers = false;
allow-flight = false;
broadcast-console-to-ops = true;
broadcast-rcon-to-ops = true;
difficulty = "hard";
enable-code-of-conduct = false;
enable-jmx-monitoring = false;
enable-query = false;
enable-rcon = false;
enable-status = true;
enforce-secure-profile = true;
enforce-whitelist = true;
entity-broadcast-range-percentage = 100;
force-gamemode = false;
function-permission-level = 2;
gamemode = "survival";
generate-structures = true;
hardcore = false;
hide-online-players = false;
initial-enabled-packs = "vanilla";
level-name = "testing";
level-type = "minecraft\\:normal";
log-ips = true;
management-server-enabled = false;
management-server-host = "localhost";
management-server-port = 0;
management-server-secret = "UYSVZK8WKzvWscxgQgvQONRKpyeyl7VyfBc8hGPl";
management-server-tls-enabled = true;
max-chained-neighbor-updates = 1000000;
max-players = 7;
max-tick-time = 60000;
max-world-size = 29999984;
motd = "SIGMA SERVER";
network-compression-threshold = 256;
online-mode = true;
op-permission-level = 4;
pause-when-empty-seconds = 60;
player-idle-timeout = 0;
prevent-proxy-connections = false;
"query.port" = 25565;
rate-limit = 0;
"rcon.password" = "hahaha";
"rcon.port" = 25575;
region-file-compression = "deflate";
require-resource-pack = false;
server-port = 25565;
simulation-distance = 10;
spawn-protection = 16;
status-heartbeat-interval = 0;
sync-chunk-writes = true;
use-native-transport = true;
view-distance = 16;
white-list = true;
};
};
};
} }

8
modules/networking.nix Normal file
View file

@ -0,0 +1,8 @@
{...}: let
in {
networking.firewall = {
enable = true; # disable default firewall
allowedTCPPorts = [22 80 443 25565];
allowedUDPPorts = [22 80 443 25565];
};
}

View file

@ -8,6 +8,7 @@
addSSL = true; addSSL = true;
enableACME = true; enableACME = true;
root = "/var/www"; root = "/var/www";
default = true;
}; };
}; };

View file

@ -1,4 +1,4 @@
{pkgs, ...}: { {...}: {
programs.nixvim = { programs.nixvim = {
enable = true; enable = true;
globals.mapleader = " "; globals.mapleader = " ";
@ -8,36 +8,5 @@
}; };
colorschemes.ayu.enable = true; colorschemes.ayu.enable = true;
autoCmd = [
{
event = "BufWritePre";
pattern = "*.nix";
callback = {
__raw = "function(args) require('conform').format({ bufnr = args.buf }) end";
};
}
];
plugins.nix.enable = true;
plugins.treesitter.enable = true;
plugins.lspconfig.enable = true;
plugins.blink-cmp.enable = true;
plugins.telescope.enable = true;
plugins.conform-nvim = {
enable = true;
settings = {
formatters_by_ft = {
nix = ["alejandra"];
};
};
};
lsp.servers.nil_ls.enable = true;
}; };
users.users.prever.packages = [
pkgs.alejandra
];
} }

5
secrets/default.nix Normal file
View file

@ -0,0 +1,5 @@
{...}: let
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP7vhngCJL3jcyNGbSC0ke1CwW9/gn/bcTe0kGc1lbIu prin@nixos";
in {
"forgejo-admin.age".publicKeys = [key];
}