Compare commits

..
15 Commits
Author SHA1 Message Date
RoyDumblauskas af3a94cfc0 add ssh 2026-09-15 23:14:19 -05:00
RoyDumblauskas 2e9fe6b7e6 not using list to attrs 2026-09-15 22:48:15 -05:00
RoyDumblauskas f3cd65ee50 add vm output path 2026-09-15 22:46:31 -05:00
RoyDumblauskas 8c1567b57c flake lock 2026-09-15 22:38:25 -05:00
RoyDumblauskas bd89d462b6 correct path 2026-09-15 22:38:10 -05:00
RoyDumblauskas 74ffdf731c add some vm configs 2026-09-15 22:36:17 -05:00
RoyDumblauskas f65ceb083f add some vm configs 2026-09-15 22:35:50 -05:00
RoyDumblauskas cbdb3f0ad7 prod acme 2026-09-14 01:23:45 -05:00
RoyDumblauskas cf60615046 update quasi secret input 2026-09-12 19:35:14 -05:00
RoyDumblauskas dc131438f5 depend on roypository repo, not github 2026-09-12 19:31:21 -05:00
RoyDumblauskas e04bab6cbb persist acme 2026-09-12 19:04:41 -05:00
RoyDumblauskas d41e3849a9 use colons 2026-09-12 18:47:10 -05:00
RoyDumblauskas 09cb8857cc add more declarative gitea config 2026-09-12 18:44:54 -05:00
RoyDumblauskas 8c878df0d8 remove fixed secret key 2026-09-12 18:10:46 -05:00
RoyDumblauskas 4ecd8fbd67 add fixed secret key 2026-09-12 18:10:25 -05:00
9 changed files with 125 additions and 28 deletions
+4 -2
View File
@@ -64,11 +64,13 @@
echo "Generating templated files" echo "Generating templated files"
gomplate=${pkgs.gomplate}/bin/gomplate gomplate=${pkgs.gomplate}/bin/gomplate
printf '%s' "${opts.database-hostname}" | $gomplate \ printf '{"db_hostname":"%s","web_hostname":"%s"}' \
"${opts.database-hostname}" \
"${opts.default-nginx.hostname}" | $gomplate \
--input-dir=${k3sDir} \ --input-dir=${k3sDir} \
--output-dir=$kubernetes_config \ --output-dir=$kubernetes_config \
--datasource credentials=file://${opts.credentialsFile}?type=application/x-env \ --datasource credentials=file://${opts.credentialsFile}?type=application/x-env \
--datasource dbhostname=stdin: --datasource config=stdin:?type=application/json
echo "Applying k3s config" echo "Applying k3s config"
kubectl=${pkgs.kubectl}/bin/kubectl kubectl=${pkgs.kubectl}/bin/kubectl
+10 -1
View File
@@ -35,7 +35,7 @@ spec:
value: postgres value: postgres
- name: GITEA__database__HOST - name: GITEA__database__HOST
value: '{{ (datasource "dbhostname") }}' value: '{{ (datasource "config").db_hostname }}'
- name: GITEA__database__NAME - name: GITEA__database__NAME
value: '{{ (datasource "credentials").GITEA_DB_NAME }}' value: '{{ (datasource "credentials").GITEA_DB_NAME }}'
@@ -52,6 +52,15 @@ spec:
- name: GITEA__server__SSH_PORT - name: GITEA__server__SSH_PORT
value: "30222" value: "30222"
- name: GITEA__server__DOMAIN
value: '{{ (datasource "config").web_hostname }}'
- name: GITEA__server__SSH_DOMAIN
value: '{{ (datasource "config").web_hostname }}'
- name: GITEA__server__ROOT_URL
value: 'https://{{ (datasource "config").web_hostname }}/'
- name: GITEA__repository__MAX_CREATION_LIMIT - name: GITEA__repository__MAX_CREATION_LIMIT
value: "0" value: "0"
+35 -4
View File
@@ -2,11 +2,11 @@
"nodes": { "nodes": {
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1788405554, "lastModified": 1789344334,
"narHash": "sha256-r2f1oUwixlgq9zOdYLqJLfS/lWBT60/IITjhTKI59JU=", "narHash": "sha256-vdhpDJ3Lr24lkZ+fDCjmBRRtw9/vcSzkqGJOJyF5h2U=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "a5cc6f2c37bf518436dc8d1c288ccd0c43c2f4c4", "rev": "c3eea5b2156db11c7eeeada3dc737711255b253e",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -16,9 +16,40 @@
"type": "github" "type": "github"
} }
}, },
"nixpkgs_2": {
"locked": {
"lastModified": 1789114715,
"narHash": "sha256-ugpsyk3NM2s87vXfUiIIiibbJ4Pp0JPS5p/3mfs+q+c=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "21a67dc470149f337cecafbe965d8d252a390518",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "nixos-26.05",
"repo": "nixpkgs",
"type": "github"
}
},
"postgresql-db": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"path": "../postgresql-db",
"type": "path"
},
"original": {
"path": "../postgresql-db",
"type": "path"
},
"parent": []
},
"root": { "root": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs",
"postgresql-db": "postgresql-db"
} }
} }
}, },
+17 -1
View File
@@ -3,11 +3,27 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
postgresql-db.url = "path:../postgresql-db";
}; };
outputs = outputs =
{ ... }:
{ {
self,
nixpkgs,
postgresql-db,
}@inputs:
{
nixosConfigurations = {
virtual-env = nixpkgs.lib.nixosSystem {
system = "x86_64-linux";
modules = [
./virtual.nix
postgresql-db.nixosModules.postgresql-db
# declare the vm output
"${inputs.nixpkgs}/nixos/modules/virtualisation/incus-virtual-machine.nix"
];
};
};
}; };
} }
@@ -0,0 +1 @@
PSQL_TEST_PASSWORD=password1234
+54
View File
@@ -0,0 +1,54 @@
{
config,
pkgs,
meta,
...
}:
{
# Allow login and remote control of VM
users.users.admin = {
isNormalUser = true;
extraGroups = [ "wheel" ];
openssh.authorizedKeys.keys = [
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFEQyjykrRpkgMFpNAR2G1rbofqbtcuLwIYzgqH85QCn roydumblauskas@gmail.com"
"ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIPERQEHVwrtsWOpu1BgT7b1WNe4ShCy4bXWoGWvYENBw roydumblauskas@gmail.com"
];
};
# ================================ #
# K3S SERVICE #
# ================================ #
services.k3s = {
enable = true;
disable = [ "traefik" ];
role = "server";
# only enable the service on k3s when roughly finalized
# Until then use a vm, as k3s is persisted
extraFlags = [
"--data-dir=/var/lib/rancher/k3s"
"--cluster-cidr=10.42.0.0/20"
];
};
# ================================ #
# PSQL SERVICE #
# ================================ #
# Postgresql/postgrest for row storage (not on k3s)
services.postgresql-db = {
enable = true;
dataDir = "/var/lib/postgresql";
port = 5432;
credentialsFile = ./secrets/ex-psql.yaml;
databases = [
"test"
];
ipMasks = [
"10.42.0.0/20" # k3s pod mask
];
};
}
+1 -17
View File
@@ -118,9 +118,6 @@
]; ];
}; };
# ================================ #
# END K3S SERVICE #
# ================================ #
# ================================ # # ================================ #
# GITEA SERVICE # # GITEA SERVICE #
# ================================ # # ================================ #
@@ -136,18 +133,12 @@
}; };
}; };
# ================================ #
# GITEA SERVICE #
# ================================ #
# ================================ # # ================================ #
# BLOG SERVICE # # BLOG SERVICE #
# ================================ # # ================================ #
# fullstack code. Dev hosted via VMs (incus) # fullstack code. Dev hosted via VMs (incus)
# ================================ #
# END BLOG SERVICE #
# ================================ #
# ================================ # # ================================ #
# PSQL SERVICE # # PSQL SERVICE #
# ================================ # # ================================ #
@@ -166,10 +157,6 @@
]; ];
}; };
# ================================ #
# END PSQL SERVICE #
# ================================ #
# ================================ # # ================================ #
# MINECRAFT # # MINECRAFT #
# ================================ # # ================================ #
@@ -179,10 +166,6 @@
storeDir = "/persist/srv/minecraft"; storeDir = "/persist/srv/minecraft";
}; };
# ================================ #
# END MINECRAFT #
# ================================ #
# Grub Boot Loader Setup # Grub Boot Loader Setup
boot.loader.grub = { boot.loader.grub = {
enable = true; enable = true;
@@ -290,6 +273,7 @@
"/root/.ssh" "/root/.ssh"
"/var/lib/nixos" "/var/lib/nixos"
"/var/db/sudo/lectured" "/var/db/sudo/lectured"
"/var/lib/acme"
]; ];
}; };
+2 -2
View File
@@ -374,12 +374,12 @@
"rev": "2ffdd630adbbe2004366b2d90ef29f62e7f670ca", "rev": "2ffdd630adbbe2004366b2d90ef29f62e7f670ca",
"shallow": true, "shallow": true,
"type": "git", "type": "git",
"url": "ssh://git@github.com/RoyDumblauskas/server-semi-secrets" "url": "ssh://git@roypository.com:30222/RoyDumblauskas/server-semi-secrets"
}, },
"original": { "original": {
"shallow": true, "shallow": true,
"type": "git", "type": "git",
"url": "ssh://git@github.com/RoyDumblauskas/server-semi-secrets" "url": "ssh://git@roypository.com:30222/RoyDumblauskas/server-semi-secrets"
} }
}, },
"root": { "root": {
+1 -1
View File
@@ -4,7 +4,7 @@
inputs = { inputs = {
nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05"; nixpkgs.url = "github:NixOS/nixpkgs/nixos-26.05";
nixvim.url = "github:nix-community/nixvim/nixos-26.05"; nixvim.url = "github:nix-community/nixvim/nixos-26.05";
quasiSecrets.url = "git+ssh://git@github.com/RoyDumblauskas/server-semi-secrets?shallow=1"; quasiSecrets.url = "git+ssh://git@roypository.com:30222/RoyDumblauskas/server-semi-secrets?shallow=1";
home-manager = { home-manager = {
url = "github:nix-community/home-manager/release-26.05"; url = "github:nix-community/home-manager/release-26.05";
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";