feat: meiling

This commit is contained in:
arcnmx 2025-09-03 23:18:59 -07:00
parent dd30009b7e
commit 47ca22ff47
30 changed files with 431 additions and 70 deletions

View file

@ -79,8 +79,8 @@ jobs:
args: -u .github/workflows/nodes.yml .ci/workflow.yml args: -u .github/workflows/nodes.yml .ci/workflow.yml
attrs: nixpkgs.diffutils attrs: nixpkgs.diffutils
command: diff command: diff
ct: ct-meiling:
name: nodes-ct name: nodes-ct-meiling
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- id: checkout - id: checkout
@ -95,7 +95,7 @@ jobs:
name: nix test dirty name: nix test dirty
uses: arcnmx/ci/actions/nix/run@v0.7 uses: arcnmx/ci/actions/nix/run@v0.7
with: with:
attrs: ci.job.ct.run.test attrs: ci.job.ct-meiling.run.test
command: ci-build-dirty command: ci-build-dirty
quiet: false quiet: false
stdout: ${{ runner.temp }}/ci.build.dirty stdout: ${{ runner.temp }}/ci.build.dirty
@ -103,7 +103,7 @@ jobs:
name: nix test build name: nix test build
uses: arcnmx/ci/actions/nix/run@v0.7 uses: arcnmx/ci/actions/nix/run@v0.7
with: with:
attrs: ci.job.ct.run.test attrs: ci.job.ct-meiling.run.test
command: ci-build-realise command: ci-build-realise
ignore-exit-code: true ignore-exit-code: true
quiet: false quiet: false
@ -114,7 +114,7 @@ jobs:
name: nix test results name: nix test results
uses: arcnmx/ci/actions/nix/run@v0.7 uses: arcnmx/ci/actions/nix/run@v0.7
with: with:
attrs: ci.job.ct.run.test attrs: ci.job.ct-meiling.run.test
command: ci-build-summarise command: ci-build-summarise
quiet: false quiet: false
stdin: ${{ runner.temp }}/ci.build.dirty stdin: ${{ runner.temp }}/ci.build.dirty
@ -126,7 +126,58 @@ jobs:
name: nix test cache name: nix test cache
uses: arcnmx/ci/actions/nix/run@v0.7 uses: arcnmx/ci/actions/nix/run@v0.7
with: with:
attrs: ci.job.ct.run.test attrs: ci.job.ct-meiling.run.test
command: ci-build-cache
quiet: false
stdin: ${{ runner.temp }}/ci.build.cache
ct-reisen:
name: nodes-ct-reisen
runs-on: ubuntu-latest
steps:
- id: checkout
name: git clone
uses: actions/checkout@v4
with:
submodules: false
- id: nix-install
name: nix install
uses: arcnmx/ci/actions/nix/install@v0.7
- id: ci-dirty
name: nix test dirty
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.ct-reisen.run.test
command: ci-build-dirty
quiet: false
stdout: ${{ runner.temp }}/ci.build.dirty
- id: ci-test
name: nix test build
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.ct-reisen.run.test
command: ci-build-realise
ignore-exit-code: true
quiet: false
stdin: ${{ runner.temp }}/ci.build.dirty
- env:
CI_EXIT_CODE: ${{ steps.ci-test.outputs.exit-code }}
id: ci-summary
name: nix test results
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.ct-reisen.run.test
command: ci-build-summarise
quiet: false
stdin: ${{ runner.temp }}/ci.build.dirty
stdout: ${{ runner.temp }}/ci.build.cache
- env:
CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }}
id: ci-cache
if: always()
name: nix test cache
uses: arcnmx/ci/actions/nix/run@v0.7
with:
attrs: ci.job.ct-reisen.run.test
command: ci-build-cache command: ci-build-cache
quiet: false quiet: false
stdin: ${{ runner.temp }}/ci.build.cache stdin: ${{ runner.temp }}/ci.build.cache

View file

@ -32,7 +32,8 @@ nf-eval() {
} }
for node in reisen; do NF_NODES=$(nix eval --json "${NF_CONFIG_ROOT}#lib.generate.nodeNames")
for node in $(jq -r '.[]' <<<"$NF_NODES"); do
nf-eval --json "lib.generate.nodes.$node.users" "systems/$node/users.json" nf-eval --json "lib.generate.nodes.$node.users" "systems/$node/users.json"
nf-eval --json "lib.generate.nodes.$node.systems" "systems/$node/systems.json" nf-eval --json "lib.generate.nodes.$node.systems" "systems/$node/systems.json"
nf-eval --json "lib.generate.nodes.$node.extern" "systems/$node/extern.json" nf-eval --json "lib.generate.nodes.$node.extern" "systems/$node/extern.json"

View file

@ -37,9 +37,24 @@
} }
} }
}, },
"ct": { "ct-meiling": {
"network": { "network": {
"hostName": "ct", "hostName": "ct-meiling",
"networks": {
"global": null,
"int": null,
"local": {
"address4": null,
"address6": null,
"macAddress": null
},
"tail": null
}
}
},
"ct-reisen": {
"network": {
"hostName": "ct-reisen",
"networks": { "networks": {
"global": null, "global": null,
"int": null, "int": null,
@ -328,6 +343,29 @@
} }
} }
}, },
"meiling": {
"network": {
"hostName": "meiling",
"networks": {
"global": {
"address4": "49.12.128.117",
"address6": null,
"macAddress": null
},
"int": {
"address4": "10.9.1.4",
"address6": "fd0c::4",
"macAddress": null
},
"local": null,
"tail": {
"address4": "100.67.99.30",
"address6": "fd7a:115c:a1e0::dc34:631e",
"macAddress": null
}
}
}
},
"minecraft": { "minecraft": {
"network": { "network": {
"hostName": "minecraft", "hostName": "minecraft",
@ -419,7 +457,11 @@
"address6": null, "address6": null,
"macAddress": null "macAddress": null
}, },
"tail": null "tail": {
"address4": "100.101.208.19",
"address6": "fd7a:115c:a1e0::3034:d013",
"macAddress": null
}
} }
} }
}, },

View file

@ -4,7 +4,7 @@ if [[ $# -gt 0 ]]; then
ARG_NODE=$1 ARG_NODE=$1
shift shift
else else
ARG_NODE=ct ARG_NODE=ct-reisen
fi fi
ARG_CONFIG_PATH=nixosConfigurations.$ARG_NODE.config ARG_CONFIG_PATH=nixosConfigurations.$ARG_NODE.config
@ -12,16 +12,16 @@ RESULT=$(nix build --no-link --print-out-paths \
"${NF_CONFIG_ROOT}#$ARG_CONFIG_PATH.system.build.tarball" \ "${NF_CONFIG_ROOT}#$ARG_CONFIG_PATH.system.build.tarball" \
--show-trace "$@") --show-trace "$@")
if [[ $ARG_NODE = ct ]]; then IMAGEPATH="$(nix eval --raw "${NF_CONFIG_ROOT}#$ARG_CONFIG_PATH.image.filePath")"
DATESTAMP=$(nix eval --raw "${NF_CONFIG_ROOT}#lib.inputs.nixpkgs.sourceInfo.lastModifiedDate") if [[ $ARG_NODE = ct-* ]]; then
DATENAME=${DATESTAMP:0:4}${DATESTAMP:4:2}${DATESTAMP:6:2} #DATESTAMP=$(nix eval --raw "${NF_CONFIG_ROOT}#lib.inputs.nixpkgs.sourceInfo.lastModifiedDate")
SYSARCH=$(nix eval --raw "${NF_CONFIG_ROOT}#$ARG_CONFIG_PATH.nixpkgs.system") #DATENAME=${DATESTAMP:0:4}${DATESTAMP:4:2}${DATESTAMP:6:2}
TAREXT=$(nix eval --raw "${NF_CONFIG_ROOT}#$ARG_CONFIG_PATH.system.build.tarball.extension") #IMAGEEXT="$(nix eval --raw "${NF_CONFIG_ROOT}#$ARG_CONFIG_PATH.image.extension")"
TARNAME=nixos-system-$SYSARCH.tar$TAREXT #OUTNAME="$ARG_NODE-$DATENAME-nixos-image.${IMAGEEXT}"
OUTNAME="ct-$DATENAME-$TARNAME" OUTNAME=$(basename "$IMAGEPATH")
ln -sf "$RESULT/tarball/$TARNAME" "$OUTNAME" ln -sf "$RESULT/$IMAGEPATH" "./$OUTNAME"
echo $OUTNAME echo $OUTNAME
ls -l $OUTNAME ls -l $OUTNAME >&2
else else
echo $RESULT echo "$RESULT/$IMAGEPATH"
fi fi

View file

@ -3,7 +3,7 @@
tree, tree,
}: let }: let
nixlib = inputs.nixpkgs.lib; nixlib = inputs.nixpkgs.lib;
inherit (nixlib.attrsets) mapAttrs mapAttrs' nameValuePair filterAttrs mapAttrsToList; inherit (nixlib.attrsets) attrNames mapAttrs mapAttrs' nameValuePair filterAttrs mapAttrsToList;
inherit (nixlib.lists) sortOn; inherit (nixlib.lists) sortOn;
inherit (inputs.self.lib.lib) userIs; inherit (inputs.self.lib.lib) userIs;
inherit (inputs.self.lib.gensokyo-zone) systems; inherit (inputs.self.lib.gensokyo-zone) systems;
@ -91,5 +91,6 @@ in {
nodes = filterAttrs (_: node: node.proxmox.node.enable) systems; nodes = filterAttrs (_: node: node.proxmox.node.enable) systems;
in in
mapAttrs (_: mkNode) nodes; mapAttrs (_: mkNode) nodes;
nodeNames = attrNames inputs.self.lib.generate.nodes;
systems = mapAttrs mkSystem systems; systems = mapAttrs mkSystem systems;
} }

View file

@ -7,7 +7,8 @@
inherit (lib.modules) mkDefault; inherit (lib.modules) mkDefault;
inherit (lib.strings) escapeRegex; inherit (lib.strings) escapeRegex;
inherit (config.services) nginx tailscale; inherit (config.services) nginx tailscale;
proxyPass = access.proxyUrlFor {serviceName = "proxmox";} + "/"; # TODO: submodule/instancing or options
proxyPass = access.proxyUrlFor {serviceName = "proxmox"; serviceId = "proxmox-reisen"; } + "/";
in { in {
config.services.nginx.virtualHosts = let config.services.nginx.virtualHosts = let
locations."/" = { locations."/" = {

View file

@ -0,0 +1,16 @@
{
lib,
meta,
...
}: let
inherit (lib.modules) mkDefault;
in {
imports = let
inherit (meta) nixos;
in [
nixos.ct.proxmox
nixos.avahi
];
services.kanidm.serverSettings.db_fs_type = mkDefault "zfs";
}

View file

@ -1,7 +1,4 @@
{lib, ...}: let _: {
inherit (lib) mkDefault;
in {
services.kanidm.serverSettings.db_fs_type = mkDefault "zfs";
# work around a filesystem issue when migrating an unprivileged container to privileged # work around a filesystem issue when migrating an unprivileged container to privileged
boot.postBootCommands = '' boot.postBootCommands = ''
if [[ $(stat -c '%u' /) != 0 ]]; then if [[ $(stat -c '%u' /) != 0 ]]; then

View file

@ -0,0 +1,26 @@
{
lib,
gensokyo-zone,
config,
options,
...
}: let
inherit (gensokyo-zone.lib) mkAlmostOptionDefault;
inherit (lib.modules) mkIf;
in {
systemd.services.avahi-daemon = mkIf (options ? proxmoxLXC && config.services.avahi.enable) {
serviceConfig.ExecStartPre = mkIf config.services.resolved.enable [
"+-${config.systemd.package}/bin/resolvectl mdns ${config.systemd.network.networks._00-local.name or "eth0"} yes"
];
};
systemd.network.networks._00-local = mkIf (! options ? proxmoxLXC) {
name = mkAlmostOptionDefault "ens18";
linkConfig.Multicast = true;
networkConfig.MulticastDNS = true;
};
boot.kernel.sysctl = {
# not sure how to get it to overlap with subgid/idmap...
"net.ipv4.ping_group_range" = "0 7999";
};
}

View file

@ -1,31 +1,22 @@
{ {
config,
systemConfig, systemConfig,
gensokyo-zone, gensokyo-zone,
lib, lib,
modulesPath,
meta, meta,
... ...
}: let }: let
inherit (gensokyo-zone.lib) unmerged; inherit (gensokyo-zone.lib) unmerged;
inherit (lib.modules) mkIf mkMerge mkDefault; inherit (lib.modules) mkIf mkMerge;
inherit (lib.attrsets) mapAttrsToList; inherit (lib.attrsets) mapAttrsToList;
inherit (systemConfig) proxmox; inherit (systemConfig) proxmox;
in { in {
imports = let imports = let
inherit (meta) nixos; inherit (meta) nixos;
in [ in [
nixos.hw.headless nixos.hw.proxmox
(modulesPath + "/virtualisation/proxmox-lxc.nix")
]; ];
environment.variables = {
# nix default is way too big
GC_INITIAL_HEAP_SIZE = mkDefault "8M";
};
# XXX: this might be okay if the nix daemon's tmp is overridden
# (but still avoid since containers are usually low on provisioned memory)
boot.tmp.useTmpfs = mkDefault false;
proxmoxLXC.privileged = mkIf (proxmox.container.enable && proxmox.container.privileged) true; proxmoxLXC.privileged = mkIf (proxmox.container.enable && proxmox.container.privileged) true;
systemd.network = mkIf proxmox.enabled (mkMerge (mapAttrsToList (_: interface: systemd.network = mkIf proxmox.enabled (mkMerge (mapAttrsToList (_: interface:
@ -42,4 +33,6 @@ in {
lan.nftables.conditions = intConditions; lan.nftables.conditions = intConditions;
local.nftables.conditions = intConditions; local.nftables.conditions = intConditions;
}; };
image.baseName = "${systemConfig.name}-${config.system.nixos.label}-proxmox";
} }

View file

@ -1,13 +1,10 @@
{ {
lib, lib,
gensokyo-zone,
config, config,
options,
meta, meta,
access, access,
... ...
}: let }: let
inherit (gensokyo-zone.lib) mkAlmostOptionDefault;
inherit (lib.modules) mkIf mkBefore mkOrder; inherit (lib.modules) mkIf mkBefore mkOrder;
enableDns = !config.services.dnsmasq.enable && config.networking.hostName != "utsuho"; enableDns = !config.services.dnsmasq.enable && config.networking.hostName != "utsuho";
in { in {
@ -17,17 +14,6 @@ in {
nixos.avahi nixos.avahi
]; ];
#services.resolved.enable = mkIf enableDns false;
systemd.services.avahi-daemon = mkIf (options ? proxmoxLXC && config.services.avahi.enable) {
serviceConfig.ExecStartPre = mkIf config.services.resolved.enable [
"+-${config.systemd.package}/bin/resolvectl mdns ${config.systemd.network.networks._00-local.name or "eth0"} yes"
];
};
systemd.network.networks._00-local = mkIf (! options ? proxmoxLXC) {
name = mkAlmostOptionDefault "ens18";
linkConfig.Multicast = true;
networkConfig.MulticastDNS = true;
};
networking.nameservers' = mkIf enableDns (mkBefore [ networking.nameservers' = mkIf enableDns (mkBefore [
{address = access.getAddressFor (access.systemForService "dnsmasq").name "lan";} {address = access.getAddressFor (access.systemForService "dnsmasq").name "lan";}
]); ]);
@ -39,9 +25,4 @@ in {
services.resolved.extraConfig = mkIf enableDns '' services.resolved.extraConfig = mkIf enableDns ''
DNSStubListener=no DNSStubListener=no
''; '';
boot.kernel.sysctl = {
# not sure how to get it to overlap with subgid/idmap...
"net.ipv4.ping_group_range" = "0 7999";
};
} }

View file

@ -0,0 +1,15 @@
{
lib,
meta,
...
}: let
inherit (lib.modules) mkDefault;
in {
imports = let
inherit (meta) nixos;
in [
nixos.ct.proxmox
];
services.kanidm.serverSettings.db_fs_type = mkDefault "zfs";
}

23
nixos/hw/proxmox.nix Normal file
View file

@ -0,0 +1,23 @@
{
lib,
modulesPath,
meta,
...
}: let
inherit (lib.modules) mkDefault;
in {
imports = let
inherit (meta) nixos;
in [
nixos.hw.headless
(modulesPath + "/virtualisation/proxmox-lxc.nix")
];
environment.variables = {
# nix default is way too big
GC_INITIAL_HEAP_SIZE = mkDefault "8M";
};
# XXX: this might be okay if the nix daemon's tmp is overridden
# (but still avoid since containers are usually low on provisioned memory)
boot.tmp.useTmpfs = mkDefault false;
}

4
nixos/reisen-ct.nix Normal file
View file

@ -0,0 +1,4 @@
{ meta, ... }: {
# deprecated alias
imports = [ meta.nixos.ct.reisen ];
}

View file

@ -67,6 +67,11 @@
nodeType = "proxmox"; nodeType = "proxmox";
userReferenceSystem = "hakurei"; userReferenceSystem = "hakurei";
}; };
meiling = {
root = ../systems/meiling;
nodeType = "proxmox";
userReferenceSystem = "ct-meiling";
};
}; };
inherit (inputs.self.lib.lib) userIs; inherit (inputs.self.lib.lib) userIs;
INPUT_INFRABINS = string.escapeShellArg [ "putfile64" "pve" "mkpam" "ct-config" ]; INPUT_INFRABINS = string.escapeShellArg [ "putfile64" "pve" "mkpam" "ct-config" ];

View file

@ -28,7 +28,7 @@ deploy -s .#<hostname>
# with trace # with trace
deploy -s .#<hostname> -- --show-trace deploy -s .#<hostname> -- --show-trace
# deploy a fresh container # deploy a fresh container
deploy -s .#<hostname> --hostname ct.local deploy -s .#<hostname> --hostname ct-reisen.local
``` ```
## Editing Secrets ## Editing Secrets
@ -42,7 +42,7 @@ sops nixos/systems/tewi/secrets.yaml
```shell ```shell
nf-sops-keyscan <hostname> nf-sops-keyscan <hostname>
# or on a fresh container... # or on a fresh container...
nf-sops-keyscan ct.local nf-sops-keyscan ct-reisen.local
vim .sops.yaml vim .sops.yaml
for nfsecret in access nix; do sops updatekeys nixos/secrets/$nfsecret.yaml; done for nfsecret in access nix; do sops updatekeys nixos/secrets/$nfsecret.yaml; done
``` ```
@ -60,7 +60,7 @@ nf-tf init -upgrade
### Template ### Template
```shell ```shell
nf-tarball ct nf-tarball ct-reisen
``` ```
[docs-badge]: https://img.shields.io/badge/API-docs-blue.svg?style=flat-square [docs-badge]: https://img.shields.io/badge/API-docs-blue.svg?style=flat-square

View file

@ -0,0 +1,35 @@
{meta, lib, ...}: {
imports = with meta; [
nixos.ct.meiling
];
# allow proxmox to provide us with our hostname
environment.etc.hostname.enable = false;
services.avahi.hostName = "";
system = {
stateVersion = "25.05";
nixos.tags = lib.mkForce [ "template" ];
};
environment.etc."systemd/network/eth9.network.d/int.conf".text = ''
[Match]
Name=eth9
Type=ether
[Link]
RequiredForOnline=false
[Network]
IPv6AcceptRA=true
IPv6SendRA=false
DHCP=no
[IPv6Prefix]
AddressAutoconfiguration=false
Prefix=fd0c::/64
Assign=true
[IPv6AcceptRA]
DHCPv6Client=false
'';
}

View file

@ -0,0 +1,15 @@
_: {
arch = "x86_64";
type = "NixOS";
modules = [
./nixos.nix
];
access.online.enable = false;
network.networks = {
local = {
fqdn = null;
address4 = null;
address6 = null;
};
};
}

View file

@ -1,13 +1,16 @@
{meta, ...}: { {meta, lib, ...}: {
imports = with meta; [ imports = with meta; [
nixos.reisen-ct nixos.ct.reisen
]; ];
# allow proxmox to provide us with our hostname # allow proxmox to provide us with our hostname
environment.etc.hostname.enable = false; environment.etc.hostname.enable = false;
services.avahi.hostName = ""; services.avahi.hostName = "";
system.stateVersion = "23.11"; system = {
stateVersion = "23.11";
nixos.tags = lib.mkForce [ "template" ];
};
environment.etc."systemd/network/eth9.network.d/int.conf".text = '' environment.etc."systemd/network/eth9.network.d/int.conf".text = ''
[Match] [Match]
Name=eth9 Name=eth9

View file

@ -0,0 +1,49 @@
{lib, config, ...}: {
type = "Linux";
proxmox.node = {
enable = true;
};
access = {
online.available = true;
global.enable = true;
};
extern.files = {
"/etc/sysctl.d/50-net.conf" = {
source = ./sysctl.50-net.conf;
};
};
network.networks = {
global = {
address4 = "49.12.128.117";
address6 = null;
};
local = {
inherit (config.network.networks.global) address4;
address6 = null;
};
int = {
address4 = "10.9.1.4";
address6 = "fd0c::4";
};
tail = {
address4 = "100.67.99.30";
address6 = "fd7a:115c:a1e0::dc34:631e";
};
};
exports = {
services = {
tailscale.enable = true;
sshd = {
enable = true;
ports = {
public.enable = false;
standard.listen = "wan";
};
};
proxmox = {
enable = true;
id = "proxmox-meiling";
};
};
};
}

View file

@ -0,0 +1,10 @@
{
"files": {
"/etc/sysctl.d/50-net.conf": {
"group": "root",
"mode": "0644",
"owner": "root",
"source": "systems/meiling/sysctl.50-net.conf"
}
}
}

View file

@ -0,0 +1,7 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ8Z6briIboxIdedPGObEWB6QEQkvxKv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oYH9VpWLRhSgVD6Nvn853pycJAlXQxgOCpSD3/v/JbgUe5NE+ci0o7NMy5IiHUv2gQMRIEhwBHlRGwokUPL9upx0lsjaEiPya5xQqqDKRom87xytM778ANS5CuMdQMWg9qVbpHZUHMjA0QmNkjPgq71pUDXHk5L4mZuS8wVjyjnvlw68yIJuHEc8P7QiLcjvRHFS2L9Ck8NRmPDTQXlQi9kk6LmMyu6fdevR/kZL21b+xO1e2DMyxBbNDTot8luppiiL8adgUDMwptpIne7JCWB1o9NFCbXUVgwuCCYBif6pOGSc6bGo1JTAKMflRlcy6Mi3t5H0mR2lj/sCSTWwTlP5FM4aPIq08NvW6PeuK1bFJY9fIgTwVsUnbAKOhmsMt62w== cardno:12 078 454
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII74JrgGsDQ6r7tD7+k3ykxXV7DpeeFRscPMxrBsDPhz kat@goliath
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDkeBFF4xxZgeURLzNHcvUFxImmkQ3pxXtpj3mtSyHXB kat@koishi
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIC3RkyoQ74bb4NGv1H1bZAz5ROO0Zr6FT8TYpowgGUp kat@chen

14
systems/meiling/setup.sh Normal file
View file

@ -0,0 +1,14 @@
mkshared-nix() {
mkshared nix 0 0 0755
if [[ ! -d /rpool/shared/nix/store ]]; then
zfs create -o compression=zstd rpool/shared/nix/store
fi
if [[ ! -d /rpool/shared/nix/var ]]; then
mkdir /rpool/shared/nix/var
fi
chown 100000:30000 /rpool/shared/nix/store
chmod 1775 /rpool/shared/nix/store
chown 100000:100000 /rpool/shared/nix/var
}
#mkshared-nix

View file

@ -0,0 +1,4 @@
net.ipv4.ping_group_range=0 2147483647
# https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes
net.core.rmem_max=2500000
net.core.wmem_max=2500000

View file

@ -0,0 +1 @@
{}

View file

@ -0,0 +1,30 @@
[
{
"authorizedKeys": [
"ssh-rsa AA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QxgOCpSD3/v/JbgUe5NE+ci0o7NMy5IiHUv2gQMRIEhwBHlRGwokUPL9upx0lsjaEiPya5xQqqDKRom87xytM778ANS5CuMdQMWg9qVbpHZUHMjA0QmNkjPgq71pUDXHk5L4mZuS8wVjyjnvlw68yIJuHEc8P7QiLcjvRHFS2L9Ck8NRmPDTQXlQi9kk6LmMyu6fdevR/kZL21b+xO1e2DMyxBbNDTot8luppiiL8adgUDMwptpIne7JCWB1o9NFCbXUVgwuCCYBif6pOGSc6bGo1JTAKMflRlcy6Mi3t5H0mR2lj/sCSTWwTlP5FM4aPIq08NvW6PeuK1bFJY9fIgTwVsUnbAKOhmsMt62w== cardno:12 078 454",
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAII74JrgGsDQ6r7tD7+k3ykxXV7DpeeFRscPMxrBsDPhz kat@goliath",
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDkeBFF4xxZgeURLzNHcvUFxImmkQ3pxXtpj3mtSyHXB kat@koishi",
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIC3RkyoQ74bb4NGv1H1bZAz5ROO0Zr6FT8TYpowgGUp kat@chen"
],
"name": "kat",
"uid": 8000
},
{
"authorizedKeys": [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ8Z6briIboxIdedPGObEWB6QEQkvxKvnMW/UVU9t/ac mew-pgp"
],
"name": "arc",
"uid": 8001
},
{
"authorizedKeys": [],
"name": "kaosubaloo",
"uid": 8002
},
{
"authorizedKeys": [],
"name": "connieallure",
"uid": 8003
}
]

View file

@ -34,14 +34,22 @@ _: {
address4 = "10.9.1.2"; address4 = "10.9.1.2";
address6 = "fd0c::2"; address6 = "fd0c::2";
}; };
tail = {
address4 = "100.101.208.19";
address6 = "fd7a:115c:a1e0::3034:d013";
};
}; };
exports = { exports = {
services = { services = {
tailscale.enable = true;
sshd = { sshd = {
enable = true; enable = true;
ports.public.enable = false; ports.public.enable = false;
}; };
proxmox.enable = true; proxmox = {
enable = true;
id = "proxmox-reisen";
};
}; };
}; };
} }

View file

@ -247,3 +247,10 @@ module "koishi_system_records" {
zone_zone = cloudflare_zone.gensokyo-zone_zone.zone zone_zone = cloudflare_zone.gensokyo-zone_zone.zone
net_data = local.systems.koishi.network net_data = local.systems.koishi.network
} }
module "meiling_system_records" {
source = "./system/records"
zone_id = cloudflare_zone.gensokyo-zone_zone.id
zone_zone = cloudflare_zone.gensokyo-zone_zone.zone
net_data = local.systems.meiling.network
}

View file

@ -2,6 +2,7 @@ locals {
tailscale_tag_infra = "tag:infrastructure" tailscale_tag_infra = "tag:infrastructure"
tailscale_tag_genso = "tag:gensokyo" tailscale_tag_genso = "tag:gensokyo"
tailscale_tag_reisen = "tag:reisen" tailscale_tag_reisen = "tag:reisen"
tailscale_tag_meiling = "tag:meiling"
tailscale_tag_minecraft = "tag:minecraft" tailscale_tag_minecraft = "tag:minecraft"
tailscale_tag_rtl = "tag:rtl" tailscale_tag_rtl = "tag:rtl"
@ -18,6 +19,7 @@ locals {
tailscale_tags_genso = [local.tailscale_tag_infra, local.tailscale_tag_genso] tailscale_tags_genso = [local.tailscale_tag_infra, local.tailscale_tag_genso]
tailscale_tags_reisen = concat(local.tailscale_tags_genso, [local.tailscale_tag_reisen]) tailscale_tags_reisen = concat(local.tailscale_tags_genso, [local.tailscale_tag_reisen])
tailscale_tags_meiling = concat(local.tailscale_tags_genso, [local.tailscale_tag_meiling])
tailscale_tags_arc = [local.tailscale_user_arc, local.tailscale_tag_arc] tailscale_tags_arc = [local.tailscale_user_arc, local.tailscale_tag_arc]
tailscale_tags_kat = [local.tailscale_user_kat, local.tailscale_tag_kat] tailscale_tags_kat = [local.tailscale_user_kat, local.tailscale_tag_kat]
tailscale_tags_peeps = concat(local.tailscale_tags_arc, local.tailscale_tags_kat) tailscale_tags_peeps = concat(local.tailscale_tags_arc, local.tailscale_tags_kat)
@ -28,6 +30,7 @@ resource "tailscale_acl" "tailnet" {
tagOwners = { tagOwners = {
"${local.tailscale_tag_infra}" : [local.tailscale_group_admin], "${local.tailscale_tag_infra}" : [local.tailscale_group_admin],
"${local.tailscale_tag_reisen}" : [local.tailscale_group_admin, local.tailscale_tag_infra], "${local.tailscale_tag_reisen}" : [local.tailscale_group_admin, local.tailscale_tag_infra],
"${local.tailscale_tag_meiling}" : [local.tailscale_group_admin, local.tailscale_tag_infra],
"${local.tailscale_tag_genso}" : [local.tailscale_group_admin, local.tailscale_tag_arc_deploy, local.tailscale_tag_kat_deploy], "${local.tailscale_tag_genso}" : [local.tailscale_group_admin, local.tailscale_tag_arc_deploy, local.tailscale_tag_kat_deploy],
"${local.tailscale_tag_minecraft}" : [local.tailscale_group_admin, local.tailscale_tag_infra], "${local.tailscale_tag_minecraft}" : [local.tailscale_group_admin, local.tailscale_tag_infra],
"${local.tailscale_tag_rtl}" : [local.tailscale_group_admin, local.tailscale_tag_infra], "${local.tailscale_tag_rtl}" : [local.tailscale_group_admin, local.tailscale_tag_infra],
@ -47,6 +50,11 @@ resource "tailscale_acl" "tailnet" {
src = [local.tailscale_tag_reisen] src = [local.tailscale_tag_reisen]
dst = ["${local.tailscale_tag_reisen}:*"] dst = ["${local.tailscale_tag_reisen}:*"]
}, },
{
action = "accept"
src = [local.tailscale_tag_meiling]
dst = ["${local.tailscale_tag_meiling}:*"]
},
{ {
action = "accept" action = "accept"
src = concat([local.tailscale_tag_genso], local.tailscale_tags_peeps) src = concat([local.tailscale_tag_genso], local.tailscale_tags_peeps)
@ -98,6 +106,15 @@ resource "tailscale_tailnet_key" "reisen" {
depends_on = [tailscale_acl.tailnet] depends_on = [tailscale_acl.tailnet]
} }
resource "tailscale_tailnet_key" "meiling" {
reusable = true
ephemeral = false
preauthorized = true
description = "Meiling VM"
tags = local.tailscale_tags_meiling
depends_on = [tailscale_acl.tailnet]
}
resource "tailscale_tailnet_key" "gensokyo" { resource "tailscale_tailnet_key" "gensokyo" {
reusable = true reusable = true
ephemeral = false ephemeral = false
@ -112,6 +129,11 @@ output "tailscale_key_reisen" {
sensitive = true sensitive = true
} }
output "tailscale_key_meiling" {
value = tailscale_tailnet_key.meiling.key
sensitive = true
}
output "tailscale_key_gensokyo" { output "tailscale_key_gensokyo" {
value = tailscale_tailnet_key.gensokyo.key value = tailscale_tailnet_key.gensokyo.key
sensitive = true sensitive = true