Skip to content

Commit

Permalink
add: matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
jz8132543 committed Sep 21, 2024
1 parent 9eb28df commit f6f4e33
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 42 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@ jobs:
id: plan
run: |
mkdir logs
tree -L 3 .
pwd
set +e
nix develop ./flakes --command terraform-wrapper plan -out="$PWD/terraform.plan" -detailed-exitcode \
> >(sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' | tee logs/terraform-plan.stdout.log) \
Expand Down Expand Up @@ -195,6 +193,7 @@ jobs:
if [ -z "$(git status --porcelain)" ]; then
echo "repository is clean, skip commit and push"
else
git pull
git config --global user.email "[email protected]"
git config --global user.name "jz832543"
git add --all
Expand Down
27 changes: 27 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@
inputs.nixpkgs.follows = "nixpkgs";
inputs.fenix.follows = "fenix";
};
pastebin = {
url = "github:linyinfeng/pastebin";
inputs.nixpkgs.follows = "nixpkgs";
inputs.flake-parts.follows = "flake-parts";
inputs.treefmt-nix.follows = "treefmt-nix";
};
# Themes
grub2-themes = {
url = "github:vinceliuice/grub2-themes";
Expand Down
10 changes: 5 additions & 5 deletions home-manager/modules/base/editorconfig.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
"*" = {
charset = "utf-8";
end_of_line = "lf";
indent_size = 2;
# indent_size = 2;
indent_style = "space";
insert_final_newline = true;
max_line_length = "off";
trim_trailing_whitespace = true;
};
"*.js".indent_size = 2;
"*.json".indent_size = 2;
"*.md".indent_size = 2;
"*.nix".indent_size = 2;
# "*.js".indent_size = 2;
# "*.json".indent_size = 2;
# "*.md".indent_size = 2;
# "*.nix".indent_size = 2;
};
};
}
3 changes: 2 additions & 1 deletion nixos/hosts/fra1/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
nixosModules.services.doraim
nixosModules.services.ntfy
nixosModules.services.sogo
nixosModules.services.matrix
nixosModules.services.pastebin
(import nixosModules.services.matrix { })
(import nixosModules.services.keycloak { })
(import nixosModules.services.vaultwarden { })
(import nixosModules.services.alist { })
Expand Down
8 changes: 4 additions & 4 deletions nixos/hosts/isk/_steam/dst/Caves/worldgenoverride.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
return {
override_enabled = true,
worldgen_preset = "DST_CAVE",
settings_preset = "DST_CAVE",
overrides = {},
override_enabled = true,
worldgen_preset = "DST_CAVE",
settings_preset = "DST_CAVE",
overrides = {},
}
4 changes: 2 additions & 2 deletions nixos/hosts/isk/_steam/dst/Master/worldgenoverride.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
return {
override_enabled = true,
overrides = {},
override_enabled = true,
overrides = {},
}
36 changes: 18 additions & 18 deletions nixos/hosts/isk/_steam/dst/modoverrides.lua
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
return {
--# Health Info
["workshop-375859599"] = { enabled = true },
--# Show Me
["workshop-2287303119"] = { enabled = true },
--# No Thermal Stone Durability
["workshop-466732225"] = { enabled = true },
--# Extra Equip Slots
["workshop-375850593"] = { enabled = true },
--# Display Attack Range
["workshop-2078243581"] = { enabled = true },
--# Increased Stack size
["workshop-374550642"] = { enabled = true },
--# Combined Status
["workshop-376333686"] = { enabled = true },
--# Global Positions
["workshop-378160973"] = { enabled = true },
--# Demon sword Muramasa
["workshop-1842087172"] = { enabled = true },
--# Health Info
["workshop-375859599"] = { enabled = true },
--# Show Me
["workshop-2287303119"] = { enabled = true },
--# No Thermal Stone Durability
["workshop-466732225"] = { enabled = true },
--# Extra Equip Slots
["workshop-375850593"] = { enabled = true },
--# Display Attack Range
["workshop-2078243581"] = { enabled = true },
--# Increased Stack size
["workshop-374550642"] = { enabled = true },
--# Combined Status
["workshop-376333686"] = { enabled = true },
--# Global Positions
["workshop-378160973"] = { enabled = true },
--# Demon sword Muramasa
["workshop-1842087172"] = { enabled = true },
}
1 change: 1 addition & 0 deletions nixos/modules/base/nixpkgs.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
let
packages = [
inputs.sops-nix.overlays.default
inputs.pastebin.overlays.default
# inputs.neovim-nightly-overlay.overlay
# inputs.nixd.overlays.default
# inputs.nvfetcher.overlays.default
Expand Down
54 changes: 54 additions & 0 deletions nixos/modules/services/pastebin.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
config,
pkgs,
...
}:
{
# services.nginx.virtualHosts."pb.*" = {
# forceSSL = true;
# inherit (config.security.acme.tfCerts."li7g_com".nginxSettings) sslCertificate sslCertificateKey;
# locations."/" = {
# proxyPass = "http://127.0.0.1:${toString config.ports.pastebin}";
# extraConfig = ''
# add_header Cache-Control "public, no-cache";
# '';
# };
# extraConfig = ''
# client_max_body_size 25M;
# '';
# };
systemd.services.pastebin = {
script = ''
# export AWS_ACCESS_KEY_ID=$(cat "$CREDENTIALS_DIRECTORY/key-id")
# export AWS_SECRET_ACCESS_KEY=$(cat "$CREDENTIALS_DIRECTORY/access-key")
${pkgs.pastebin}/bin/pastebin \
# --endpoint-host minio.li7g.com \
# --bucket pastebin \
--addressing-style path \
--port "${toString config.ports.pastebin}"
'';
serviceConfig = {
DynamicUser = true;
# LoadCredential = [
# "key-id:${config.sops.secrets."minio_pastebin_key_id".path}"
# "access-key:${config.sops.secrets."minio_pastebin_access_key".path}"
# ];
};
wantedBy = [ "multi-user.target" ];
};
services.traefik.dynamicConfigOptions.http = {
routers = {
atuin = {
rule = "Host(`pb.${config.networking.domain}`)";
entryPoints = [ "https" ];
service = "pastebin";
};
};
services = {
pastebin.loadBalancer = {
passHostHeader = true;
servers = [ { url = "http://localhost:${toString config.ports.pastebin}"; } ];
};
};
};
}
55 changes: 55 additions & 0 deletions terraform/b2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,58 @@ output "b2_mastodon_media_access_key" {
value = b2_application_key.mastodon_media.application_key
sensitive = true
}

# pastebin
resource "b2_bucket" "pastebin_media" {
bucket_name = "doraim-pastebin-media"
bucket_type = "allPublic"

# keep only the last version of the file
lifecycle_rules {
file_name_prefix = ""
days_from_uploading_to_hiding = null
days_from_hiding_to_deleting = 1
}

cors_rules {
cors_rule_name = "allow-media-on-dora-im"
allowed_operations = [
"s3_head",
"b2_download_file_by_id",
"b2_download_file_by_name",
"s3_get"
]
allowed_origins = [
"https://*.dora.im"
]
max_age_seconds = 86400
}
}
resource "b2_application_key" "pastebin_media" {
key_name = "pastebin-media"
bucket_id = b2_bucket.pastebin_media.id
capabilities = [
"deleteFiles",
"listAllBucketNames",
"listBuckets",
"listFiles",
"readBucketEncryption",
"readBuckets",
"readFiles",
"shareFiles",
"writeBucketEncryption",
"writeFiles"
]
}
output "b2_pastebin_media_bucket_name" {
value = b2_bucket.pastebin_media.bucket_name
sensitive = false
}
output "b2_pastebin_media_key_id" {
value = b2_application_key.pastebin_media.application_key_id
sensitive = false
}
output "b2_pastebin_media_access_key" {
value = b2_application_key.pastebin_media.application_key
sensitive = true
}
12 changes: 2 additions & 10 deletions terraform/cloudflare.tf
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ locals {
atuin = { on = "fra1", proxy = false }
ntfy = { on = "fra1", proxy = false }
mail = { on = "fra1", proxy = false }
pb = { on = "fra1", proxy = false }
m = { on = "fra1", proxy = false }
"admin.m" = { on = "fra1", proxy = false }
searx = { on = "hkg4", proxy = false }
Expand Down Expand Up @@ -109,7 +110,7 @@ resource "cloudflare_record" "dora" {
proxied = false
ttl = 1
type = "CNAME"
content = "dfw0.dora.im"
content = "hkg4.dora.im"
zone_id = cloudflare_zone.im_dora.id
}

Expand Down Expand Up @@ -189,15 +190,6 @@ resource "cloudflare_record" "dora_mx_fra1" {

# Machines

resource "cloudflare_record" "dora_matrix" {
name = "m"
proxied = false
ttl = 1
type = "A"
content = "100.64.0.2"
zone_id = cloudflare_zone.im_dora.id
}

resource "cloudflare_record" "dora_tippy" {
name = "tippy"
proxied = false
Expand Down

0 comments on commit f6f4e33

Please sign in to comment.