cute refactor

This commit is contained in:
waveringana 2025-06-04 02:48:23 -04:00
parent 3e9d95c2a3
commit 7fb32811d4
12 changed files with 252 additions and 181 deletions

14
modules/caddy/caddy.nix Normal file
View file

@ -0,0 +1,14 @@
{lib, pkgs, config, ...}:
{
services.caddy = {
enable = true;
virtualHosts = {
"s3.nekomimi.pet".extraConfig = ''
reverse_proxy http://127.0.0.1:3903
''
};
};
}

View file

@ -11,7 +11,5 @@
time.timeZone = "America/New_York";
i18n.defaultLocale = "en_US.UTF-8";
system.stateVersion = "24.11";
}

View file

@ -0,0 +1,49 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.modules.forgejo;
sshPort = 2222;
httpPort = 5000;
in
{
options = {
modules = {
forgejo = {
enable = mkEnableOption "Deploy forgejo";
};
};
};
config = mkIf cfg.enable {
networking.firewall.allowedTCPPorts = [
sshPort
httpPort
];
services.forgejo = {
enable = true;
database = {
type = "sqlite3";
path = "/var/lib/forgejo/forgejo.db";
};
lfs.enable = true;
settings = {
server = {
domain = "git.nekomimi.pet";
ROOT_URL = "https://git.nekomimi.pet";
LANDING_PAGE = "explore";
HTTP_PORT = 5000;
SSH_LISTEN_PORT = 2222;
SSH_PORT = 2222;
START_SSH_SERVER = true;
};
# service.DISABLE_REGISTRATION = true;
actions = {
ENABLED = true;
DEFAULT_ACTIONS_URL = "github";
};
};
};
};
}

View file

@ -0,0 +1,50 @@
{ config, lib, pkgs, ... }:
with lib;
let
cfg = config.modules.garage;
in
{
options = {
modules = {
garage = {
enable = mkEnableOption "Deploy garage";
};
};
};
config = mkIf cfg.enable {
services.garage = {
enable = true;
package = pkgs.garage;
settings = {
metadata_dir = "/garage/metadata";
data_dir = "/garage/data";
db_engine = "lmdb";
replication_mode = "2";
rpc_bind_addr = "[::]:3901";
rpc_public_addr = "${config.networking.hostName}:3901";
rpc_secret_file = config.age.secrets."garage-rpc-secret".path;
s3_api = {
s3_region = config.networking.hostName;
api_bind_addr = "[::]:3900";
root_domain = ".s3.nekomimi.pet";
};
s3_web = {
bind_addr = "[::]:3902";
root_domain = ".web.nekomimi.pet";
index = "index.html";
};
admin = {
api_bind_addr = "[::]:3903";
admin_token_file = config.age.secrets."garage-admin-token".path;
metrics_token_file = config.age.secrets."garage-metrics-token".path;
};
bootstrap_peers = [
"d548d0c9ae9aec9e26fe0bd2ca3efe75f654fa350bad5cb02bc9aebc9850ba8f@[2a04:52c0:135:48d1::2]:3901" # buer
"5504cb25910dcef4a4312006691d651c099cde7c3a88df9ca79aa350571e6e65@[2601:5c2:8400:26c0:4ecc:6aff:fef7:98ca]:3901" #valefar
];
};
};
};
}

View file

@ -0,0 +1,47 @@
{ lib, pkgs, config, ... }:
with lib;
let
cfg = config.modules.github-runners;
extraPackages =
let gtar = pkgs.runCommandNoCC "gtar" { } ''
mkdir -p $out/bin
ln -s ${lib.getExe pkgs.gnutar} $out/bin/gtar
'';
in
with pkgs; [
nix
nixci
cachix
coreutils
which
jq
gtar
docker
curl
];
in
{
options = {
modules = {
github-runners = {
enable = mkEnableOption "Deploy github runners";
};
};
};
config = mkIf cfg.enable {
services.github-runners = {
simplelink = {
enable = true;
name = "simplelink";
url = "https://github.com/waveringana/simplelink";
token = config.age.secrets."build-token".path;
user = "regent";
group = "docker";
extraPackages = extraPackages;
};
};
};
}